Table structures can be created using the p:table
and p:cell
tags. Unlike many table structures, there is no explicit row declaration. If a table has 3 columns, then every 3 cells will automatically form a row. Header and footer rows can be declared, and the headers and footers will be repeated in the event a table structure spans multiple pages.
<p:document xmlns:p="https://jboss.com/products/seam/pdf"
xmlns:ui="https://java.sun.com/jsf/facelets"
title="Hello">
<p:table columns="3" headerRows="1">
<p:cell>name</p:cell>
<p:cell>owner</p:cell>
<p:cell>size</p:cell>
<ui:repeat value="#{documents}" var="doc">
<p:cell>#{doc.name}</p:cell>
<p:cell>#{doc.user.name}</p:cell>
<p:cell>#{doc.size}</p:cell>
</ui:repeat>
</p:table>
</p:document>
p:table
supports the following attributes.
-
columns
-
The number of columns (cells) that make up a table row.
-
widths
-
The relative widths of each column. There should be one value for each column. For example: widths="2 1 1" would indicate that there are 3 columns and the first column should be twice the size of the second and third column.
-
headerRows
-
The initial number of rows which are considered to be headers or footer rows and should be repeated if the table spans multiple pages.
-
footerRows
-
The number of rows that are considered to be footer rows. This value is subtracted from the headerRows
value. If document has 2 rows which make up the header and one row that makes up the footer, headerRows
should be set to 3 and footerRows
should be set to 1
-
widthPercentage
-
The percentage of the page width that the table spans.
-
horizontalAlignment
-
-
skipFirstHeader
-
-
runDirection
-
-
lockedWidth
-
-
splitRows
-
-
spacingBefore
-
The blank space to be inserted before the element.
-
spacingAfter
-
The blank space to be inserted after the element.
-
extendLastRow
-
-
headersInEvent
-
-
splitLate
-
-
keepTogether
-