Content not inserted when html has style -aw-headerfooter-type (52735)


We have a certain piece of html which we insert in an Aspose.Word document.

We have another document in which we want to insert this Aspose.Word document.
When the original html contains the style -aw-headerfooter-type, this is not correctly inserted.

When we first remove the -aw-headerfooter-type styles, it works as expected.
I tested with the latest version 16.1.0.

I included a VB.NET test project. Just execute it and push the HtmlToWord button.
The source html is in testdoc.html. It will create the resulting Word document in the file testresult.docx.

Can you also reproduce this issue?

Best regards,
Robert Wielink
Infoland BV

Hi Robert,

Thanks for your inquiry. You are facing the expected behavior of Aspose.Words. HtmlSaveOptions.ExportRoundtripInformation property specifies whether to write the roundtrip information when saving to HTML. Default value is true for HTML.

Please note that Aspose.Words imports the Div tags with styles ‘-aw-headerfooter-type:header-primary’ and ‘-aw-headerfooter-type:footer-primary’ into header/footer primary of Document. If you want to insert html in the body of a section, please remove these styles from your html.

In your case, we suggest you please use HtmlSaveOptions.ExportRoundtripInformation property as false while saving document to html. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
HtmlSaveOptions options = new HtmlSaveOptions();
options.ExportRoundtripInformation = false;
doc.Save(MyDir + "Out.html", options);

Thanks for the info.
We will just remove the attributes from existing html, and make sure we don’t export them using the property you suggest.

Robert Wielink
Infoland BV