Share via


DocumentBase.Sections Property

Gets a Sections collection that represents the sections in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Sections As Sections
public Sections Sections { get; }

Property Value

Type: Sections
A Sections collection that represents the sections in the document.

Examples

The following code example adds text to the first paragraph in the document and then adds a new section before the text. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentSections()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is sample text." 
    Dim Range As Object = Me.Paragraphs(1).Range

    Me.Sections.Add(Range)
End Sub
private void DocumentSections()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    object Range = this.Paragraphs[1].Range;

    this.Sections.Add(ref Range, ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace