XSL-FO Tables
XSL-FO provides nine elements for creating tables with headers, footers, column definitions, and data cells, giving PdfBroker.io everything it needs to render structured tabular data in your PDFs.
Table Elements
| Element | Purpose |
|---|---|
<fo:table-and-caption> | Container for table and optional caption |
<fo:table> | The table element |
<fo:table-caption> | Optional table caption |
<fo:table-column> | Column definition (width, number) |
<fo:table-header> | Table header section |
<fo:table-footer> | Table footer section |
<fo:table-body> | Table body containing rows |
<fo:table-row> | Individual table row |
<fo:table-cell> | Individual table cell |
Example
A two-column table with headers and data:
<fo:table border="1pt solid black">
<fo:table-column column-width="50%" />
<fo:table-column column-width="50%" />
<fo:table-header>
<fo:table-row>
<fo:table-cell padding="2mm">
<fo:block font-weight="bold">Car</fo:block>
</fo:table-cell>
<fo:table-cell padding="2mm">
<fo:block font-weight="bold">Price</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="2mm">
<fo:block>Volvo</fo:block>
</fo:table-cell>
<fo:table-cell padding="2mm">
<fo:block>$50000</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2mm">
<fo:block>SAAB</fo:block>
</fo:table-cell>
<fo:table-cell padding="2mm">
<fo:block>$48000</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>