Last active
February 15, 2026 06:05
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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