Page Break into a table

I have enclosed Output format(OUTPUT.docx) that I’m getting. and Expected output (Expected OUTPUT) format.

The Actual problem is, In a table, particular row should be on next page.
Like after completing index, the main data should be next page and the second heading should be on next page.

Kindly Help,
Thanks Regards,

Hi,

Thanks for your inquiry. You need to define some criteria from where the Table should be split. For example, you can add Bookmarks in first Cells of the Rows that you want to move to next pages.

Looking at the given information, you can build on the logic of following draft code for splitting a Table to multiple pages.

Document doc = new Document(MyDir + "Output.Docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Table tbl = doc.FirstSection.Body.Tables[0];
Table tbl1 = (Table)tbl.Clone(true);
Table tbl2 = (Table)tbl.Clone(true);
int count = tbl.Rows.Count;
for (int i = 9; i < count; i++)
{
    tbl.LastRow.Remove();
}
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln();
doc.FirstSection.Body.InsertBefore(tbl1, doc.FirstSection.Body.LastParagraph);
for (int i = 13; i < count; i++)
{
    tbl1.LastRow.Remove();
}
for (int i = 0; i < 9; i++)
{
    tbl1.FirstRow.Remove();
}
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln();
doc.FirstSection.Body.InsertBefore(tbl2, doc.FirstSection.Body.LastParagraph);
for (int i = 0; i < 13; i++)
{
    tbl2.FirstRow.Remove();
}
doc.Save(MyDir + "17.2.0.docx");

Hope, this helps.

Best regards,