- 3 minutes to read
Within a document, there is often a need for groupings of content on a basis larger than a paragraph (for example, ensuring that a specific set of paragraphs and tables are printed in a landscape view, while ensuring that the remainder of the document is printed in a portrait view). In order to group this content, a document can be divided into multiple sections, each of which defines a region of content in the document and allows the application of a set of section-level properties.
A document contains at least one section. A section is a sequence of contiguous paragraphs within a sub-document's text buffer. To delimit document sections, the end of a section is marked by a specific section break (or by the final paragraph's end mark at the end of the document). The boundaries of sections mark locations where the layout rules for a document (the page size and orientation, the size of columns, text of headers and footers, the availability and display of page numbers, etc.) are changed.
A section is a logical unit that contains settings specific for its different elements and that defines to which text buffer interval these settings should be applied. Programmatically, a section is implemented as the Section client object. A list of section objects in the document can be accessed through the sectionsInfo client property (RichEditDocument.sectionsInfo) in the following notation:
A section defines the following settings.
Start position (Section.start)
A position in a sub-document text buffer where the section's first paragraph starts.
The number of characters in a section within the text buffer.
The following client commands are available for manipulating sections and their settings. Call the commands in the notation given below:
|changePageMargins||RichEditCommands.changePageMargins||Gets a command to apply page margins settings to sections located within a selected range.|
|changePageOrientation||RichEditCommands.changePageOrientation||Gets a command to apply page orientation settings to sections located within a selected range.|
|changePageSize||RichEditCommands.changePageSize||Gets a command to apply page size settings to sections located within a selected range.|
|changeSectionColumns||RichEditCommands.changeSectionColumns||Gets a command to apply column layout settings to a section.|
|changeSectionEqualColumnCount||RichEditCommands.changeSectionEqualColumnCount||Gets a command to change the number of columns having the same width in a section.|
|setDifferentFirstPageHeaderFooter||RichEditCommands.setDifferentFirstPageHeaderFooter||Gets a command to enable (or disable if it is enabled) a different page header and footer for the first page of the current section.|
|openPageMarginsDialog||RichEditCommands.openPageMarginsDialog||Gets a command to invoke the Margins tab of the Page Setup dialog window.|
|openPagePaperSizeDialog||RichEditCommands.openPagePaperSizeDialog||Gets a command to invoke the Paper tab of the Page Setup dialog window.|
|openSectionColumnsDialog||RichEditCommands.openSectionColumnsDialog||Gets a command to invoke the Columns dialog window.|
|setPageSizeDialog||RichEditCommands.setPageSizeDialog||Gets a command to invoke the Page Setup dialog.|