DocumentBase.Sections Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a Sections collection that represents the sections in the document.
public:
property Microsoft::Office::Interop::Word::Sections ^ Sections { Microsoft::Office::Interop::Word::Sections ^ get(); };
public Microsoft.Office.Interop.Word.Sections Sections { get; }
member this.Sections : Microsoft.Office.Interop.Word.Sections
Public ReadOnly Property Sections As Sections
Property Value
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 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);
}
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