DocumentBuilder For Tables

When using the DocumentBuilder to build a table, an extra line break appears after the table. Is there anyway to prevent this?

Thanks,
- J

Hi

Thanks for your inquiry. Could you please provide me your code output document and expected result? I will check the issue and provide you more information.
Also, note that Section in MS Word document cannot have Table as a last node. There should be at least one Paragraph at the end of the Section.
Best regards,

Hi Alexey,

I sent you an email with a sample document attached.

Thanks,
- J

Hi

Thank you for additional information. I think, you can try using the following code to remove an extra paragraph break after the table inserted by DocumentBuilder:

DocumentBuilder builder = new DocumentBuilder();
// move cursor into the header.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
// Build some table.
for (int i = 0; i <5; i++)
{
    for (int j = 0; j <5; j++)
    {
        builder.InsertCell();
        builder.Write("This is table");
    }
    builder.EndRow();
}
builder.EndTable();
// Once we inserted table into the header, and we no longer need DocumentBuilder in the header,
// We can remove current paragraph of the DocumentBuilder.
builder.CurrentParagraph.Remove();
// Save the result.
builder.Document.Save(@"Test001\out.doc");

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards.

Great, thank you!