Search Locate Previous Next Contents

Adding Table Headings and Captions

At this point, the content of the table is complete but it would benefit from the addition of a caption. You have considerable flexibility in associating text with the table, using any or all of the following properties:

You can set the font and colour of any of these elements, and the alignment (left, centre, right) of the headers and footnote.

For now, set a standard heading, centred above the table:

leaf.Use''
leaf.table.Heading'Table 1. First Quarter Sales ($000''s)'
leaf.table.List salesQ1
View doc„leaf.Close

Observe what happens when the left and right indents are set to one inch:

leaf.Init ª leaf.Use''
leaf.Indent 72 × 1 1 0
leaf.Align 'centre'
leaf.table.Heading'Table 1. First Quarter Sales ($000''s)'
leaf.table.List salesQ1
View doc„leaf.Close

Now, try setting each of the first two indents separately to one inch to see what happens to the width and the position of the table and caption.

Completing the Sales Report

By default, a table will occupy the entire frame width, but if you give the all the cell widths explicitly it may be less wide than the frame (in which case it will be aligned using the current paragraph alignment) or some columns may be dropped from the right-hand edge. So, to centre the complete sales report, together with its heading and a footnote:

leaf.Init ª leaf.Use''
 ncol„¯1†½products,salesQ1 ª cw„72×0.9,((ncol-2)½0.75),0.8
 leaf.Align'centre'
 leaf.table.Font(›'TI,10'),((ncol-2)½›'HE,10'),›'HEB,10'
 leaf.table.Qfmt(›''),((ncol-2)½›'CF8.1'),›'CF9.1'
 leaf.table.Align(›'left'),(ncol-1)½›'decimal1'
 leaf.table.CellWidths cw
 leaf.table.Gridlines 1,(›0.5,(2-ncol)†0.5),0
 leaf.table.Spacing 1 1
 leaf.table.TFont'TI,10'
 leaf.table.Titles('' 'North'),(2†districts),(›'South'),2‡districts
 leaf.table.TDepth 0 0 1 1 0 1 1 1 0
 leaf.table.TAlign('centre' 'right')[1+0 0 1 1 0 1 1 1 0]
 leaf.table.Heading'Table 1. First Quarter Sales ($000''s)'
 leaf.table.Footnote'Printed on 25/12/1999' 'by Adrian'
 leaf.table.List ¯1‡[1]products,salesQ1
 leaf.table.Rule 0.5
 leaf.table.Spacing 3 3
 leaf.table.List ¯1†[1]products,salesQ1
 View doc„leaf.Close


Continue to: Tables Wider Than One Page
© Copyright Causeway Graphical Systems Ltd 2001