" in the top cell of a column where
categorizations for blocks of rows are placed, e.g.
2012 | Jan | 1000 $ | 2000 $
| Feb | 900 $ | 2100 $
-------8<----- Page break -------------
still | Mar | 1100 $ | 1900 $
2012 | Apr | 1200 $ | 1800 $
| May | 1200 $ | 2200 $
...
While this might be emulated by just stamping "still 2012" on the page using the currently available event
callback tableLayout
, that would fail in the case of the page break happening after the November
line, because the text "still 2012" would then overlap with the new entry "2013" in the 2013 January line.
This problem does not exist when modifying the first cell on the new page because that cell will the be laid out
to have sufficient height so that no overlaps occur.
Example:
public void afterSplitTable(PdfPTable table, PdfPRow startRow, int startIdx) {
PdfPCell cell = startRow.getCells()[0];
cell.addElement(new Paragraph("still " + currentYear));
}
Note that determining the value of currentYear
can be done in tableLayout
by noting the sizes of the tables laid out there and comparing them with the tracked row indices
of the years (via table.getRows()).
- Parameters:
table
- the PdfPTable
in usestartRow
- the first PdfPRow
of the table body on the following pagestartIdx
- the index of that row- Since:
- iText 5.4.3