Skip to main content
All docs
V24.1
Row

ThreadedCommentCollection.Add(CellRange, String, String) Method

Creates a new threaded comment.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

ThreadedComment Add(
    CellRange range,
    string authorName,
    string text
)

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 code sample below 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");

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(CellRange, String, String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also