DocumentBase.Paragraphs 属性

定义

获取一个 Paragraphs 集合,该集合表示文档中的所有段落。

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

属性值

Paragraphs

一个 Paragraphs 集合,表示文档中的所有段落。

示例

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

private void DocumentParagraphs()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is sample paragraph text.";
}
Private Sub DocumentParagraphs()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is sample paragraph text."
End Sub 

适用于