How automatically move cell to next page

How automatically move cell to next page? If merged cell situated at bottom of page i want move cell to next page to his child cells

Hi Ahvahsky,

Thanks for your inquiry. Please use following code example to achieve your requirements. Hope this helps you.

If you still face problem, please share your input document here for our reference. We will then provide you more information on this along with code.

Document doc = new Document(MyDir + "in.docx");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
foreach (Row row in table.Rows)
{
    if (row.ToString(SaveFormat.Text).Trim().Contains("Department2"))
    {
        row.FirstCell.FirstParagraph.ParagraphFormat.PageBreakBefore = true;
    }
}
doc.Save(MyDir + "Out.docx");