Condividi tramite


DocumentBase.Comments Property

Definition

Gets a Comments collection that represents all the comments in the document.

public:
 property Microsoft::Office::Interop::Word::Comments ^ Comments { Microsoft::Office::Interop::Word::Comments ^ get(); };
public Microsoft.Office.Interop.Word.Comments Comments { get; }
member this.Comments : Microsoft.Office.Interop.Word.Comments
Public ReadOnly Property Comments As Comments

Property Value

A Comments collection that represents all the comments in the document.

Examples

The following code example adds text to the first paragraph and then adds a comment to the second word in the paragraph. To use this example, run it from the ThisDocument class in a document-level project.

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);
}
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

Applies to