We have a template that renders a series of records in word tables.
There can be many records and each individual record is represented as a word table.
Our customer ideally wanted to keep each record on its own page, so did not want a records table starting at the top of a page and finishing halfway down the next page. In this scenario the record should start at the top of the next page.
We were able to implement this using code similar to that shown below.
- Code: Select all
foreach (TableRow row in table.Rows)
{
foreach (TableCell cell in row.Cells)
{
foreach (Paragraph p in cell.Paragraphs)
{
p.Format.KeepFollow = true;
}
}
}
However, we have recently encountered an instance where the table is actually too large to fit on one page.
When we do NOT execute the code above the doc saves fine but it just "hangs" unresponsively for ages if we have set KeepFollow to true.
The data in the table is obviously dynamic (so for one doc a text field will contain only a small amount of data but another could contain larger amounts of text).
is there some way to stop this error from occurring (i.e. keep it on one page if it will fit but stop it throwing an error if it does not fit)?