Yesterday we got a requirement from our consumer to convert MS office document to Html as like a google feature "View as html" on portal. As always it was very urgent and with high priority task on Jira. At first i have tried to solve it on regular way but found that there is no straight forword way on java to manage the task. A few commercial product has available on the web to solve the task. One of them are Davisor, 1 cpu license is about 2400 euro. Another one is Aspose. Download their trail version and first of all i discover that Aspose has not support convert Pdf to Html. Davisor convert MS office document not very well, nested table couldn't convert to html at all.
After a few googling i have found some information to use Open Office Org (ooo) to convert MS office documents to any format including PDF, html e.t.c. Also found a few fragment of code and API documents of OOO and JODConvertor open source to convert MS office documents. With great surprise i found that JOdConverter implements OOO api and it's out of box api to convert documents.
JODconverter library provides:
1) CLI to convert documents from command line
2) High level Java api
3) Web service to convert documents
4) Maven 2 plugin
JodReports even provides very well documented user guide to quick start. All you have to need is to start Open office application as and service and you are ready to go.
For starting OOO follow the command
ip-95-221-157-44:~ samim$ /Applications/OpenOffice.org.app/Contents/MacOS/soffice -accept="socket,host=localhost,port=8100;urp;" -nologo -headless
Now you are ready to make some experiment with MS office documents,
You could also customize your export options whenever convert to PDF documents. JOdConverter save my a lot of time and solve my task and satisfy our customer. Many thank't to the developers of the library.
After a few googling i have found some information to use Open Office Org (ooo) to convert MS office documents to any format including PDF, html e.t.c. Also found a few fragment of code and API documents of OOO and JODConvertor open source to convert MS office documents. With great surprise i found that JOdConverter implements OOO api and it's out of box api to convert documents.
JODconverter library provides:
1) CLI to convert documents from command line
2) High level Java api
3) Web service to convert documents
4) Maven 2 plugin
JodReports even provides very well documented user guide to quick start. All you have to need is to start Open office application as and service and you are ready to go.
For starting OOO follow the command
ip-95-221-157-44:~ samim$ /Applications/OpenOffice.org.app/Contents/MacOS/soffice -accept="socket,host=localhost,port=8100;urp;" -nologo -headless
Now you are ready to make some experiment with MS office documents,
OpenOfficeConnection conn = new SocketOpenOfficeConnection(8100); try { conn.connect(); DocumentConverter converter = new OpenOfficeDocumentConverter(conn); converter.convert(new File("/Users/samim/Downloads/big.doc"), new File("/Users/samim/Downloads/big.html")); } catch (ConnectException e) { e.printStackTrace(); } finally { conn.disconnect(); }
You could also customize your export options whenever convert to PDF documents. JOdConverter save my a lot of time and solve my task and satisfy our customer. Many thank't to the developers of the library.
Comments