Macro Language Reference > PIs > Tables > <?tbcrules>
  
<?tbcrules>
Description
The <?tbcrules> command is used to assign rules to cells in a table. There are two forms of the command, each having several parameters that must be included.
The first form of the command configures the rule by firstly specifying the number of cell rules required, then assigning a number to each rule and finally confirming the details for each rule. An example is shown below:
<?tbcrules=2(1,thickness,"color(;radius)?","sides")(2,thickness,
"color(;radius)?","sides")>
The second form of the tbcrules command uses the '+' symbol instead of num: use this form to add cell rules to an existing set of rule properties:
<?tbcrules= +(thickness,"color(;radius)?","sides")("thickness,
color(;radius)?","sides")>
This command can also be specified using <?tbcellrules>.
 
Example 412. Apply table rules to all sides of a cell
The example below will insert a black rule of 1pt width to all sides of every cell in a table:
<?tbcrules +(1pt, "black", "tbrl")>
 
For this example, the properties <?tbcolgut=2mm> and <?tbrgut=2mm> have been applied to the table.
 
Example 413. Apply a diagonal rule to all cells in the second column
The example below will insert a diagonal black rule of 1pt width to the cells in the second column of a table:
<?tbcrules +(1pt, "black", "(x=2)u")>
 
Example 414. Apply table rules except in specified conditions
The example below will insert the specified rule on the top of each cell, except for cells on the top row:
<?tbcrules=1(1,1pt,"black","(?~t)t")>
The same condition is expanded and explained in words below:
<?tbcrules=1(1,1pt,"black","(test-ifnot-top)top")>
 
Example 415. Apply a diagonal rule based on a user defined line style to specific cells in a table (post v9.1 line options)
The example below will insert different diagonal rules to the cells in specified columns of a table:
<?tbcrules +(1pt, "black", "(x=1)d(x=3)u(x=5)du", 0, "none",
"none", "_li_jagged")>
To apply foreground and background colours to the same rules, follow the example detailed below:
<?tbcrules +(1pt, "red", "(x=1)d(x=3)u(x=5)du", 0, "none",
"blue", "_li_shortdashes")>
Syntax
<?tbcrules rulecount:n? ('(' ruleno:n? thickness:uh color:c? flags:b? radius:um? fillcolor:c? bgcolor:c? start segment name:s? end segment name:s? cornerstyle:b ')' )+>
rulecount
If the first version of the command is used, this parameter specifies the total number of rules that are going to be defined in this command.
ruleno
If the first version of the command is used, this parameter specifies this particular rule's number, i.e. if it were the first in the list this would be 1 e.g.<?tbcrules=2(1,...)(2,...)> shows you wish to define the first rule out of a set of 2.
thickness
The width of the rule and valid measurement unit, e.g. 5pt or 5mm
color
Color of the rule: can be any color name or type that is valid in PTC ALD , e.g. 50%, red or PANTONE_E_202-4_CVP (if loaded from a color book). Must be enclosed in double quotes.
To support existing files, if the foreground color had a semicolon followed by a number, this is interpreted as the radius field.
flags
The placement conditions for this rule — must be enclosed in double quotes:
t
Top
b
Bottom
l
Left
r
Right
u
Draw a diagonal rule from bottom left to top right.
d
Draw a diagonal rule from top left to bottom right.
p
Point the ends of the diagonal rule so they fit neatly into the corners of any outer rules.
c
Draw a rounded cap on the ends of the diagonal rules.
e
Instead of fitting the diagonal rule inside the bounding box, let them overlap so the middle of the rule ends will be exactly over the corners of the bounding box.
1
Top left corner
2
Top right corner
3
Bottom left corner
4
Bottom right corner
5
Top left corner
6
Top right corner
7
Bottom left corner
8
Bottom right corner
/
Merge rules together and create a 3D effect.
#
Use a hash rule width instead of the whole width of the cell for the rule. This allows you to specify rules that do not span into gutters: 3 options for specifying hash rule width are available:
width of the longest item in the cell
width of the last line in the cell
width of the rules from the previous row
See <?tbcrhash> for more details.
The flags parameter also includes any conditional testing you wish to apply to cell rules. The syntax for conditional location testing is detailed below:
x
Column containing the cell (1 denotes the first column in the table)
y
Row containing the cell (1 denotes the first row in the table)
=
Equals, e.g. x=4 means "column 4"
?
If, e.g. ?t means "if top"
~
If not, e.g. ~= means "if does not equal"
/
Divisible by, e.g. ?y/3 means "if row is divisible by 3"
^ or >
Is greater than, e.g. y>2 means "row number is greater than 2"
 
An alternative syntax for this test has been introduced, i.e. ^[char 60]. If using this syntax the macro must begin with a preceding ^ character to ensure the function char is resolved.
v or <
Is less than, e.g. y<4 means "row number is less than 4"
 
An alternative syntax for this test has been introduced, i.e. ^[char 62]. If using this syntax the macro must begin with a preceding ^ character to ensure the function char is resolved.
sx
Number of columns spanned by a cell, e.g. sx>1 means "cell spans more than 1 column"
sy
Number of rows spanned by a cell, e.g. sy<3 means "cell spans less than 3 rows"
ex
Number of the end column, e.g. (x+sx-1=ex)
ey
Number of the end row, e.g. (y+sy-1)=ey)
?f
Row is just before a break in the table, i.e. the table footer
?h
Row is just after a break in the table, i.e. the table header
radius
The size of the corner rules.
fillcolor
Color of the fill within the rule definition: can be any color name or type that is valid in PTC ALD , e.g. 50%, red or PANTONE_E_202-4_CVP (if loaded from a color book). Must be enclosed in double quotes.
bgcolor
Color of the rule background: can be any color name or type that is valid in PTC ALD , e.g. 50%, red or PANTONE_E_202-4_CVP (if loaded from a color book). Must be enclosed in double quotes.
line name
The name of a particular used defined line style, created via the tlctrl macro. Must be enclosed in double quotes.
start segment name
The name of a particular user defined line segment to act as the end character for the line. Line segments are created via the tlsctrl macro. Must be enclosed in double quotes.
end segment name
The name of a particular user defined line segment to act as the start character for the line. Line segments are created via the tlsctrl macro. Must be enclosed in double quotes.
cornerstyle
The type of corner to be applied to the rule.
0
Rounded
1
Mitred (default)
2
Bevelled
Additional Information
Additional table rules options allow the application of rules based on user-defined line styles and patterns. For further information about user defined line styles, please refer to the macros tlctrl, tlpctrl and tlsctrl
Following this cell rule command with a <?tbrdef> PI will set the row's properties with these details and hence all cells in the row will have the same rules. Alternatively you can use the <?tbcrules> command to override a particular rule that has been specified.
Related Links