Free Support Forum - aspose.com

Row.IsInNewPage Property?

Laurence,

Many of our customers need the ability to insert page breaks in the middle of data tables. We were quite happy when Aspose.Pdf added this functionality, however we can't do it in Aspose.Words yet. Can you add this property?

Thanks,
Natan

Laurence,

After a little investigation, I've discovered that you can't insert a page break inside a table without bringing the entire table down to the next page. Perhaps the algorithm could be this:

If Row.IsInNewPage {

End the current table;
While Not IsNextPage {
Insert a line break;
}
Start a new table and insert one cell;

}

Natan

As you probably know Aspose.Words does not do page layout now. It means we cannot say if the subsequent row will be on a new page or not. The table behavior during page layout is usually controlled by RowFormat.AllowBreakAcrossPages property. If you want to ensure keeping several logically united rows on the same table you can nest them inside cells with invisible borders and set the RowFormat.AllowBreakAcrossPages property for these cells rows to false.

If you want add page break in the middle of already existing tables then you need to insert a paragraph after the table, then position DocumentBuilder to it and insert a page break. After that insert a new table after page break and move the necessary rows to this new table.

Best regards,