Class ThreadedCommentCollection

ThreadedCommentCollection class

Represents the list of threaded comments.

public class ThreadedCommentCollection : CollectionBase<ThreadedComment>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets the threaded comment by the specific index.
Item { get; set; }

Methods

NameDescription
Add(string, ThreadedCommentAuthor)Adds a threaded comment;
BinarySearch(ThreadedComment)
BinarySearch(ThreadedComment, IComparer<ThreadedComment>)
BinarySearch(int, int, ThreadedComment, IComparer<ThreadedComment>)
Clear()
Contains(ThreadedComment)
CopyTo(ThreadedComment[])
CopyTo(ThreadedComment[], int)
CopyTo(int, ThreadedComment[], int, int)
Exists(Predicate<ThreadedComment>)
Find(Predicate<ThreadedComment>)
FindAll(Predicate<ThreadedComment>)
FindIndex(Predicate<ThreadedComment>)
FindIndex(int, Predicate<ThreadedComment>)
FindIndex(int, int, Predicate<ThreadedComment>)
FindLast(Predicate<ThreadedComment>)
FindLastIndex(Predicate<ThreadedComment>)
FindLastIndex(int, Predicate<ThreadedComment>)
FindLastIndex(int, int, Predicate<ThreadedComment>)
GetEnumerator()
IndexOf(ThreadedComment)
IndexOf(ThreadedComment, int)
IndexOf(ThreadedComment, int, int)
LastIndexOf(ThreadedComment)
LastIndexOf(ThreadedComment, int)
LastIndexOf(ThreadedComment, int, int)
RemoveAt(int)

Examples

using System;
using Aspose.Cells;

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

            CommentCollection comments = worksheet.Comments;

            // Add threaded comments
            int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add("Demo Author", "demo_user", "demo_provider");
            ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
            
            comments.AddThreadedComment(0, 0, "First threaded comment", author);
            comments.AddThreadedComment(0, 0, "Reply to first comment", author);

            // Get threaded comments
            var threadedComments = comments.GetThreadedComments(0, 0);
            Console.WriteLine("Threaded comments in cell A1:");
            foreach (var comment in threadedComments)
            {
                Console.WriteLine($"- {comment.Notes} (by {comment.Author.Name})");
            }

            // Save the workbook
            workbook.Save("ThreadedCommentsDemo.xlsx");
        }
    }
}

See Also