DocumentBase.Sections 属性

定义

获取一个 Sections 集合,该集合表示文档中的节。

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

属性值

Sections

一个 Sections 集合,表示文档中的节。

示例

下面的代码示例将文本添加到文档中的第一个段落,然后在文本之前添加一个新节。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

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 

适用于