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;
}
}
query(selector)
Thisfunctionofthecontextobject(see"context"onthepreviouspage)returnsaresultset,con-
tainingtheHTMLelementsinallsectionsofthePrintcontextthatmatchthesuppliedCSSselector.
ThenewresultsetisofthetypeQueryResults,justliketheresultsobjectwhichisalsotheresult
ofa(hidden)query(see"results"onthenextpage),butitisread-only.
ThisfunctioncanonlybecalledinaPostPaginationScript(see"PostPaginationScripts"on
page850).Itisindispensableinascriptthatcreatesatableofcontents,asdescribedinthefollowing
topic:"CreatingaTableOfContents"onpage852.
selector
AStringcontainingaCSSselector.Seehttps://www.w3schools.com/cssref/css_selectors.aspforCSS
selectorsandcombinationsofCSSselectors.
Example
Thisscriptreturnsalllevel1headingsinallsectionsofthePrintcontext.
var headings = merge.context.query("h1");
PaginationInfo
ThePaginationInfoobjectisreturnedbytheinfo()functionoftheresultsobject(see"info()"on
page1304and"results"onthenextpage).Itcontainsinformationaboutwhereanelementislocated:
onwhichpageandwhichsheet,andthetotalnumberofpagesandsheetsinthepagebundleinwhich
theelementislocated.
Apage bundleisagroupofsectionsforwhichtheRestartpagenumberingoptionisturnedoff.In
otherwords,pagenumberingcontinuesfromthestartofthefirstsectiontotheendofthelastsectionin
thegroup.(See"Configuringpagenumbers"onpage458and"ControlScript:Pagenumbering"on
page841.)
Page 1300