How to insert a new paragraph after all the tables in the doc?

Hi,

I’m building a DOCX document using insertHtml instructions.
After inserting all the tables and text in the doc I want to insert an empty paragraph after all tables (to give some margin to the text next to it).

How can I achieve this?

Or alternatively can I configure the bottom margin of a table?

Hi Paulo,
Thanks for your inqury.
Both are easy to implement using the GetChildNodes method. Please see the code snippets below:
The code below will insert a new paragraph after every table.:

foreach(Table table in doc.GetChildNodes(NodeType.Table, true))
{
    table.ParentNode.InsertAfter(new Paragraph(doc), table);
}

While this code below will change the spacing before a paragraph that directly follows a table, which will increase the space between that paragraph and the table.

foreach(Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
{
    if (para.PreviousSibling != null && para.PreviousSibling.NodeType == NodeType.Table)
    {
        para.ParagraphFormat.SpaceBefore = 24;
    }
}

If you have any further queries then please feel free to ask.
Thanks,