2022.2

Table Of Contents
const image = merge.template.images.find(image => image.name == 'dog.jpg');
if (image) {
results.after(`<img src=${image.path}>`);
}
masterpage
ThemasterpageobjectisusedtosetaMasterPage'sheaderandfooterortoreplaceitsentireHTML
body.ItcanonlybeaccessedinControlScripts(see"ControlScripts"onpage398and"ControlScript
API"onpage815).Tryingtoaccessitinanothertypeofscriptwillresultinanerror.
NotethatMasterPagesareonlyusedinaPrintcontext(see"MasterPages"onpage141).
Inscript,MasterPagesareretrievedviathemasterpagesArraywhichcontainsallMasterPagesinthe
currenttemplate(see"template"onpage835).
Forexample:
var myMasterpage = merge.template.masterpages["Master page 1"];.
Functions and fields
Field Type Description
"html()"on
page834
GetsorsetstheHTMLofthebodyelement.
"margins"on
page854
Margins AllowstosettheheaderandfooterofaMasterPage,usingaMeasurementstring,forexample:"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.
html()
Getstheinitialcontentsofthe<body>ofasectionorMasterPage.
html(value)
Replacesthecontentsofthe<body>ofasectionorMasterPagewiththesuppliedvalue.Thisfunction
isonlyavailableinControlScripts.Seealso:"section"onpage848and"masterpage"onpage817.
value
Page 736