Back to Devexpress

ThreadedCommentCollection.GetThreadedComments(CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-threadedcommentcollection-dot-getthreadedcomments-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest3.6 KB
Original Source

ThreadedCommentCollection.GetThreadedComments(CellRange) Method

Retrieves all comments applied to the specified cell range.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
IList<ThreadedComment> GetThreadedComments(
    CellRange range
)
vb
Function GetThreadedComments(
    range As CellRange
) As IList(Of ThreadedComment)

Parameters

NameTypeDescription
rangeCellRange

A cell range that contains comments that should be returned.

|

Returns

TypeDescription
IList<ThreadedComment>

A collection of threaded comments within the specified range of cells.

|

Remarks

The GetThreadedComments method returns all threaded comments contained in cell ranges that intersect the specified cell range. To check whether a comment is contained in the worksheet, use the ThreadedCommentCollection.Contains method.

Example

The code sample below obtains all comments added to the A1:G20 cell range:

csharp
using DevExpress.Spreadsheet;

var workbook = new Workbook();
workbook.LoadDocument(@"C:\Docs\Comments.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
var comments = worksheet.ThreadedComments.GetThreadedComments(worksheet["A1:G20"]);
vb
Imports DevExpress.Spreadsheet

Private workbook = New Workbook()
workbook.LoadDocument("C:\Docs\Comments.xlsx")
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim comments = worksheet.ThreadedComments.GetThreadedComments(worksheet("A1:G20"))

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetThreadedComments(CellRange) 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.

winforms-spreadsheetcontrol-api-part1/CS/SpreadsheetControl/SpreadsheetActions/CellActions.cs#L482

csharp
// Get the added comment and make it visible.
ThreadedComment commentE2 = worksheet.ThreadedComments.GetThreadedComments(worksheet["E2"])[0];

See Also

ThreadedCommentCollection Interface

ThreadedCommentCollection Members

DevExpress.Spreadsheet Namespace