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 TypeMethodDescriptionint
Add cells to the table that was created earlier.void
Add cells to the table that was created earlier.createTable
(PDF pdf) Create aPDFTable
from this header.void
Fill the cell values into theExcel
instance provided.void
fillHeaderCells
(Excel excel) Fill the header values into theExcel
instance provided.void
Fill the cell values into theExcel
instance provided.void
setCellCustomizer
(Function<PDFCell, PDFCell> cellCustomizer) Set a customizer for the cells that will be added later.void
Set caption for a specific column.void
setHorizontalAlignment
(int columnIndex, int alignment) Set horizontal alignment.void
setHorizontalAlignment
(String columnName, int alignment) Set horizontal alignment.void
setVerticalAlignment
(int columnIndex, int alignment) Set vertical alignment.void
setVerticalAlignment
(String columnName, int alignment) Set vertical alignment.void
setWidth
(int columnIndex, int width) Set the relative width of a specific column.void
Set the relative width of a specific column.void
setWidths
(int... widths) Set relative widths.void
Set 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 aPDFTable
from 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 theExcel
instance 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 theExcel
instance 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 theExcel
instance 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.
-