2022.2

Table Of Contents
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thefacingpage),butitisread-only.
ThisfunctioncanonlybecalledinaPostPaginationScript(see"PostPaginationScripts"on
page410).Itisindispensableinascriptthatcreatesatableofcontents,asdescribedinthefollowing
topic:"CreatingaTableOfContents"onpage411.
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
page847and"results"onthefacingpage).Itcontainsinformationaboutwhereanelementislocated:
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137and"ControlScript:Pagenumbering"on
page400.)
ThePaginationInfoobject(aswellastheinfo()function)isonlyavailableinPostPaginationScripts
(see"PostPaginationScripts"onpage410).ItisessentialinaPostPaginationScriptthatcreatesa
tableofcontents,asdescribedinthefollowingtopic:"CreatingaTableOfContents"onpage411.
Forthetotalpagecount,sheetcountandstart/endpagenumbersofasingle section,usethesec-
tionobject's"Pagination"onpage855(seealso:"section"onpage848).
Page 842