This project has moved and is read-only. For the latest updates, please go here.

Add Comment

Dec 4, 2010 at 12:35 PM

Hi all

I am using this package for reading and writing excel files. I can not add comment to a cell with this package. AddComment method work without error but when open excel file, MS Excel return an error and do not show comment.

This is my code :





if (xlPackage.Workbook.Worksheets[SheetIndex].Cells[Row, Col].Comment == null)

         xlPackage.Workbook.Worksheets[SheetIndex].Comments.Add(xlPackage.Workbook.Worksheets[SheetIndex].Cells[Row, Col], value, "");


        xlPackage.Workbook.Worksheets[SheetIndex].Cells[Row, Col].Comment.Text = value;


Dec 4, 2010 at 1:56 PM

I dont know why....maybe Jan can tell us but author name cannot be null or blank. Change "" for any value.

Dec 5, 2010 at 5:47 AM

Thanks mrxrsd. It is work with change author from "" to a value.

Dec 5, 2010 at 11:03 AM

The author is a required value in the XML-schema. Obviously I should throw an exception if the value is empty. I'll add fix for that next time I check in some code.