2022.2

Table Of Contents
The'currentsection'isalwaysaPrintsection,sincethismethodcanonlybeusedinPostPagination
Scripts,andPostPaginationScriptsonlyrunonthePrintcontext(see"PostPaginationScripts"on
page410).
Youonlyneedtocallmerge.section.paginate()inaPostPaginationScriptifthescripthas
addedorremovedcontenttosuchanextentthatthepageboundariesneedtoberenewed.
Foranexamplesee:"CreatingaTableOfContents"onpage411.
template
Thetemplateobjectrepresentsthetemplatewithallitscontextsandsections.Itisusedfrequentlyin
ControlScripts(see"ControlScripts"onpage398and"ControlScriptAPI"onpage815)butitcanalso
beusedinStandardScripts.
Itisretrievedviathemergeobject:merge.template(see"merge"onpage856).
Whichcontextsareavailableinthetemplatecanbequeriedusingmerge.template.contexts.To
getaccesstoaspecificcontext,youhavetospecifytheContextType(see"ContextType"on
page838).
Field Type Description
contexts Array Arrayofcontexts(see"context"onpage842)availableinthetemplate.Thecontexts
containthesections(see"section"onpage848).
images Array Thelistofimageresources(see"ImageResource"onpage839)includedinthe
template.
masterpages Array ArrayofMasterPages(see"masterpage"onpage817)availableinthetemplate.
"media"on
page819
Array Mediaavailabletothistemplate(see"Media"onpage144).Foreachofthemyoucan
specify,enableandpositionthestationery'sfrontandback.
"properties"onthe
facingpage
Properties Thisobjectcontainsalldefaultpropertiesofthetemplateaswellasanycustom
properties.(Onthemenu,selectFile > Propertiestoviewandcomplementthe
fileproperties.See"FilePropertiesdialog"onpage442).
Example
ThefollowingControlScriptretrievestwoPrintsections.Then,dependingonavalueinthecurrent
record,itenablesonesectionortheother,sothatonlyoneofthetwosectionsappearsintheoutput.
var printSections = merge.template.contexts.PRINT.sections;
printSections['Section EN'].enabled = false;
printSections['Section FR'].enabled = false;
if(record.fields.Language === 'FR'){
printSections['Section FR'].enabled = true;
} else {
Page 834