Search Locate Previous Next Contents

Column Width

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:

nlInit ª nlUse''
nltCellWidths (¯1†½salesQ1)½54
nltList salesQ1
View doc„nlClose

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:

nlInit ª nlUse''
nltCellWidths (¯1+¯1†½salesQ1)½54
nltList salesQ1
View doc„nlClose

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):

nlInit ª nlUse''
nltCellWidths ¯1,(¯1†½salesQ1)½72×0.75
nltList products,salesQ1
View doc„nlClose

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:

nlInit ª nlUse''
nltFont (›'TI,10'),((¯1+¯1†½salesQ1)½›'HE,10'),›'HEB,10'
nltQfmt (›''),((¯1+¯1†½salesQ1)½›'CF8.1'),›'CF9.1'
nltAlign (›'left'),(¯1†½salesQ1)½›'decimal1'
nltCellWidths 72×0.9,((¯1+¯1†½salesQ1)½0.75),0.8
nltList products,salesQ1
View doc„nlClose


Continue to: Table Border and Gridlines
© Copyright Causeway Graphical Systems Ltd 2001