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

Free Support Forum - aspose.com

Retain Image at Centered Aligned during DOC to HTML Conversion | C# .NET

please try converting attached doc to HTML with latest Aspose Words .NET. Image that is centered in Word doc is not being centered in HTML output. Could you tell me why? Is it a bug?

Doc1_v2.docx (126.6 KB)



I have manually converted “Doc1_v2.docx” to HTML format by using MS Word 2019 and attached it here for your reference (see html produced by ms word 2019.zip (50.5 KB)). You can observe the same undesired behavior of image in MS Word’s generated HTML file. So, this is the expected behavior as Aspose.Words mimics the behavior of MS Word in this case.

Alternatively, may be you should convert this document to ‘HTML Fixed format’ i.e. converting the Word document to the HTML format using absolutely positioned elements (HtmlFixed) should produce the expected output for you.

Document doc = new Document("C:\\Temp\\Doc1_v2.docx");

HtmlFixedSaveOptions options = new HtmlFixedSaveOptions()
    ExportEmbeddedImages = true,
    ExportEmbeddedCss = true,
    PrettyFormat = true

doc.Save("C:\\Temp\\21.9.html", options);