Tables for PDF

Layout and text styles for tables for PDF

Display graphics for PDF tables

The stylesheet p11-tables.xsl has all features and instructions to set up styles for formal tables (which have a title) and informal tables (which do not have a title) for PDF. The features for tables that can be set in the stylesheet are:

XML markup to edit

Alternating row colour. To create individual tables with a colour for every second row, there are two options to add the attribute "tabstyle" to the <table> element:
  • alternating row colour for tables with numbers—use <table tabstyle="numberstripe"> (set this at p11-240)
  • alternating row colour for tables with text—use <table tabstyle="stripe"> (set this at p11-245).
Table formatting with processing instructions. To format specific parts of tables, you can add processing instructions within XML markup. The options for formatting are:
  • Add a background colour to specific table rows or cells—put this example processing instruction immediately inside a <row> element (to colour a row) or inside an <entry> element before any text (to colour a cell): <?dbfo bgcolor="#eeeeee"?> (change the bgcolor value)
  • Rotate text in a specific cell—put both these example processing instructions immediately inside an entry element before any text (change the values for orientation and rotated-width): <?dbfo orientation="90"?> <?dbfo rotated-width="2cm"?>. The attribute orientation=90 rotates the text to the left. The attribute rotated-width sets the height of the cell. Both processing instructions are needed, otherwise the height of the cell will be too large
  • Set the width of a table—put this example processing instruction immediately inside a <table> element (change the width value): <?dbfo table-width="75%"?>. You can use any units of measurement. A percentage value specifies the table width as a percentage of the body text width
  • Break a table row to the next page (to force a row to start on the next page)—put this processing instruction immediately inside a <row> element that you want to appear on the next page: <?rowbr?>.

Stylesheet settings to edit

The relevant Stylesheet Guide page to set up text formats for PDF is PDF-tables.svg.