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

Free Support Forum - aspose.com

List format lost during document generation with InsertHtml

I am attempting to generate word documents based off of content copied and pasted as HTML from Word.
In some instances, the HTML inserted appears to break the List formatting/Numbering within the document.
AsposeDocumentTest.zip (6.3 MB)
The example will generate 6 example documents. 1 example is what we expect, and the other 5 are generated with problematic HTML from word. All the html snippets are stored within the code example.

@JamTheMan Could you please attach your input document, HTML, code that will allow us to reproduce the problem and the problematic output generated on your side? We will check the issue and provide you more information.

I have added the solution and source code to recreate the issue I’m seeing. Please ask me if you have any questions.

@JamTheMan The problem is that your HTML content has paragraphs, which are not list items and they override the current formatting of DocumentBuilder. Probably in your case you can try using HtmlInsertOptions.UseBuilderFormatting

documentBuilder.InsertHtml(html, HtmlInsertOptions.UseBuilderFormatting);

In this case the inserted HTML paragraphs will use DocumentBuilder's formatting as base.