Document.Comments 属性 (2007 system)

更新:2007 年 11 月

获取一个 Comments 集合,该集合表示文档中的所有注释。

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

语法

声明
<BrowsableAttribute(False)> _
Public ReadOnly Property Comments As Comments
用法
Dim instance As Document
Dim value As Comments

value = instance.Comments
[BrowsableAttribute(false)]
public Comments Comments { get; }

属性值

类型:Microsoft.Office.Interop.Word.Comments

一个 Comments 集合,表示文档中的所有注释。

示例

下面的代码示例向第一个段落添加文本,然后向该段落中的第二个单词添加注释。

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

Private Sub DocumentComments()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is sample Text"
    Dim commentText As Object = "This is comment text"
    Me.Comments.Add(Me.Paragraphs(1).Range.Words(2), commentText)
End Sub
private void DocumentComments()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is sample Text";
    object commentText = "This is comment text";
    this.Comments.Add(this.Paragraphs[1].Range.Words[2], ref commentText);
}

权限

另请参见

参考

Document 类

Document 成员

Microsoft.Office.Tools.Word 命名空间