[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
   [Expand]Product Information
    Product Structure
    Getting Started
   [Collapse]Spreadsheet Document
     Cells and Cell Ranges
     Rows and Columns
     Shapes, Pictures, Charts
     Measure Units
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
   [Expand]Mail Merge Overview
    Find and Replace
   [Expand]Visual Elements
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [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]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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation


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 containing a comment has a red triangular indicator in the corner.

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.



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 the comment text with specific formatting. Currently, the SpreadsheetControl does not support text formatting for comments. However, you can use comment runs to change the text of the existing comments or add new text blocks to them.

All runs for an individual comment are stored in the CommentRunCollection accessible using 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 Range.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.



SpreadsheetCommentBehaviorOptions.Insert Gets or sets whether or not end-users are allowed to create new comments.
SpreadsheetCommentBehaviorOptions.Edit Gets or sets whether or not end-users are allowed to edit the existing comments.
SpreadsheetCommentBehaviorOptions.Delete Gets or sets whether or not end-users are allowed to delete comments.
SpreadsheetCommentBehaviorOptions.ShowHide Gets or sets whether end-users are allowed to display or hide comments.
SpreadsheetCommentBehaviorOptions.Resize Gets or sets whether or not end-users are allowed to change the size of the comment box.
SpreadsheetCommentBehaviorOptions.Move Gets or sets whether or not end-users are allowed to 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?​​​​​​​