DocumentBase.Sections Eigenschaft

Definition

Ruft eine Sections-Auflistung ab, die die Abschnitte im Dokument darstellt.

public Microsoft.Office.Interop.Word.Sections Sections { get; }

Eigenschaftswert

Sections

Eine Sections-Auflistung, die die Abschnitte im Dokument darstellt.

Beispiele

Im folgenden Codebeispiel wird dem ersten Absatz im Dokument Text hinzugefügt, und anschließend wird ein neuer Abschnitt vor dem Text hinzugefügt. Um dieses Beispiel zu verwenden, führen Sie es von der- ThisDocument Klasse in einem Projekt auf Dokument Ebene aus.

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 

Gilt für