2019.2

Table Of Contents
Example
This script checks if the output channel is EMAIL and if the context to be merged is the Print
context (which happens if the Print context is attached to an email). If this is the case, it includes
and excludes certain Print sections from the output.
if (channel == Channel.EMAIL) {
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section 1'].enabled = false;
merge.context.sections['Section 2'].enabled = false;
merge.context.sections['Section 3'].enabled = true;
}
}
query(selector)
This function of the context object (see "context" on the previous page) returns a result set,
containing the HTML elements in all sections of the Print context that match the supplied CSS
selector.
The new result set is of the type QueryResults, just like the results object which is also the
result of a (hidden) query (see "results" on the next page), but it is read-only.
This function can only be called in a Post Pagination Script (see "Post Pagination Scripts" on
page900). It is indispensable in a script that creates a table of contents, as described in the
following topic: "Creating a Table Of Contents" on page902.
selector
A String containing a CSS selector. See https://www.w3schools.com/cssref/css_selectors.asp
for CSS selectors and combinations of CSS selectors.
Example
This script returns all level 1 headings in all sections of the Print context.
var headings = merge.context.query("h1");
PaginationInfo
The PaginationInfo object is returned by the info() function of the results object (see "info()"
on page1393 and "results" on the next page). It contains information about where an element
is located: on which page and which sheet, and the total number of pages and sheets in the
page bundle in which the element is located.
A page bundle is a group of sections for which the Restart page numbering option is turned off.
Page 1388