Free Support Forum - aspose.com

Remove comments

How i can delete all comments in a Worksheet.

Thank you

Please check Worksheet.ClearComments method.

@npepin,
Aspose.Cells has replaced Aspose.Excel which is no more under active development now. Aspose.Cells contains all the features available in its predecessor along with the support for the latest features in different versions of MS Excel. You can manage the Notes available in older versions of Excel as well as Threaded comments available in the latest versions of MS Excel. Following sample codes demonstrate these features:

Example to add/delete note

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Adding a new worksheet to the Workbook object
int sheetIndex = workbook.Worksheets.Add();

// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];

// Adding a comment to "F5" cell
int commentIndex = worksheet.Comments.Add("F5");

// Accessing the newly added comment
Comment comment = worksheet.Comments[commentIndex];

// Setting the comment note
comment.Note = "Hello Aspose!";
worksheet.Comments.RemoveAt(0);

// Saving the Excel file
workbook.Save("book1.out.xls");

Example to remove threaded comments

Workbook workbook = new Workbook(sourceDir + "ThreadedCommentsSample.xlsx");

//Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
CommentCollection comments = worksheet.Comments;

// Get Author of first comment in A1
ThreadedCommentAuthor author = worksheet.Comments.GetThreadedComments("A1")[0].Author;

// Remove Comments
comments.RemoveAt("A1");
ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;

// Remove Author of first comment in A1
authors.RemoveAt(authors.IndexOf(author));

workbook.Save(outDir + "ThreadedCommentsSample_Out.xlsx");

Following articles contain more information about these features:
Managing Comments
Threaded Comments

Have a free trial version of this product here:
Aspose.Cells for .NET (Latest Version)

A detailed solution is available here which can be used for testing different features of this product.