Convert HTML to DOC with images in Java

前提是你 提交于 2020-01-15 23:36:01

问题


I am stuck in a Java application.

I have a doubt that is there any way to convert HTML template to DOC Template with Image in HTML file using Java. I have tried Aspose API but I cant use it because it is not open.

I fetch HTML template from database and store the whole template into string and now I want this string output in a WORD DOC including the images.

Here is my piece of code:

proc_stmt = con.prepareCall("{call PROCEDURECALL(?)}");
proc_stmt.registerOutParameter(1, Types.CLOB);
proc_stmt.execute();
String htmltemplate = proc_stmt.getString(1);

I am storing the HTML template in a String and now I want it to be converted in WORD DOC. It also have a image src=local path link.The whole template is working fine but the image is not being posted so can anyone help me with it?


回答1:


Thank you all for the time and help. I tried docjx4j API 2.8.1 and it wors 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 : https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/samples/ConvertInXHTMLFile.java

Once again, Thank you all. Vrinda.



来源:https://stackoverflow.com/questions/17151291/convert-html-to-doc-with-images-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!