Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active February 15, 2026 06:05
Show Gist options
  • Select an option

  • Save aspose-com-kb/b9947617d3b6e683b8b8de41acb43045 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-kb/b9947617d3b6e683b8b8de41acb43045 to your computer and use it in GitHub Desktop.
Add Threaded Comments in Excel using C#. For detials: https://kb.aspose.com/cells/net/add-threaded-comments-in-excel-using-csharp/
using System;
using Aspose.Cells;
namespace ThreadedCommentsDemo
{
class Program
{
static void Main()
{
// Apply Aspose.Cells license
License license = new License();
license.SetLicense("license.lic");
// Create a workbook and get the first worksheet
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Add a value to cell A1
sheet.Cells["A1"].PutValue("Hello");
// Create an author for threaded comments
int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add(
"Aspose Test", "", ""
);
ThreadedCommentAuthor author =
workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
// Add a threaded comment to cell A1
sheet.Comments.AddThreadedComment(
"A1", "Test Threaded Comment", author
);
// Save the Excel file
workbook.Save("AddThreadedComments_out.xlsx");
Console.WriteLine("Threaded comment added successfully.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment