Convert HTML to DOC with images in Java

2019-08-04 01:24发布

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条回答
SAY GOODBYE
2楼-- · 2019-08-04 02:13

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.

查看更多
登录 后发表回答