PTC ALD in Arbortext Styler > Components of Documents and Templates > Style Components > Text Styling > Applying Text Style Changes Inline
  
Applying Text Style Changes Inline
When formatting text, the PTC Arbortext Layout Developer formatting process makes the current style available for change through the FOM property formatting.currentStyle. formatting refers to the fFormatting object, which represents the current formatting state during formatting and provides access to various methods and properties. The currentStyle property is an fStyle object. It can provide access to all the formatting properties on that object.
For example, to request an inline change to the text height:
formatting.currentStyle.height = "30pt";
This sets the height property on the current style object to 30pt.
PTC Arbortext Layout Developer does not automatically reset style changes once an element has ended, this need to be handled in the template. PTC Arbortext Layout Developer provides styleSave() and styleRestore() methods on the fFormatting object to save and restore style properties. styleSave() delimits a set of properties that will change, and saves their original values. styleRestore() removes the changes to the attributes by restoring the saved style. This is particularly helpful when multiple changes are applied concurrently and need to be removed concurrently.
For example:
formatting.styleSave();
var s = formatting.currentStyle;
s.height = "30pt";
s.color = "red";
s.font = "MyriadPro";
...
formatting.styleRestore();
In this code block, the current formatting properties are saved, then changes are made. The formatting.styleRestore() command reinstates the properties stored in the formatting.styleSave() action. Typically you would use the first part of the code in the onEnter source of a context and the styleRestore() part in the onExit source.
Save and restore pairs can be nested up to 25 levels.