Last active
July 2, 2022 03:58
-
-
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/
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
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