Skip to main content

DevExpress v25.1 Update — Your Feedback Matters

Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

CommentCollection Interface

A collection of Comment objects.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v25.1.Core.dll

NuGet Package: DevExpress.RichEdit.Core

#Declaration

[ComVisible(true)]
public interface CommentCollection :
    ReadOnlyCommentCollection,
    ISimpleCollection<Comment>,
    IEnumerable<Comment>,
    IEnumerable,
    ICollection

The following members return CommentCollection objects:

#Remarks

Items in the CommentCollection are ordered and indexed in the same order as the ranges to which they belong. That is, a comment whose Comment.Range is closer to the beginning of the document has a lower index value.

When you add a new comment, the CommentOptions.Visibility property is set to Visible.

#Example

Comment

View Example

using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraRichEdit;

static void CreateComment(RichEditDocumentServer wordProcessor) {

    // Load a document from a file.
    wordProcessor.LoadDocument("Documents\\Grimm.docx");

    // Access a document.
    Document document = wordProcessor.Document;

    if (document.Paragraphs.Count > 2) {
        // Access the range of the third paragraph.
        DocumentRange docRange = document.Paragraphs[2].Range;

        // Specify the comment's author name.
        string commentAuthor = "Johnson Alphonso D";

        // Create a comment.
        document.Comments.Create(docRange, commentAuthor, DateTime.Now);
    }
}
See Also