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

Free Support Forum - aspose.com

Problem with docx to HTML conversion (overlap images)


We are facing to an issue on Docx to HTML conversion, if the source document are containing superposed shapes. The HTML result is not acceptable, images are not well placed.

Please find enclosed the source document (32-134.docx), the conversion code (code-conversion.txt), and the result (32-134.zip).

We are using the Aspose Word DLL v14.4.0.

Could you please give us a solution for this problem ?

Thank you.

Best regards.

Hi Alexis,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to HTML using MS Word, you will get the same output.

In this case, you may want to save this document in the HTML format using absolutely positioned elements as follows:

Document doc = new Document(MyDir + "32-134.docx");
doc.Save(MyDir + "Out//Out.html", SaveFormat.HtmlFixed);

Please let me know if I can be of any further assistance.


Your code snippets works well, but I have an other constraint.

I need to save the conversion result into a Stream, to avoid HDD writing, in order to return the result in zip file.

I’m using the Interface IResourceSavingCallback to save each resource in a Stream, an then add it in a zipstream.

The stream for each resource is always null.

Please, have a look on the provided code snippets, and keep me in touch for your solution.

Thank you.

Hi Alexis,

Thanks for your inquiry.
In your case, I suggest you please use the following code example to embed all resources in single file and zip that file. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "32-134.docx");
HtmlFixedSaveOptions fixedoptions = new HtmlFixedSaveOptions();
fixedoptions.ExportEmbeddedCss = true;
fixedoptions.ExportEmbeddedFonts = true;
fixedoptions.ExportEmbeddedImages = true;
fixedoptions.ExportEmbeddedSvg = true;
MemoryStream stream = new MemoryStream();
doc.Save(stream, fixedoptions);