ThreadedCommentCollection.Add(CellRange, String, String) Method
Creates a new threaded comment.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v26.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| range | CellRange | A cell range to which a comment should be added. If you pass a cell range as the parameter, the comment is added to the top-left cell of this range. |
| authorName | String | The name of the comment author. |
| text | String | The text of the comment. |
Returns
| Type | Description |
|---|---|
| ThreadedComment | A threaded comment. |
Example
Call the ThreadedCommentCollection.Add method to add a threaded comment to a specific cell. If you pass a cell range as the method parameter, the comment is added to the top-left cell of this range.
You can pass a string or a ThreadedCommentAuthor instance to specify a comment author. The ThreadedCommentAuthor object allows you to specify login credentials that link the author to their identity provider (Windows Live ID, Office 365, and so on).
The following code snippet adds a comment to the G16 cell:
var workbook = new Workbook();
workbook.LoadDocument(@"C:\Docs\Comments.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
var comments = worksheet.ThreadedComments;
ThreadedComment threadedComment =
comments.Add(worksheet["G16"], "Sales Department",
"The discount was approved by the Sales Director at the meeting on November 5th.");
threadedComment.Resolved = true;
workbook.SaveDocument(@"C:\Docs\Comments_upd.xlsx");