[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [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]Gantt Control
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [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
      Paragraphs
      Sections
      Lists
      Inline Pictures
      Shapes
      Text Boxes
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Comments
      Checkboxes
      Document Properties
     Measure Units
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Hyphenation
    Spell Checking
    AutoCorrect Feature
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Services
    Events
    Commands
    Keyboard Shortcuts
    HTML Tag Support
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Comments

The RichEditControl allows you to add comments to documents. You can add, edit, and remove comments in code and from the UI.

Expanded Create a Comment

Use the following API to attach a comment to a document range:

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

The code snippet belows creates an empty comment associated with the following phrase: "an extensive problem in hardware and architecture is the construction of the emulation of checksums".

Note

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, pass the parent content as the CommentCollection.Create method's parameter.

Note

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

Expanded Edit the Comment

Edit the Comment Content

Use the API from the table below to edit the comment's content.

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

The following code sample adds text to the empty comment:

Note

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

Edit the Comment Attributes

Use the following members to change the comment parameters (author, date, etc.):

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

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

Note

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

Expanded Delete the Comment

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

Expanded Comments in the User Interface

Users can use the Review Ribbon tab to insert, modify or remove comments. Refer to the How to: Create the RichEditControl with a Ribbon UI topic for more information on how to add the ribbon menu to the application.

The Comment group on the Review tab allows users to insert new comments, remove existing comments, and navigate through all the comments in the document.

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

To add the Reviewing Pane to the RichEditControl, click the RichEditControl's smart tag in the designer mode and select Create Reviewing Pane.

Tip

Set the RichEditControl's DocumentCapabilitiesOptions.Comments property to Disabled to disable comments.

Display Options

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

Use the CommentOptions's class properties to change the comment displaying options, such as range highlighting color or comment visibility. Access these properties via the richEditControl.Options.Annotations.Comments notation.

Note

When you add a new comment, the CommentOptions.Visibility property set to Hidden changes its value to Visible.

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