Bookmark.Sentences 属性

获取一个 Sentences 集合,该集合表示 Bookmark 控件中的所有句子。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)

语法

声明
ReadOnly Property Sentences As Sentences
    Get
Sentences Sentences { get; }

属性值

类型:Microsoft.Office.Interop.Word.Sentences
一个 Sentences 集合,表示 Bookmark 控件中的所有句子。

示例

下面的代码示例向文档中添加一个带有文本的 Bookmark 控件,然后选择该书签中的第一个句子。

此示例针对的是文档级自定义项。

Private Sub BookmarkSentences()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.Text = "This is the first sentence of bookmark text." _
        & " And this is the second sentence."
    Bookmark1.Sentences.First.Select()

End Sub
private void BookmarkSentences()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is the first sentence of bookmark text." +
        " And this is the second sentence.";
    bookmark1.Sentences.First.Select();
}

.NET Framework 安全性

请参见

参考

Bookmark 接口

Microsoft.Office.Tools.Word 命名空间