| Search Locate Previous Next | Contents |
This function allows for very complex formatting of tabular data, with most properties available at cell level. If you have a simple formatting job, where you do not need wrapping of text into cells, and can use column-level formatting, use leaf.table.List instead, as it is much faster. To populate a table with data:
leaf.table.Spread matrix
Each element of the matrix will occupy one cell, and will be aligned as per the pre-set columns alignments. Text will be wrapped into the cells (increasing the cell depth) as required. If the table is too wide for the frame, it will walk across columns, repeating key columns as required. You can constrain the total number of pages used with the fit to page property which will reduce the final table in proportion as necessary. Numbers will have the default formatting applied unless you have already set up a suitable format string for the table.
If a cells content is a matrix (with >1 row) then NewLeaf assumes that the application has already wrapped the text and does not change the given line-breaks.
In general, a cell will never be broken across a page boundary. The only exception is when the cell occupies more than 25% of the frame height, and does not fit into the current frame.
Setting one-off properties
The optional left argument can set any of emphasis,colour etc. passed as a vector of property-value pairs. The values may only be numeric codes here, and would generally have been computed from the data matrix. For example ...
('emph' emp)('col' clr)('shade' (3 5½1 2 3)) leaf.table.Spread mat
The properties you may include here are:
The property values will normally match the shape of the data matrix, or may be a vector matching the number of columns. However, hgrid and vgrid would generally match the number of rows and number of columns respectively and the indent level is taken to apply down the first column only if it is passed as a vector.
Typically this could be use to make -ve numbers red, for example
clr9×mat<0 © colour-9 is bright red
Colours 0..15 are indices into the colour table. For emphasis, use 1=bold, 2=italic, 4=underline, 8=strikethrough, summed as required. Cell borders are numbers in the range 0-9999 representing line-weights 1-9 for edges lrbt so 20 is a 2-pixel line below the cell.
This facility only applies to cell-level formatting you cannot use it to set column widths, titles and so on.