2022.1

Table Of Contents
Function Description
(selector)"
on page957
available in Post Pagination Scripts, which are only applied to the Print
context. See "Post Pagination Scripts" on page441.
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;
}
}
masterpage
The masterpage object is used to set a Master Page's header and footer or to replace its entire
HTML body. It can only be accessed in Control Scripts (see "Control Scripts" on page425 and
"Control Script API" on page917). Trying to access it in another type of script will result in an
error.
Note that Master Pages are only used in a Print context (see "Master Pages" on page152).
In script, Master Pages are retrieved via the masterpages Array which contains all Master
Pages in the current template (see "template" on page946).
For example: var myMasterpage = merge.template.masterpages["Master page 1"];.
Functions and fields
Field Type Description
"html()" on
page944
Gets or sets the HTML of the body element.
"margins" on
page973
Margins Allows to set the header and footer of a Master Page, using a
Measurement string, for example: "2in" (this sets a margin to
Page 920