Free Support Forum - aspose.com

Cannot read comments from an Excel spreadsheet

I have created an Excel spreadsheet using Aspose Cells. I used the example code to add a cell comment. This worked as expected. I now need to read the Excel spreadsheet and retrieve those cell comments. I cannot get this to work.

This is the code I am using:

private string GetComment(Worksheet worksheet, int row, int col)
{
Comment comment = worksheet.Comments[row, col];
if (comment != null) return comment.Note;

return string.Empty;
}



I have attached the Excel spreadsheet I am trying to retrieve the cell comments from.

The comment is located on the first tab (named “Operating”) in cell J10.

Hi,


Could you attach your template file (having the comments) here, we will check/evaluate your issue soon.

Moreover, Please also tryAspose.Cells for .NET (Latest Version) .
Thank you.

I attached the Excel spreadsheet containing the comment to my previous message.

Hi,


It works absolutely fine with Aspose.Cells for .NET (Latest Version)
I have tested with the following code using your template file.
Sample code:
Workbook wb = new Workbook(“e:\test2\ExportData.xls”);
//Retrieving comments from the first worksheet
CommentCollection comments = wb.Worksheets[0].Comments;
Comment comment = comments[9,9]; //From J10
string text = comment.Note;
MessageBox.Show(text);//Gives the comments note - OK

Make sure that you are retrieving the comment with the correct cell reference i.e. Row:9, Column:9 —> J10
Also make sure that you are using the version v6.0.1.5.


Thank you.