2022.2

Table Of Contents
Example
ThisscriptchecksiftheoutputchannelisEMAILandifthecontexttobemergedisthePrintcontext
(whichhappensifthePrintcontextisattachedtoanemail).Ifthisisthecase,itincludesandexcludes
certainPrintsectionsfromthe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setaMasterPage'sheaderandfooterortoreplaceitsentireHTML
body.ItcanonlybeaccessedinControlScripts(see"ControlScripts"onpage838and"ControlScript
API"onpage1271).Tryingtoaccessitinanothertypeofscriptwillresultinanerror.
NotethatMasterPagesareonlyusedinaPrintcontext(see"MasterPages"onpage462).
Inscript,MasterPagesareretrievedviathemasterpagesArraywhichcontainsallMasterPagesinthe
currenttemplate(see"template"onpage1292).
Forexample:
var myMasterpage = merge.template.masterpages["Master page 1"];.
Functions and fields
Field Type Description
"html()"on
page1291
GetsorsetstheHTMLofthebodyelement.
"margins"on
page1311
Margins AllowstosettheheaderandfooterofaMasterPage,usingaMeasurementstring,forexample:"2in"
(thissetsamargintotwoinches).
html()
InaControlScript,thehtml()functionofasectionorMasterPagecanbeusedtogettheinitialcon-
tentsofits<body>,andmodifythem.Thismakesitpossible,forexample,topopulateasectionor
MasterPagewithelementsretrievedfromaContentManagementsystem,beforeStandardScripts
run.
Page 1274