| Search Locate Previous Next | Contents |
By default, NewLeaf divides the space between the sides of the frame equally among the columns of a table. You can set the column widths to a specific number of points to display the table of sales data in column widths of 3/4 inch (54 points), type:
leaf.Init ª leaf.Use'' leaf.table.CellWidths (¯1½salesQ1)½54 leaf.table.List salesQ1 View docleaf.Close
Note that the vector of cell widths contains one element per column in the table. Any column or columns that do not have an explicit cell width, or which have a cell width of ¯1, will be allocated an equal share of the space remaining in the frame after any explicit column widths are allocated.
To illustrate this, note what happens when you set the width explicitly for all but the rightmost column:
leaf.Init ª leaf.Use'' leaf.table.CellWidths (¯1+¯1½salesQ1)½54 leaf.table.List salesQ1 View docleaf.Close
It is also simple to allocate the remaining space to the row titles. Set the width of the first column to ¯1 and the width of each of the sales data columns to 3/4 inch (remember to multiply by 72):
leaf.Init ª leaf.Use'' leaf.table.CellWidths ¯1,(¯1½salesQ1)½72×0.75 leaf.table.List products,salesQ1 View docleaf.Close
Having decided on the font, numeric data formatting and alignment, you can now set the columns in the sales report to the appropriate widths. The following example also uses column widths measured in inches, and wider columns for the row titles and row totals:
leaf.Init ª leaf.Use'' leaf.table.Font ('TI,10'),((¯1+¯1½salesQ1)½'HE,10'),'HEB,10' leaf.table.Qfmt (''),((¯1+¯1½salesQ1)½'CF8.1'),'CF9.1' leaf.table.Align ('left'),(¯1½salesQ1)½'decimal1' leaf.table.CellWidths 72×0.9,((¯1+¯1½salesQ1)½0.75),0.8 leaf.table.List products,salesQ1 View docleaf.Close