[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Collapse]Spreadsheet Document
    Workbook
    Worksheets
    Cells and Cell Ranges
    Rows and Columns
    Comments
    Measure Units
   Supported Formats
  [Expand]Cell Basics
  [Expand]Spreadsheet Formulas
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Shapes, Pictures, Charts
  [Expand]Mail Merge
  [Expand]Examples
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[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

A comment is a note that you attach to a cell, separate from other cell content. Comments can make a worksheet easier to understand by providing additional context for the data it contains.

The image below illustrates how a comment is displayed in Microsoft® Excel®.

A worksheet stores comments in the CommentCollection object that is accessed via the Worksheet.Comments property. The CommentCollection interface provides the basic methods to work with comments. For example, to add a comment to a cell, use the CommentCollection.Add method (see How To: Add a Comment To a Cell example). To delete an individual comment from the collection, use the CommentCollection.Remove or CommentCollection.RemoveAt method. To delete all comments from the worksheet, use CommentCollection.Clear method.

Each comment is represented by the Comment object, which 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 comment text regions, each of which has specific formatting.
Comment.Reference Returns an absolute reference to the commented cell.
Comment.Visible Specifies whether the comment should be displayed in a cell.

Expanded Comment Runs

Comment text is grouped into one or more runs. Each run is specified by the CommentRun object and defines a region of the comment text with its own set of font characteristics. Use the CommentRun.Text property to define the text region within a comment, to which you want to apply specific formatting (CommentRun.Font).

The comment runs are stored in the CommentRunCollection collection that is accessed via the Comment.Runs property.

When you create a new comment via the CommentCollection.Add method or set the Comment.Text of an existing comment, the CommentRunCollection collection includes a single run that holds the full text of the comment formatted with the default font. You can access this run object and change the font to be applied to the comment text.

The CommentRunCollection interface provides methods to operate with comment runs. To add a new comment run, use the CommentRunCollection.Add method (see How To: Add a Comment To a Cell example). To delete the specified comment run from the collection, use the CommentRunCollection.Remove or CommentRunCollection.RemoveAt method. To delete all text from the comment, use the CommentRunCollection.Clear method.

Expanded See Also

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