Page 1 of 1

Open .rtf with docx4j

PostPosted: Fri Dec 05, 2014 8:23 pm
by Lars10503
Is there any way to open a rtf-File?

I tried:

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new FileInputStream(new File(dataDir + "file.rtf")));

Or is there another lib wich can do this?

Re: Open .rtf with docx4j

PostPosted: Fri Dec 05, 2014 9:12 pm
by jason
docx4j is for docx files.

You could first convert rtf to docx using LibreOffice. Or Microsoft Word, of course.

Re: Open .rtf with docx4j

PostPosted: Sat Dec 06, 2014 11:05 pm
by Lars10503
Thanks for your answer, but my Problem is that I get a huge number of rtf files from another system and have to automatically convert it into docx files with Java.

Do you know any way do do this?

Re: Open .rtf with docx4j

PostPosted: Sun Dec 07, 2014 8:51 am
by jason
Use LIbreOffice, driven by JODConverter.

See https://code.google.com/p/jodconverter/

At https://github.com/mirkonasato/jodconverter mirkonasato says:

I started this project back in 2003, but I am no longer maintaining it. I moved the code here at GitHub in the hope that a well-maintained fork will emerge.


see further https://groups.google.com/forum/#!topic ... pB54AmCbfQ

and he doesn't seem to be accepting pull requests https://github.com/mirkonasato/jodconverter/pulls

So far, a well-maintained fork doesn't seem to have emerged, perhaps because jodconverter is pretty good as it is?

But maybe https://github.com/faquino/jodconverter is a contender?