Blog author: Lacy
| Posted on: 5/29/2012 | Category: C# Blogs
| Views: 1061 | Status: [Member]
| Points: 75
| Alert Moderator
Excel comment is for people to make notes about additional data information and commonly is used to remind the author to modify data values. Thus, the comment becomes superfluous when the author already altered cells information. And sometimes when things vary again before the author modifies the information, we have to change the comment in time. In such cases, people need to remove and change the excel comment in a quick way.
Spire.XLS enables people not only to add comment but also to remove and change them with C#, VB.NET in an easy way. Below I will share with you how to remove and change Excel comment with C#, VB.NET.
How to remove and change Excel comment information with C#, VB.NET
Using Spire.XLS, you only need four simple steps to realize these two functions. Please see the procedure.Step1. Create a new project.1. Create a new project in Visual Studio, and set the Target framework to be .NET Framework 4 in Properties.2. Add Spire.XLS DLL as reference in Project.3. Add below using at the top of the method.C#
Step2. Load an Excel file from the system.
Workbook workbook = new Workbook();VB.NET Code:
Dim workbook As New Workbook()
Step3. Remove and change the comment.
1. 1. Remove excel comment
Please note: Comment  means
the second comment you insert, not the first. For example, I insert
comment in A8
the second comment in A5.
the comment in A8.
the comment in A5.
2. 2. Change excel comment
change the comment by setting the "Comment0.Text "value in the below code.
comment0 = workbook.Worksheets.Comments;
Comment0.Text = "xxx";
Remove and change comment information
//remove commentVB.NET Code:
ExcelComment comment0 = workbook.Worksheets.Comments;
Comment0.Text = "The Sales Manager is Stephenchy";
Dim comment0 As ExcelComment = workbook.Worksheets(0).Comments(0)
Comment0.Text = "The Sales Manager is Stephenchy"
Step4. Save and launch the file.
//save and launch the fileVB.NET Code:
'save and launch the filePreview
Remove and Change Comment
IAccording to the excel comment marks, you can see that there are two comments in the first picture and the comment content in A8 can be seen clearly. While in the second picture, only one comment is left and comment in A8 has been changed.
Found interesting? Add this to: