2019.2

Table Of Contents
Functions and fields
Field Type Description
"Examples" on
page1378
Sets the initial HTML of the body element.
"Setting the margins
of a Print section" on
page1403
Margins Allows to set the header and footer of a Master Page,
using a Measurement string, for example: "2in" (this
sets a margin to two inches).
html(value)
Replaces the contents of the <body> of a section or Master Page by the supplied value. This
function is only available in Control Scripts. See also: "section" on page1395 and
"masterpage" on the previous page.
value
A String that may contain HTML tags.
Examples
The following script loads a snippet based on the value of a field, and then replaces the content
of a Print section with the snippet using html().
var mySection = merge.template.contexts.PRINT.sections["Section
1"];
var promoTxt = loadhtml('snippets/promo-' + record.fields['City'] +
'.html', );
mySection.html(promoTxt);
margins
The margins object is used to set a Print section or Master Page's margins in a Control Script
(see "Control Scripts" on page885 and "Control Script API" on page1351).
Note that Master Pages are only used in a Print context (see "Master Pages" on page505).
The margins object is retrieved via the section object (see "section" on page1395) or via the
masterpages array in a template (see "masterpage" on the previous page), respectively.
Page 1356