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

Free Support Forum - aspose.com

Help with formatting after inserthtml

I am trying to format the last 2 headings in the document 4.3.4 and 4.3.5 to be like 4.3.3. But somehow it seems inserting the html table corrupts the formatting somehow.
Please take a look.nightCoderPOC.zip (28.6 KB)

@nightcoder The problem occurs because after inserting HTML table you immediately start another table. This creates two tables, which are not separated with a paragraph break. In this case tables are concatenated, this is by design. You can simply add a paragraph after the HTML table to get the desired result. For example use this code at the beginning of AddSectionHeadingTable method

DocumentBuilder builder = new DocumentBuilder(Doc);
builder.MoveToDocumentEnd();

if (builder.CurrentParagraph.PreviousSibling != null && 
    builder.CurrentParagraph.PreviousSibling.NodeType == NodeType.Table)
    builder.Writeln();
1 Like