1

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?

6
  • This code is not really relevant to your problem. Could you tell us how you want to create the word doc? And what the html template looks like? A trick could be to create a html page, rename it to doc, et voila... Commented Jun 17, 2013 at 15:39
  • ya I tried that too but the image src tag in HTML does not show image in my WORD template. Commented Jun 17, 2013 at 15:51
  • I posted this code to show that I get the whole HTML template into a string. Commented Jun 17, 2013 at 15:51
  • "I have tried Aspose API but I cant use it because it is not open." By 'open' DYM 'open source' or 'free'? The two are not the same thing. Commented Jun 17, 2013 at 17:56
  • I mean free because in my word document I get this first line of "Evaluation only" so Commented Jun 17, 2013 at 19:14

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Vrinda, the link posted by you is no more available. Can you please post it again, or if you can provide any pointers to convert HTML to Word doc. Thanks in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.