Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
    Overview
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
   [Expand]Visual Elements
   [Collapse]Examples
    [Expand]Files
    [Expand]Text
    [Expand]Formatting
    [Expand]Styles
    [Expand]Lists
    [Expand]Pictures
    [Expand]Text Boxes
    [Expand]Tables
    [Expand]Layout
    [Expand]Automation
    [Expand]Search and Replace
    [Expand]Mail Merge
    [Expand]Spell Check
    [Expand]Export-Import
    [Expand]Printing
    [Expand]Protection
    [Expand]User Interface Customization
    [Collapse]Miscellaneous
      How to: Insert Bookmark or Hyperlink
      How to: Create, Edit and Delete Comments
      How to: Specify Document Properties
      How to: Create and Modify Header
    [Expand]Commands
   [Expand]Member Tables
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Create, Edit and Delete Comments

The following example illustrates how to add, edit and delete comments in the current document.

All the document comments are contained in the collection represented by the CommentCollection interface. The collection can be accessed through the SubDocument.Comments property.

Expanded Add a comment

  • To create a comment, use CommentCollection.Create method. It allows you to create a comment with the specified settings, such as author or creation date.

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

  • To create a nested comment, use the CommentCollection.Create method with the parent comment set as an argument.

  • Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

Expanded Edit a comment

To edit the comment content, use the Comment.BeginUpdate and Comment.EndUpdate paired methods. You can add any text and insert additional objects to the comment, as illustrated below.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

You can also change the comment settings by changing the corresponding Comment object properties. All the operation should be enclosed with Comment.BeginUpdate and Comment.EndUpdate paired methods as well.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

Expanded Delete a comment

To delete a comment from the document, delete it from the corresponding collection. To do that, use the CommentCollection.Remove method.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

How would you rate this topic?​​​​​​​