[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Map Control
   [Expand]Product Information
    Product Structure
    Getting Started
   [Collapse]Spreadsheet Document
     Cells and Cell Ranges
     Rows and Columns
     Measure Units
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Tables
   [Expand]Charts and Graphics
   [Expand]Mail Merge
    Operation Restrictions
    Find and Replace
   [Expand]Visual Elements
   [Expand]Keyboard Shortcuts
  [Expand]Rich Text Editor
  [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 SpreadsheetControl allows you to attach notes to individual cells by using comments. Comments are extremely useful when you need to provide additional information, such as reminders, notifications, or feedback in a document without modifying cell content.

Comments are stored separately from a cell and displayed in a floating text box. A cell with a comment has a red triangular indicator in the corner. Handle the SpreadsheetControl.CustomDrawCommentIndicator event to customize an indicator's appearance.

Select the action you wish to perform.

Expanded Add a Comment

All comments embedded in a worksheet are stored in the comment collection (CommentCollection), which can be accessed by using the Worksheet.Comments property. The CommentCollection interface provides the basic methods to work with comments. Use the CommentCollection.Add method to attach a comment to a cell. For an example, refer to How to: Create, Edit and Copy Cell Comments.

An individual comment is represented by the Comment object and can be accessed by its index in the comment collection. The Comment object provides the following properties to specify a comment.

Property Description
Comment.Author Gets or sets the author of the comment.
Comment.Text Gets or sets the comment text.
Comment.Runs Provides access to the separate text regions of the comment.
Comment.Reference Gets an absolute reference to the commented cell.
Comment.Visible Specifies whether the comment should always be displayed in the UI.

Expanded Edit a Comment

Comment text consists of one or more comment runs. Each run is represented by the CommentRun object and defines a region of comment text with specific formatting.


At present, the SpreadsheetControl does not support rich text formatting for comments. You can, however, use comment runs to add new information to a comment or change the existing comment text.

All runs for an individual comment are stored in the CommentRunCollection accessible via the Comment.Runs property. After a comment is created, its text is defined by a single run contained in the collection. Use the collection's CommentRunCollection.Add and CommentRunCollection.Insert methods to add new text to the required comment. To edit the text of the existing comment run, get access to this run by its index in the collection and utilize the CommentRun.Text property. To replace the text of the entire comment, use the Comment.Text property.

For an example, refer to How to: Create, Edit and Copy Cell Comments.

Expanded Copy a Comment

To copy a comment to another cell, call the CellRange.CopyFrom method for the target cell into which you wish to insert the comment. Pass the PasteSpecial.Comments enumerator value as a parameter to copy the comment only and ignore cell content. The copied comment will replace any existing comment contained in the target cell. For an example, refer to How to: Create, Edit and Copy Cell Comments.

Expanded Delete Comments

To delete an individual comment from the collection, use the CommentCollection.Remove or CommentCollection.RemoveAt method. To remove comments from a specified range of cells, utilize the Worksheet.ClearComments method. To delete all comments from a worksheet, use the CommentCollection.Clear method. For an example, refer to How to: Clear Cells of Content, Formatting, Hyperlinks and Comments.

Expanded Manage Comments in the UI

End-users can insert, edit, hide or delete comments using one of the following ways.

  • Via the ribbon UI (by using the commands located in the Comments group of the Review tab)

  • Via the context menu

Moreover, end-users can resize a comment or move it to a new location by using the sizing handles (small rectangles at the corners and sides of the comment box) visible for a selected comment.

Expanded End-User Restrictions

To restrict end-user actions over comments, use the SpreadsheetBehaviorOptions.Comment property, which provides access to restriction settings. The table below lists possible restrictions you can set to prevent modifications of comments in the SpreadsheetControl UI.

Restriction Description
SpreadsheetCommentBehaviorOptions.Insert Gets or sets whether a user can create new comments.
SpreadsheetCommentBehaviorOptions.Edit Gets or sets whether a user can edit the existing comments.
SpreadsheetCommentBehaviorOptions.Delete Gets or sets whether a user can delete comments.
SpreadsheetCommentBehaviorOptions.ShowHide Gets or sets whether a user can display or hide comments.
SpreadsheetCommentBehaviorOptions.ShowOnHover Gets or sets whether to show comments when a user hovers over a cell with a comment indicator.
SpreadsheetCommentBehaviorOptions.Resize Gets or sets whether a user can change the size of the comment box.
SpreadsheetCommentBehaviorOptions.Move Gets or sets whether a user can move comments to a new location.

Set the required property to DocumentCapability.Disabled or DocumentCapability.Hidden to disable or hide the corresponding command in the ribbon UI and the context menu.

Expanded See Also

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