| Search Locate Previous Next | Contents |
All of the tables created so far have appeared with several solid lines, also called rules. The entire table is surrounded by a one-point line, adjacent columns are separated by 0.8point vertical rules, and adjacent rows by 0.01point horizontal rules. Collectively, these are known as gridlines, and they are all part of the same NewLeaf property. You can suppress all of these lines by setting all three gridlines values to zero:
nlInit ª nlUse'' nltGridlines 0 0 0 nltList salesQ1 View docnlClose
The three values indicate the line thickness, in points, of the box that surrounds the table, the vertical rules and the horizontal rules respectively. Any value not explicitly supplied is assumed to be a zero, that is, no line. Drawing only a two-point border around the table is straightforward:
nlInit ª nlUse'' nltGridlines 2 nltList salesQ1 View docnlClose
As you can see, NewLeaf treats any missing gridline value as if it were a zero. To draw a one-point line around the table and a 0.5 point line between the columns:
nlInit ª nlUse'' nltGridlines 1 0.5 0 nltList salesQ1 View docnlClose
Alone among the three parameters, the vertical rule can be a nested vector which NewLeaf reshapes to suit the number of columns in the table. This allows you to put a vertical rule of a specific width between any pair of columns. For example, to indicate that the rightmost column is different (i.e., it contains totals) from the other columns, put a 0.5 point vertical rule to its left:
nlInit ª nlUse'' nltGridlines 1,((1-¯1½salesQ1)0.5),0 nltList salesQ1 View docnlClose
The third gridline value is the height, in points, of the horizontal rule that is drawn between each pair of adjacent rows in the table. To produce a comparable effect horizontally, that is, a line only above the last row in the table, requires a different technique. Set the horizontal rule to a width of zero, put all but the last row of the table on the page, then draw a 0.5 point horizontal rule before adding the last row of the table:
nlInit ª nlUse'' nltGridlines 1 0 0 nltList ¯1[1]salesQ1 nltRule 0.5 nltList ¯1[1]salesQ1 View docnlClose
Now, add the row titles and separate them from the sales figures with a 0.5 point vertical rule. As in the two previous examples, put lines of this same width above the bottom row and to the left of the rightmost column:
nlInit ª nlUse'' nltGridlines 1,(0.5,(1-¯1½salesQ1)0.5),0 nltList ¯1[1]products,salesQ1 nltRule 0.5 nltList ¯1[1]products,salesQ1 View docnlClose
Now, combine this with the other properties in the sales report:
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 nltGridlines 1,(0.5,(1-¯1½salesQ1)0.5),0 nltList ¯1[1]products,salesQ1 nltRule 0.5 nltList ¯1[1]products,salesQ1 View docnlClose