Skip to content

Instantly share code, notes, and snippets.

@bjoerntx

bjoerntx/test.cs Secret

Created August 4, 2023 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/a002e883ff32e736b64fe091d693b161 to your computer and use it in GitHub Desktop.
Save bjoerntx/a002e883ff32e736b64fe091d693b161 to your computer and use it in GitHub Desktop.
// Find the first table row on the next page
private TableRow FindFirstTableRowOnNextPage(Table table, TableRow startTableRow = null) {
if (startTableRow == null) {
startTableRow = table.Rows.GetItem(1);
}
int tableStart = table.Cells.GetItem(startTableRow.Row, 1).Start;
int tableStartPage = textControl1.GetPages().GetItem(tableStart).Number;
TableRow row = null;
// If the table is not across pages,
for (int i = startTableRow.Row + 1; i <= table.Rows.Count; i++) {
row = table.Rows.GetItem(i);
int rowStart = table.Cells.GetItem(row.Row, 1).Start;
// return the first row on the next page
if (textControl1.GetPages().GetItem(rowStart).Number > tableStartPage) {
break;
}
}
return row;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment