'Declaration Public Overrides Sub DefineSection( _ ByVal properties As SectionProperties _ )
public override void DefineSection( SectionProperties properties )
Exception | Description |
---|---|
WordDocumentWriterException | Thrown if no document is currently open, or if a paragraph is currently open. |
WordprocessingML does not natively store the concept of pages, since the number of pages in a document is driven by the nature of the content. Consider the case where the user changes the size of the font for all text in a document; the number of pages in that document is likely to change, since factors such as the number of characters in the document and the size of each character determine the total amount of space required to present the content.
This method defines a section which applies to content (i.e., paragraphs and tables) that was previously written to the document. The properties of the object passed to this method define the page size, orientation, and margins for the pages on which that content will appear, thus defining a section in the document to which the designated content belongs.
Example: To add three paragraphs which are to appear on pages that are 7" x 5" at landscape orientation, first call the StartDocument, AddTextRun, and EndDocument methods for each of the three paragraphs. Next, call the DefineSection method, passing in a SectionProperties instance on which the PageSize property is set to (7, 5), and the PageOrientation property is set to 'Landscape'.
The FinalSectionProperties property can be used to define the pagination for all content which is not associated with any section defined by this method.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2