views:

309

answers:

2

Hi all,

Does anyone have any experience with doing mail merge from Java on a word document? I need to support both doc and docx formats.

I have heard of Apache POI and docx4j. However, from reading around I'm sure how good the word support is in POI. docx4j only supports docx format as far as I can see.

Can any suggest either one of the above (and correct my knowledge on support) or another appropriate library. If necessary I would be willing to use one lib for doc and another for docx.

Thanks.

+1  A: 

Working with MS Word documents is very hard. DOC format is very complicated, DOCX is in theory simpler, but it is rather new and there is no mature, feature rich Java library to work with it and DOC as well.

The easiest solutions to most problems connected with working with MS Office documents is describe in the Joel Spolsky article. I hope you can use this method in your application.

Piotr Kochański
Thanks, after trying to use the Open Office APIs I'm forced to agree with the article.
Mike Q
A: 

Have a look at OpenOffice to see [manually] whether it can produce the types of files you need. Just load up some docs, and save some docs and docx versions. If the results pass these simple manual tests, then Docmosis or JODReports can automate this from Java.

jowierun