Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Blocks > Rotate a Block > Nested Blocks with Rotation
Nested Blocks with Rotation
Refer to the para in note context in the blockRotation.xml sample file. The context includes a set of conditions based on the value of the role attribute in the associated stylesheet. . Each condition references a different property set.
For example, the condition ELSE IF attribute “role” = “270 rules” of the para in note context references the block box and rotate 270 property sets. block box draws rules around the block (see Apply Boxing to a Block for further information). rotate 270 rotates a block within its parent by 270 degrees clockwise. Note that the note in which the paragraph appears does not rotate. The relevant code in the property set is given below.
block.orientation = fBlock.ORIENT_270;
Here you have added a block orientation property to the fBlock object. Using the constant ORIENT_270 means will rotate the block by 270 degrees clockwise. Use ORIENT_90 or ORIENT_180 to rotate by 90 degrees and 180 degrees clockwise, respectively. Note that if the block is rotated by 180 degrees its content will appear upside down.
If you are rotating a block so that it will appear vertically on the page, it is a good idea to provide a width to the block. This will manifest itself as a vertical height limit once the block has been rotated, and prevents the block from occupying the whole of the available vertical space on a page. Refer to the next entry in the code in the rotate 270 property set:
block.width = "70mm";
Here you have added a width property to the fBlock object. This property is specified via the fColumnWidth datatype object, which represents a length value used in a block or table. This datatype accepts relative, percent, measure, or ruleWidth settings. The code phrase from the property set provides a measure for the width.