Skip to main content

Comment Interface

A comment in the document - a text note that is attached to a DocumentRange.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

Declaration

[ComVisible(true)]
public interface Comment

Remarks

Comments are contained in the CommentCollection, which is accessed by the SubDocument.Comments property.

Use the CommentCollection.Create to create a new comment with the specified settings.

Note

When the user adds a comment from the User Interface, the comment’s author is obtained from the CommentOptions.Author property.

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