We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word to html conversion images position problem

dear sir





i face a problem when doc converted into html there images move in left side not in actual place where it actually available. how to resolve this problem.






thank you
Hi,

Thanks for your inquiry. Please upgrade to the latest version of Aspose.Words for Java 17.2.0 and see how it goes on your end? Hope, this helps.
https://downloads.aspose.com/words/java

In case the problem still remains, please attach the following resources here for testing:

  • Input Word document
  • Aspose.Words generated output HTML showing the undesired behavior.

We will then investigate the issue on our end and provide you more information.

Best regards,

i am using following code for doc to html conversion



Document doc= new Document(“E:\docs\java1.doc”);
HtmlSaveOptions options=new HtmlSaveOptions();
options.setEncoding(Charset.forName(“UTF-8”));
options.setExportPageSetup(true);
options.setSaveFormat(SaveFormat.HTML);
options.setExportImagesAsBase64(true);
doc.save(“E:\docs\sag.html”,options);

but i am not getting my actual result as i expect please reply soon as possible
Hi,

Thanks for your inquiry. Please note that it is not guaranteed that the output HTML file will look exactly the same as the input Word document and in your case the latest version of Aspose.Words mimics the way the Microsoft Word exports your document to HTML format. We have attached a couple of output HTML documents that are generated by using Microsoft Word 2016 and Aspose.Words 17.4 here for your reference.

However, this document looks good when it is converted to HTML Fixed format. We can offer you another solution i.e. converting the Word document to the HTML format using absolutely positioned elements (HtmlFixed) produces the expected output. Here is how you can use HtmlFixedSaveOptions to get output in HtmlFixed save format and perhaps, you will be satisfied with HTML Fixed format.

Document doc = new Document("D:\\temp\\java1.doc");

HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();
opts.setExportEmbeddedImages(true);
opts.setExportEmbeddedCss(true);
opts.setExportEmbeddedFonts(true);
opts.setShowPageBorder(false);

doc.save("D:\\temp\\awjavaout-17.4.html", opts);

Best regards,