CommentCollection.AddThreadedComment

AddThreadedComment(int, int, string, ThreadedCommentAuthor)

Adds a threaded comment.

public int AddThreadedComment(int row, int column, string text, ThreadedCommentAuthor author)
ParameterTypeDescription
rowInt32Cell row index.
columnInt32Cell column index.
textStringThe text of the comment
authorThreadedCommentAuthorThe user of this threaded comment.

Return Value

ThreadedComment object index.

Examples

using System;
using Aspose.Cells;

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

            CommentCollection comments = worksheet.Comments;
            
            int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add("Demo Author", "demoUser", "testProvider");
            ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
            
            comments.AddThreadedComment(1, 1, "This is a threaded comment demo.", author);
            
            var threadedComments = comments.GetThreadedComments(1, 1);
            foreach (var comment in threadedComments)
            {
                Console.WriteLine(comment.Notes);
            }

            workbook.Save("ThreadedCommentDemo.xlsx");
        }
    }
}

See Also


AddThreadedComment(string, string, ThreadedCommentAuthor)

Adds a threaded comment.

public int AddThreadedComment(string cellName, string text, ThreadedCommentAuthor author)
ParameterTypeDescription
cellNameStringThe name of the cell.
textStringThe text of the comment
authorThreadedCommentAuthorThe user of this threaded comment.

Return Value

ThreadedComment object index.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CommentCollectionMethodAddThreadedCommentWithStringStringThreadedCommentDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add("John Doe", "JD", "");
            ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
            
            CommentCollection comments = worksheet.Comments;
            comments.AddThreadedComment("B3", "Initial comment text", author);
            comments.AddThreadedComment("C5", "Follow-up comment", author);
            
            workbook.Save("ThreadedCommentsOutput.xlsx");
        }
    }
}

See Also