The <table> tag builds a table. Sub tags are:
top left cells
cell data as a list
cell bold font
The number of data entries must match the number of col and row entries.
Only <col>, <row> and <data> entries are needed.
The <col> and <row> entries are lists, delimited by blank or comma. If an entry has blanks, surround it with double quotes. For example, this has 3 column headers:
The <top> and <col> entries may be on more than one line, where delimited by <br/>. For example:
Note that where <br/> is given, so that the top and column headers are on more than one line, then this must be taken into account when giving values for alignment and cell fonts that apply to each cell in the table. For example, if there are 2 column header lines, row labels are given, and data is a 3 x 5 table, then the total table is 5 x 6, i.e. 30 cells in all.
<table> <col>first second third</col> <row>one two</row> <data>10 20 30 40 45 50 </data> <high>0 0 1</high> </table>
The following tags can be used within <table></table>.
Alignment can be given for the data cells only, or for all cells. The value can be:
- applied to data cells only:
- a single number
- a list with one number per column
- a list with one number per data cell
- applied to all cells:
- a list with one number per top, column
- a list with one number for all cells, including top,
- row, col labels
The <align> values are 0 1 2 for left, center and right.
Default alignment is center for column headers and cells, and left for top and row labels.
The <bold> values indicate a bold font, and are given as for the <align> tag.
A value of 1 means use a bold font, and 0 means use the normal font .
The default values are 1 for header and row labels, and 0 for data cells.
This are the column headers (excluding any top left column header). The values are separated by commas or spaces. Use double quotes if a header itself contains commas or spaces. Use <br/> to indicate a line feed, i..e a multi-line column header, e.g:
<col>sales branch<br/>offices "tel no"</col>
|sales | branch | tel no | | | offices | |
The data is comma or space delimited. Use double quotes for any item that itself contains commas or spaces. The data length must match the number of rows and columns.
Multiple lines in a cell are delimited by <br/>, e.g.
See section on grid lines below.
The <high> values are highlight indices, and are given as for the <align> tag.
The indices are used to select rows from the table TCOLOR, which is a numeric table with 6 columns. In each row, the first three numbers are the pencolor, and the last three, the background color.
TCOLOR has at least three rows. The first three rows of TCOLOR are default colors for: top and col headers; row labels; data cells. The remaining rows are used for highlights.
A <high> value of 0 uses the appropriate default value, and a value of 1 or more selects a highlight row. For example:
TCOLOR 0 0 0 192 192 192 0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 253 204 255 255 255 0 128 128
In this case, top and column headers have a black pen, and a grey (192 192 192) background. The row labels and data cells have a black pen and white background. A <high> value of 1 selects a black pen, and a light yellow (255 253 204) background. A <high> value of 2 selects a white pen, and a jade (0 128 128) background.
This is the row labels (excluding any top left row label). The values are separated by commas or spaces.
This is the top left corner. As for <col>, use <br/> for a multiline header.
The <gridh> and <gridv> tags specify horizontal and vertical grid lines.
The exact drawing of grid lines depends on the table class. For example, the keskey class always has a horizontal grid line drawn under the column headers.
If the grid tags are not given, no additional grid lines are drawn.
The entry in a grid tag is either a single number (draw all possible grid lines), or a list of numbers, with one more number than the corresponding number of rows or columns.
For example, if the output table is:
+-----+---+---+-----+ | |one|two|three| +-----+---+---+-----+ |alpha|2 |3 |5 | +-----+---+---+-----+ |beta |7 |11 |13 | +-----+---+---+-----+
then this has 4 possible horizontal grid lines, and 5 possible vertical grid lines.
Each number in a grid tag is a multiple of the standard table gridline size, i.e. TGRIDSIZE.
For example, using the above table, to draw a standard size horizontal grid line between row 2 and 3, and a double sized horizontal grid line at the bottom:
<gridh>0 0 1 2</gridh>
To draw all vertical grid lines, at the standard size:
A table is automatically adjusted if necessary, in order to fit in the width of a page.
The method is to first reduce all margins as required, down to 50% of the original margin size. If this is still too wide, the fonts are reduced as required, down to 50% of the original font size. If this is still too wide, the table is printed as is, and will be shown truncated.