Adding comments to already commented file

Sep 13, 2011 at 1:38 AM
Edited Sep 13, 2011 at 1:41 AM

 

Hello All:

I am trying to open an existing excel file and adding comments to a certain cell using HSSFComment object. It works fine and I was able to successfully add the comments to a cell but it loses all the existing comments that file had before. Also when I open the file in excel I get an error: File Error: Data may have been lost.

I am using NPOI (.NET) and my code is in C#.

I am trying this for last few days and I am out of ideas now, not sure what am I doing wrong.

ANy help is appreciated.

Thanks

Coordinator
Sep 24, 2011 at 7:32 AM

Which version of NPOI are you using?

Nov 28, 2011 at 10:50 AM

I've seen the "issue" too, with the same error message.

But you should probably  (1)extract the existing comment, and (2) append text to it, (3) create a single comment, instead of trying to add multiple comments on the same cell.

 

(Then it seems comments are always visible, which is a huge problem for sheets with many comments; only workaround I've found: use a template with a macro to hide comments... )

Jan 14, 2012 at 8:53 PM

This issue exists in 1.2.4 as well as the latest trunk.  If you add fewer comments than already exist in a file you'll get a large corrupt file dialog from Excel 2007.

@NNM - I fixed the always visible comment issue. Let me know if you want the fix and I'll post it.