Skip to end of metadata
Go to start of metadata
A Section object represents a major section in a document, like a chapter in a book. Many documents will only contain one section. In more complex documents, content can be divided into multiple sections.

 

You can assign a different set of formatting settings to each section, including:

  • Margins
  • Paper size or orientation
  • Paper source for a printer
  • Page borders
  • Vertical alignment
  • Headers and footers
  • Columns
  • Page numbering
  • Line numbering
  • Footnotes and endnotes

To add a section to your document, use one of the following methods. The methods insert a section at the beginning or end an Element. An Element object represents an editable region in a document, such as a section or a paragraph. The document itself is an Element.

  • Inserts an empty section at the end of the specified Element.

  • Inserts an empty section at the beginning of the specified Element.

Before adding a section to your file, create a Document object.

Call Document.CreateSectionAfter or Document.CreateSectionBefore to add a section to the document

Next, set Section properties, for example:

After creating a Section and setting Section properties, add content. For example, add a paragraph:

You can access existing sections through the Document.Sections property.

  • No labels