5.1. Overview
5.1.1. Features
SDF supports a range of features related to tables including:
- tables are defined in a simple format which is:
- easy to write and read
- upwardly-compatible with the CSV (comma-separated value) format exported by most databases and spreadsheets
- upwardly-compatible with the fixed-width format generated by most reporting tools.
- column widths can be dynamically sized or explicitly set
- heading, footing and group rows can be specified
- table alignment and positioning can be controlled
- cells support custom alignment, shading, ruling and colours.
In fact, SDF can do lots of very clever things with tables including spreadsheet-like calculations on cells and ranges of cells!
5.1.2. Creating a Table
Tables are usually defined via the table filter. For example:
!block table Fruit Comments Tropical: mango a fruit-bat favorite banana great for smoothies Other: Tomato often matched with basil !endblock
or:
!include "fruits.tbl"; table
5.1.3. TBL Format
The table filter expects a table definition in a simple text format (called TBL) where:
- the first (non-comment) line is the header record
- remaining lines are data records.
The header record specifies the field names and the layout. Fields can be placed in fixed-width columns or delimited by a special character. Fixed-width format (as shown above) is usually used.
Note: The width of columns in the "input" has no bearing on the width of columns in the output. To change the output width, refer to Sizing Columns.
See the SDF Reference for further details on TBL format.