[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Range Permissions
      Numbered and Bulleted Lists
      Text Boxes
      Document Properties
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Spell Checking
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
   [Expand]Visual Elements
    Keyboard Shortcuts
    HTML Tag Support
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)


The following topic describes how RichEditControl supports using comments in the document.

Expanded Manage Comments Manually

Create a Comment

To create a comment to the document range, use the following API.

Member Description
Paragraph.Range Retireves a range the given paragraph occupies.
SubDocument.FindAll Finds all document ranges that contain the given expression or text string.
SubDocument.Comments Provides access to the document's collection of Comment instances.
CommentCollection.Create Creates a new item in the CommentCollection.

The code snippet belows creates an empty comment associated with the specific phrase within the document.


A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988

Create a Nested Comment

The code snippet below demonstrates how to create a nested comment. To do that, use the CommentCollection.Create method with the passed parent comment.


A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988

Edit the Comment

Edit the Comment Content

To accomplish this task, use the API from the table below.

Member Description
Comment.BeginUpdate Opens the given comment for modification.
SubDocument.InsertText Inserts a text string to the specified position.
TableCollection.Create Inserts a table to the specified position within the document.
ShapeCollection.InsertPicture Inserts a floating picture to a given document position.
DocumentImageCollection.Insert Inserts an inline image to the specified position.
ShapeCollection.InsertTextBox Inserts a text box to the given position.
Comment.EndUpdate Finalizes the comment update.

The following code sample adds text to the empty comment created earlier.


A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988

Edit the Comment Attributes

To change the comment parameters (author, date, etc.), use the following members.

Member Description
Comment.BeginUpdate Enables the comment modification.
Comment.Author Specifies the comment's author.
Comment.Date Specifies the comment's last modified date.
Comment.Name Specifies the comment name.
Comment.EndUpdate Finalizes the comment update.

The code snippet below changes the comment's name, date and the author.


A complete sample project is available at https://github.com/DevExpress-Examples/comments-simple-example-t474988

Delete the Comment

To remove a specific comment from the document, use the CommentCollection.Remove method as shown in the code snippet below.

Expanded Operate Comments in the User Interface

Display Options

The comments are displayed in the Reviewing Pane or in balloons that appear in the document margins. The corresponding ranges are highlighted by a distinct color for each reviewer.

To change the comment displaying options, such as range highlighting color or comment visibility, use the CommentOptions's class properties.


The CommentOptions.Visibility property set to Hidden changes its value to Visible after adding a new comment.

Comments Functionality in the Command UI

End-users can insert, modify or remove the desired comment using the Review Ribbon tab. To learn how to provide the application with the ribbon menu, refer to the How to: Create the RichEditControl with a Ribbon UI topic.

The Comment group on the Review tab allows end-users to insert new comments, remove existing one(s) and navigate through all the comments in the document.

The Tracking group buttons allow end-users to highlight comments in the document, to filter them by the author, to specify whether to display the comments in the document margins or show the Reviewing Pane.

To provide the application with the Reviewing Pane, in the designer mode, click the RichEditControl's smart tag and select Create Reviewing Pane.


Adding new comments to the document can be forbidden. To do that, set the RichEditControl's DocumentCapabilitiesOptions.Comments property to Disabled.

Is this topic helpful?​​​​​​​