PTC ALD in Arbortext Styler > Components of Documents and Templates > Style Components > Rules > Border Rules
Border Rules
Frames, blocks, block regions, tables, table cells, and paragraphs all have a rules property of type fRules. The property is a collection of fRule objects applied to the objects. Each of the fRule objects have further properties, which extend the common rule properties.
Sides of object on which to draw rules
fRule.sides — defines the sides of the rectangular object (paragraph, block, and so on) on which to draw the rule.
The fRule.RuleSides constant in the FOM holds the individual side components supported by PTC Arbortext Layout Developer. When specifying the fRule.sides property on a rule, you can either apply these constants in combination or add the string that they represent. The constant holds the most common side conditions. Block regions and table cells include additional conditions to test the column or row position in which the current object appears.
Some examples of the fRule.RuleSides values:
fRule.SIDE_BOX — draws rules around all the contents of the object.
This value represents the string tblr (top, bottom, left, and right).
fRule.SIDE_CELL — draws rules around the top and left borders of a table cell
This value also draws rules on the right and bottom borders when the cell is on the bottom and/or the right of the table.
The string equivalent is tl[rb], where [rb] tests for the extreme right and extreme bottom position of the cell and applies rules if these conditions are true.
fRule.SIDE_BOX + fRule.SIDE_NW + fRule.SIDE_NE + fRule.SIDE_SW + fRule.SIDE_SE — draw a rule around all edges and allows a corner radius to be applied.
The four fRule.SIDE_** components represent the four corners of the object. The string equivalent is tblr1234.
This example demonstrates how to add different side values together to apply the rule to multiple sides concurrently. The corner values are applied if only a single edge has the rule applied.
Radius for corners
fRule.radius — specifies the size of corner for a rule when applying rule sides to the corners of an object
Positive values give a concave corner, positioning the center of the radius inside the current text object. Negative values position the center outside the text object, giving a cut out effect.
Corner style
fRule.cornerStyle — defines the style of corner output when rules meet each other
Corner styles are listed in the fRule.CornerStyles constant and can be rounded, mitred, or beveled. The default style is rounded.
Fill color
fRule.fillColor — fills an area bounded by a rule with a solid block of color
This property is rarely used as all objects that can take rules can also take a background color value.
This example draws a simple dotted rule all round a block:
var b = new fBlock;

var r = new fRule;
r.thickness = "2pt";
r.lineColor = "red";
r.lineStyle = fRuleLine.LINE_DOT;
r.sides = fRule.SIDE_BOX;

When applying a patterned rule to an object, it is often a requirement that the corners of the rule have a whole mark from the pattern. However, when applying a rule around a shape PTC Arbortext Layout Developer starts and ends at the top left corner. This means that the other corners may not have a whole mark. To achieve the desired effect, it is necessary to apply three rules. The first applies the patterned rule to the top and bottom edges. The second has no color and a negative thickness to bring PTC Arbortext Layout Developer’s drawing process back to the original position of the first rule. The third rule then applies the pattern to the left and right edges. Corner marks overlap.
Source code examples are provided in the \samples\PTC ALD samples directory provided with Arbortext Styler. Refer to the Stylesheet Developer’s Guide to APP Code for annotations for these samples.