I am creating word document in c# with Microsoft.Office.Interop.Word and i have a long table to add.
I am adding the table like this:
//Add paragraph
Microsoft.Office.Interop.Word.Paragraph treesPara = document.Content.Paragraphs.Add(
ref missing);
object styleHeadingTrees = "Heading 2";
treesPara.Range.set_Style(ref styleHeadingTrees);
treesPara.Range.InsertParagraphAfter();
//Create a table and insert data
Microsoft.Office.Interop.Word.Table treesTable = document.Tables.Add(treesPara.Range, 1,
treesData.Tables[0].Columns.Count, ref missing, ref missing);
treesTable.AllowAutoFit = true;
treesTable.Borders.Enable = 1;
After it adding each row like this:
Row tempRow = treesTable.Rows.Add(ref missing);
And inserting the data to it.
The problem is that the last row in each page is cutting and part from the row is in one page and the other part in the next one. how can I check if the next row will be the last in the page? and then i will able to do a page break, so the row will not cut.