2018.2

Table Of Contents
For example: merge.template.contexts.PRINT.sections['Section 2'].restartPageNumber =
true;. (Also see "section" on page782 and "Control Script API" on page749.)
Page numbering starts with page 1 for each section. If for a section restartPageNumber is set to
false, that section will start with the page number following the last page of the previous
section.
Note that even if a section is not enabled (so it will not be outputted), its restartPageNumber flag
is still taken into account for composing the page number sequences.
By default, each section has restartPageNumber = false when the first control script runs.
Tip
If you are looking to create a short, simple table of contents in one section, you could add a
Standard Script that uses the pageRef() function. For an example, see "Creating a table of
contents" on page717.
For a multi-page, cross-section table of contents you must use a Post Pagination Script; see
"Creating a Table Of Contents" on page385.
Examples
Restarting the page numbers several times
Assume that a template has four sections (of 1 page each) in the Print context and a Control
Script sets the page numbering as follows:
1. Section A (1 page) restartPageNumber = true
2. Section B (1 page) restartPageNumber = true
3. Section C (1 page) restartPageNumber = false
4. Section D (1 page) restartPageNumber = true
The code would look like this:
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section A'].restartPageNumber = true;
merge.context.sections['Section B'].restartPageNumber = true;
merge.context.sections['Section C'].restartPageNumber = false;
Page 373