PTC ALD in Arbortext Styler > Components of Documents and Templates > Conditional Text Formatting > Format Result Testing
Format Result Testing
It is often necessary to extend tests further than the content structure when formatting. More aesthetic results can be obtained when you test the current state of formatting to drive further formatting rules and property changes. PTC Arbortext Layout Developer can provide this information to the template code.
PTC Arbortext Layout Developer’s Formatting Object Model (FOM) does not currently provide access to format results. This information will be made available through a set of display objects in a future release. Format results are mostly obtained through PTC Arbortext Layout Developer’s getvar system, a set of variables that is accessed with show strings.
You can find a list of getvar information stored by PTC Arbortext Layout Developer by accessing the Text > Show string > Insert Show String > 3B2 variable (getvar) > Code number menu in the PTC Arbortext Layout Developer— Desktop product.
Refer to User’s Guide for information on how to query information using showstrings.
Common Format Result Tests
Format result tests can access this type of information:
Current page in the document
This example code gets the current page within the document:
var currentPage = formatting.currentPage.pos;
where the pos property gives the current page’s position within the document, starting at 0 for the first page. fFormatting.currentPage is an fPage object that gives information about the current page being formatted.
Page orientation (left or right)
Some designs feature different layout on odd and even pages. The current page information, gathered as shown in the previous example, can be tested to ascertain whether the returned value is odd or even. For example:
var currentPage = formatting.currentPage.pos;

if (currentPage % 2) {
else {
Current page position starts from 0. Odd pages have even current page position numbers, for example the fourth page in a sequence is numbered 5.
Current page type
The fLayerGroup object applied to the current page, if named sensibly, provides information about the page, including the page set in Arbortext Styler.
Use currentPage to extract this information, for example:
var currentPageLayout = formatting.currentPage.layerGroup;
When the text is being applied to the page, the layer group being applied is the final one in PTC Arbortext Layout Developer’s page layout selection process.
Column on page (frames)
Evaluating an PTC Arbortext Layout Developer getvar with a showstring can obtain the number of the frame column in which the current paragraph started:
var startColumn = formatting.evaluateShowString("$01645v");
Where the getvar numbered 01645 represents the start column.
Use similar code to gather number of the column in which the current paragraph ended:
var endColumn = formatting.evaluateShowString("$01646v");
If the start and end column numbers are stored, you can verify if the formatting of a paragraph completed. If it did not, you can add an action such as outputting a message.
Column within table
Evaluating a getvar with a showstring can obtain the number of the current column in the table:
var colNum = formatting.evaluateShowString("$01627v");
Row within table
Evaluating a getvar with a showstring can obtain the number of the current row in the table:
var rowNum = formatting.evaluateShowString("$01626v");
Line within paragraph
Evaluating a getvar with a showstring can obtain the number of the line within the current paragraph:
var lineNum = formatting.evaluateShowString("$01610v");
This information can be tested to verify if the line is the first one in the paragraph. You can also test this in the onExit code of an element to confirm the number of lines made by the paragraph.
Line within column
Evaluating a getvar with a showstring can obtain the number of the line within the current column:
var lineNum = formatting.evaluateShowString("$01611v");
Line on page
Evaluating a getvar with a showstring can obtain the number of the line on the page:
var lineNum = formatting.evaluateShowString("$01612v");
Current baseline position
Evaluating a getvar with a showstring can obtain the baseline position of the current line (the vertical measure from the top of the page):
var baselinePosition = formatting.evaluateShowString("$21620v");
This measure is correct before vertical justification has been applied.
Available measure
It can be useful to know the width of the current measure, for example when deciding if a graphic can fit.
This information can be obtained by evaluating a getvar with a showstring:
var width = formatting.evaluateShowString("$^21633") - formatting.evaluateShowString("$^21631");
This code subtracts the position of the left edge of the measure (21631) from the position of the right edge (21633).