Native XFA layout queries
Version 2.1190.0 adds provider-free FormCalc queries over the accepted layout, using actual Form objects and the same page, content and geometry snapshots as the runtime
Version 2.1191.1 adds native sheet and sheetCount queries over the accepted physical page surfaces
| Method | Result |
|---|---|
absPageCount() | Number of physical pages |
pageCount() | Number of numbered pages |
sheetCount() | Number of accepted physical page surfaces, including unnumbered and blank surfaces |
sheet(object) | Zero-based first physical surface, using the same object identity and missing-page policy as absPage |
absPage(object) | Zero-based first physical page, or -1 for a recognised object without a live layout page |
page(object) | Logical page label from the accepted numbering snapshot |
absPageSpan(object) | Inclusive first-to-last physical page interval |
pageSpan(object) | Numbered pages in that interval |
x/y/w/h(object [, unit [, index]]) | Parent-relative origin or size of the selected actual fragment |
pageContent(page [, type [, onPageArea]]) | Actual object references on a zero-based physical page |
Page numbering and spans
Physical pages, numbered-page counts and page labels are distinct: an unnumbered page does not increase the numbered count but retains the running label under the existing numbering policy
For example, a four-page layout can have two numbered pages labelled 7 and 8; an entirely unnumbered layout can retain running label 7 whilst pageCount and pageSpan return zero
sheetCount counts completed page surfaces, including duplex filler surfaces; it does not divide by two to estimate pieces of paper
sheet requires exactly one argument and sheetCount takes none; retained removed objects return -1, and null returns zero under the existing absolute-page compatibility policy
Queries inside a handler retain the completed count even after an instance mutation; the next event observes the new count after layout publication
Actual materialised Form containers retain the pages occupied by their unbound descendants, so a container around a three-page field is not reduced to its initial anchor page
Fragment geometry
The supported layout classes are area, contentArea, draw, field, pageArea and subform
Coordinates are relative to the accepted parent border, and width and height describe the selected fragment rather than the union of all object pieces
The default or empty unit is pt; in, cm, mm and pc are also supported
Index defaults to zero and selects the ordered content-area occurrence, including occurrences on the same physical page; a valid index outside the actual list returns zero
Units are case-sensitive and indexes must be nonnegative finite safe integers; unsupported units, invalid classes and malformed arguments produce an event diagnostic
Page content and native iteration
Type may be empty for all containers or one of field, draw, subform, area, pageArea and contentArea
onPageArea defaults to 1 for master-page content; pass 0 for body content
The result preserves accepted snapshot order, removes duplicate identities and returns actual Form references whose values and properties remain available
foreach node in (xfa.layout.pageContent(0, "field", 0)) do
if (node.name eq "payload") then
node.rawValue = "Processed"
endif
endfor
Native foreach evaluates its argument expressions once, expands each reference collection before the first body execution and visits no members for an empty collection
Scalar lists retain their order, break and continue have value zero, and a function return exits through the existing execution cleanup
Lifetime and transactions
Retained removed or remerged objects return zero geometry and spans, and absPage returns -1; they do not acquire replacement geometry
Fresh references after explicit remerge query the accepted replacement layout
Actual Template and Data objects do not gain Form geometry; canonical datasets references and $data retain their Data model identity
Invalid calls preserve public-event rollback, and a later valid event can retry; ordinary resource limits still apply to iteration, query scans and result collections
These queries observe the accepted layout; native relayout requests use deferred publication and bounded ready callbacks, whilst general native collection length/item methods remain separate work
See native layout conditions, XFA form scripting and input events