Freigeben über


DocumentBase.Comments-Eigenschaft

Ruft eine Comments-Auflistung ab, die alle Kommentare im Dokument darstellt.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Comments As Comments
public Comments Comments { get; }

Eigenschaftswert

Typ: Microsoft.Office.Interop.Word.Comments
Eine Comments-Auflistung, die alle Kommentare im Dokument darstellt.

Beispiele

Im folgenden Codebeispiel wird dem ersten Absatz Text hinzugefügt, und anschließend wird dem zweiten Wort im Absatz ein Kommentar hinzugefügt. Wenn Sie dieses Beispiel verwenden möchten, führen Sie es von der ThisDocument-Klasse in einem Projekt auf Dokumentebene aus.

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

.NET Framework-Sicherheit

Siehe auch

Referenz

DocumentBase Klasse

Microsoft.Office.Tools.Word-Namespace