Actually, the steps is similar the method to read hyperlink, which I have shared in my blog. Firstly, create a new Project named ReadComment.
Second, add dll file of one C# .NET Excel component, Spire.XLS for .NET, which is used to read comments with C# more quickly, as reference.
Thirdly, design form to display comments.
- Create a form named ReadComment.
- Add a label on the top of form as a title to show which function we will realize.
- Add another two labels, Regular Comment and Rich Text Comment.
- Add a textbox following regular comment and a richtextbox following Rich Text Comment.
- Add a button to run code.
Then, the form has been completed.
Now, read the comments in customer.xlsx. Get comment range by using sheet.Range and read to text box with textBox.Text and richTextBox.Rtf.
public partial class Form1 : Form
private void button1_Click(object sender, EventArgs e)
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets;
textBox1.Text = sheet.Range[“A3”].Comment.Text;
richTextBox1.Rtf = sheet.Range[“A6”].Comment.RichText.RtfText;