DocumentBase.Comments, propriété

Obtient une collection Comments qui représente tous les commentaires dans le document.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v4.0.Utilities (dans Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntaxe

'Déclaration
Public ReadOnly Property Comments As Comments
    Get
public Comments Comments { get; }

Valeur de propriété

Type : Microsoft.Office.Interop.Word.Comments
Collection Comments qui représente tous les commentaires dans le document.

Exemples

L'exemple de code suivant ajoute du texte dans le premier paragraphe, puis ajoute un commentaire au deuxième mot du paragraphe. Pour utiliser cet exemple, exécutez-le à partir de la classe ThisDocument dans un projet au niveau du document.

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

Sécurité .NET Framework

Voir aussi

Référence

DocumentBase Classe

Microsoft.Office.Tools.Word, espace de noms