When you set HtmlSaveOptions.ExportRoundtripInformation property to ‘true’ (default is true), Aspose.Words exports these custom “-aw-*” CSS properties in HTML as part of round-trip information. Aspose.Words writes this “-aw-import:ignore” when it needs to make certain elements visible in HTML that would otherwise be collapsed and hidden by web browsers e.g. empty paragraphs, space sequences, etc. To workaround this problem you can explicitly disable this HtmlSaveOptions.ExportRoundtripInformation by using the following code:
Document doc = new Document("C:\\Temp\\a.docx");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);
opts.PrettyFormat = true;
opts.ExportRoundtripInformation = false;
P.S. Currently we mark only the following elements with “-aw-import:ignore”:
** Sequences of spaces and non-breaking spaces that are used to simulate padding on native list item (
<li> ) elements.*
** Non-breaking spaces that are used to prevent empty paragraphs from collapsing.*
However, note that this list is not fixed and we may add more cases to it in the future.
Also, please note that Aspose.Words write
is not defined in XML. And by default Aspose.Words generate XHTML documents ( i.e. HTML documents that comply with XML rules ).