CommentCollection.GetThreadedComments

GetThreadedComments(int, int)

Gets the threaded comments by row and column index.

public ThreadedCommentCollection GetThreadedComments(int row, int column)
ParameterTypeDescription
rowInt32The row index.
columnInt32The column index.

Examples


[C#]
ThreadedCommentCollection threadedComments1 = comments.GetThreadedComments(1, 1);
for (int i = 0; i < threadedComments1.Count; ++i)
{
    ThreadedComment tc = threadedComments1[i];
    string note = tc.Notes;
}

See Also


GetThreadedComments(string)

Gets the threaded comments by cell name.

public ThreadedCommentCollection GetThreadedComments(string cellName)
ParameterTypeDescription
cellNameStringThe name of the cell.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CommentCollectionMethodGetThreadedCommentsWithStringDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add a threaded comment author and get the author by index
            int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add("John Doe", "JD", "1");
            ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];

            // Add a threaded comment to cell B2
            worksheet.Comments.AddThreadedComment("B2", "Initial comment", author);

            // Get all threaded comments for cell B2
            ThreadedCommentCollection threadedComments = worksheet.Comments.GetThreadedComments("B2");

            // Display the threaded comments
            foreach (ThreadedComment comment in threadedComments)
            {
                Console.WriteLine($"Comment by {comment.Author.Name}: {comment.Notes}");
            }
        }
    }
}

See Also