Version

DefineSection Method (WordDocumentWriter)

Creates a section in the document, which defines the pagination for paragraphs and tables that were written since the last section was created.
Syntax
'Declaration
 
Public MustOverride Sub DefineSection( _
   ByVal properties As SectionProperties _
) 
public abstract void DefineSection( 
   SectionProperties properties
)

Parameters

properties
A SectionProperties instance which defines properties such as page size, margins, and orientation. An new instance of this class can be obtained by calling the CreateSectionProperties method.
Exceptions
ExceptionDescription
WordDocumentWriterExceptionThrown if no document is currently open, or if a paragraph is currently open.
Remarks

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.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, 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

See Also