Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-kb/b40a5bedc09f3590bc151498554e51f3 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/b40a5bedc09f3590bc151498554e51f3 to your computer and use it in GitHub Desktop.
Code to Delete Comment in Excel using C#. For further details: https://kb.aspose.com/cells/net/how-to-delete-comment-in-excel-using-csharp/
namespace AsposeProjects
{
class Program
{
static void Main(string[] args) // Main function to remove comments from an Excel file
{
// Load license
Aspose.Cells.License lic = new Aspose.Cells.License();
lic.SetLicense(@"Aspose.Total.lic");
// Open the excel file
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook("InputWithComments.xlsx");
// Access any worksheet of the workbook
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
// Remove a specific comment from a cell
worksheet.Comments.RemoveAt("A3");
// Remove all the comments of a worksheet at once
// worksheet.ClearComments();
//Save As the excel file.
workbook.Save("output.xlsx");
System.Console.WriteLine("Done");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment