Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Blocks > Rotate a Block > Simple Block Rotation
  
Simple Block Rotation
Refer to the para in chapter context in the Arbortext-path/samples/ALD/Blocks/Rotation/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 IF attribute “role” = “90” of the para in chapter context references the rotate 90 property set. That property set rotates a block by 90 degrees clockwise. The relevant code in that property set is given below.
block.orientation = fBlock.ORIENT_90;
Here you have set the block orientation property for the fBlock object. Using the constant ORIENT_90 will rotate the block by 90 degrees clockwise. Use ORIENT_180 or ORIENT_270 to rotate by 180 degrees and 270 degrees clockwise, respectively. Note that if a 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 90 property set:
block.width = "70mm";
Here you have added a width property to the fBlock object. This property is specified in the form of 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.