Package com.itextpdf.text.pdf
Interface PdfPTableEventAfterSplit
-
- All Superinterfaces:
PdfPTableEvent
,PdfPTableEventSplit
- All Known Implementing Classes:
PdfPTableEventForwarder
public interface PdfPTableEventAfterSplit extends PdfPTableEventSplit
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
afterSplitTable(PdfPTable table, PdfPRow startRow, int startIdx)
This method is called to indicate that table has been split.-
Methods inherited from interface com.itextpdf.text.pdf.PdfPTableEvent
tableLayout
-
Methods inherited from interface com.itextpdf.text.pdf.PdfPTableEventSplit
splitTable
-
-
-
-
Method Detail
-
afterSplitTable
void afterSplitTable(PdfPTable table, PdfPRow startRow, int startIdx)
This method is called to indicate that table has been split. It's called after thetableLayout
method and after the table has been drawn on the previous page but before the rest of the table is laid out on the following page. It is meant to allow modifications of the table, e.g. by changing cells. This is useful for situations when some information has to be repeated, like putting "still" 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 callbacktableLayout
, 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 ofcurrentYear
can be done intableLayout
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
- thePdfPTable
in usestartRow
- the firstPdfPRow
of the table body on the following pagestartIdx
- the index of that row- Since:
- iText 5.4.3
-
-