Class PdfTable
java.lang.Object
com.codename1.pdf.PdfTable
A table for PdfLayout. Columns share the available width in
proportion to their weights; cells fill the rows left to right and wrap
their text. A row that does not fit continues on the next page, and the
header rows are repeated at the top of every page the table spans.
PdfDocument doc = new PdfDocument();
PdfLayout layout = new PdfLayout(doc, PdfPageSize.A4, 54);
PdfTable t = new PdfTable(3, 1, 1).setHeaderRows(1);
t.addCell(new PdfParagraph("Item", PdfFont.HELVETICA_BOLD, 10), 1, 0xeeeeee);
t.addCell(new PdfParagraph("Qty", PdfFont.HELVETICA_BOLD, 10), 1, 0xeeeeee);
t.addCell(new PdfParagraph("Price", PdfFont.HELVETICA_BOLD, 10), 1, 0xeeeeee);
t.addCell("Consulting").addCell("12").addCell("$1,200.00");
layout.add(t);
-
Constructor Summary
ConstructorsConstructorDescriptionPdfTable(float... columnWeights) A table with one column per weight; each weight must be positive. -
Method Summary
Modifier and TypeMethodDescriptionaddCell(PdfParagraph paragraph) Adds a cell holdingparagraph.addCell(PdfParagraph paragraph, int colspan, int backgroundRgb) Adds a cell spanningcolspancolumns, filled withbackgroundRgb, or transparent when it is negative.Adds a cell of plain text in the table's font.setBorder(float width, int rgb) The width and color of the cell borders; a width of 0 draws none.setCellPadding(float points) The space between a cell's border and its text; 4 points by default.The font of cells added as plain strings.setHeaderRows(int rows) The number of leading rows that form the header; 0 by default.setSpaceAfter(float points) The space below the table; 8 points by default.
-
Constructor Details
-
PdfTable
public PdfTable(float... columnWeights) A table with one column per weight; each weight must be positive.
-
-
Method Details
-
setHeaderRows
The number of leading rows that form the header; 0 by default. -
setCellPadding
The space between a cell's border and its text; 4 points by default. -
setBorder
The width and color of the cell borders; a width of 0 draws none. -
setFont
-
setSpaceAfter
The space below the table; 8 points by default. -
addCell
-
addCell
Adds a cell holdingparagraph. -
addCell
Adds a cell spanningcolspancolumns, filled withbackgroundRgb, or transparent when it is negative.
-