This basic tutorial will teach you the details about how to delete comment in Excel using C#. It explains the step-by-step procedure and runnable code snippet to remove comments from Excel using C#. For achieving such requirements, quickly load the input file, get access to the comments collection of the target cell, remove the comment, and export the output file in XLSX, or XLS format.
Steps to Delete Comment in Excel using C#
- Configure Aspose.Cells library using the NuGet package manager for deleting comments in Excel
- Create a Workbook class object
- Access a Worksheet using its index
- Remove the comment from the comments collection in a cell
- Save the output Excel file
These quick steps show the simple process to delete comments in Excel using C#. First, access the input Excel file and a worksheet by using its index. In the next step, access the Comments collection, delete the target comment by providing its index in the collection, and save the updated Excel file on the specified path.
Code to Delete Comment in Excel using C#
This code sample is the simple use case for how to remove pop up comments in Excel using C#. In addition to this approach, we can delete all of the comments in the Excel worksheet with a single API call. Similarly, you can remove each comment by mentioning the cell name, row, and column indexes as per your convenience.
This precise tutorial has covered the process to remove comments from a cell in a spreadsheet. If you want to insert comments in Excel, refer to the article on how to insert comments in Excel using C#.