Package com.storedobject.pdf
Class TableHeader
java.lang.Object
com.storedobject.pdf.TableHeader
-
Constructor Summary
ConstructorsConstructorDescriptionTableHeader(Iterable<String> cellHeaders) Constructor.TableHeader(String... cellHeaders) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintAdd cells to the table that was created earlier.voidAdd cells to the table that was created earlier.createTable(PDF pdf) Create aPDFTablefrom this header.voidFill the cell values into theExcelinstance provided.voidfillHeaderCells(Excel excel) Fill the header values into theExcelinstance provided.voidFill the cell values into theExcelinstance provided.voidsetCellCustomizer(Function<PDFCell, PDFCell> cellCustomizer) Set a customizer for the cells that will be added later.voidSet caption for a specific column.voidsetHorizontalAlignment(int columnIndex, int alignment) Set horizontal alignment.voidsetHorizontalAlignment(String columnName, int alignment) Set horizontal alignment.voidsetVerticalAlignment(int columnIndex, int alignment) Set vertical alignment.voidsetVerticalAlignment(String columnName, int alignment) Set vertical alignment.voidsetWidth(int columnIndex, int width) Set the relative width of a specific column.voidSet the relative width of a specific column.voidsetWidths(int... widths) Set relative widths.voidSet relative widths.
-
Constructor Details
-
TableHeader
Constructor. Default relative widths of all columns are set to 10. By default, all headers will be centered.- Parameters:
cellHeaders- Cell headers.
-
TableHeader
-
-
Method Details
-
setHeader
Set caption for a specific column.- Parameters:
columnIndex- Column index.caption- Caption to set.
-
setHorizontalAlignment
public void setHorizontalAlignment(int columnIndex, int alignment) Set horizontal alignment.- Parameters:
columnIndex- Column index.alignment- Alignment,
-
setHorizontalAlignment
Set horizontal alignment.- Parameters:
columnName- Column name.alignment- Alignment,
-
setVerticalAlignment
public void setVerticalAlignment(int columnIndex, int alignment) Set vertical alignment.- Parameters:
columnIndex- Column index.alignment- Alignment,
-
setVerticalAlignment
Set vertical alignment.- Parameters:
columnName- Column name.alignment- Alignment,
-
setWidths
public void setWidths(int... widths) Set relative widths. All non-positive values will be ignored as if that value was not present in the parameter.- Parameters:
widths- Relative widths.
-
setWidths
-
setWidth
public void setWidth(int columnIndex, int width) Set the relative width of a specific column.- Parameters:
columnIndex- Column index.width- Relative width.
-
setWidth
Set the relative width of a specific column.- Parameters:
columnName- Column name.width- Relative width.
-
createTable
Create aPDFTablefrom this header.- Parameters:
pdf- PDF to which the table will be added later. (This is required to retrieve the font information from it.)- Returns:
- Newly crated table. The header part of the table will have already created as per the definition of this header.
-
addRow
Add cells to the table that was created earlier.- Parameters:
cells- Cells to add.
-
addCells
Add cells to the table that was created earlier.- Parameters:
startingColumn- Starting column at which cells to be added.cells- Cells to add.- Returns:
- Next column index where further cells can be added.
-
setCellCustomizer
-
fillHeaderCells
Fill the header values into theExcelinstance provided. Values will be filled from left to right, starting from the current cell. Finally, cell position will be set to the next row of the starting cell.- Parameters:
excel- The Excel instance to which values to be filled.
-
fillRow
Fill the cell values into theExcelinstance provided. Values will be filled from left to right, starting from the current cell. Finally, cell position will be set to the next row of the starting cell.- Parameters:
excel- The Excel instance to which values to be filled.cellValues- Cell values to fill.
-
fillCells
Fill the cell values into theExcelinstance provided. Values will be filled from left to right, starting from the current cell. Finally, cell position will be set to the next cell on the right.- Parameters:
excel- The Excel instance to which values to be filled.cellValues- Cell values to fill.
-