Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert html to doc in java

I would like to convert either an html or xhtml document (preferably with styles) to Microsoft .doc and/or .docx format.

There seem to be plenty of examples for doing this the other way around but I haven't found any useful examples for converting to ms document formats.

Can anyone point me to an api or provide an example for doing this please

Many thanks

like image 632
Edd Avatar asked Mar 23 '11 09:03

Edd


3 Answers

docx4j 2.8.0 supports converting XHTML documents and fragments to docx content. Disclosure: I wrote some of the code.

like image 95
JasonPlutext Avatar answered Nov 11 '22 04:11

JasonPlutext


Yet another solution would be to use jodconverter which seems to basic html to doc conversion... it doesn't claim to do it well though

like image 27
Edd Avatar answered Nov 11 '22 04:11

Edd


I tried docjx4j API 2.8.1 and it works like wonder. It had ConvertinXHTMLinFile and it works fine. If anyone wants the code I will post it.

Here is the link that helped me : ConvertInXHTMLFile

like image 1
vrivrivri Avatar answered Nov 11 '22 05:11

vrivrivri