This project is read-only.

Cell Comments appears to corrupt xls file after creating/adding over 1405

Mar 12, 2013 at 1:34 PM
Is there a max number of comments NPIO will support, have created sheets with 32377 comments, but crashes excel on a save. Filtered down the comments, and at 1405 comments added, the file will save, at 1406 comments added, file crashes excel. Comments are over several sheets in the workbook.

The code (cut down)
HSSFPatriarch patr = (HSSFPatriarch)excelSheet.CreateDrawingPatriarch();
//error is class holding position of cell and text
IComment comment = patr.CreateCellComment(new HSSFClientAnchor(0, 0, 0, 0, error.Column, error.Row, error.Column + 3, error.Row + 3));
comment.String = new HSSFRichTextString(error.ErrorDescription);
comment.Author = "XXX";
excelCell.CellComment = comment; //excelCell is ICell
Mar 12, 2013 at 9:45 PM
To be honest, you are the first one to ask the maximum comment a xls supports. This is never tested. Can you tell me why there are so many comments in your Excel file?

Maybe we can work around it by some business requirement change.
Mar 13, 2013 at 10:50 AM
The 1406 appears to be a red herring have created and save files with 1273 and 26397 commands. This appears to be a hard bug to tack down to a single create call as the call will work if comments calls before it are disabled.
In answer to your question we are extracting date from an ifc (CAD file) and creating a COBie spread sheet. COBie is a requirement for the construction industry and is a standard templated excel workbook. The comments are indicators to the user that the information (extracted from the ifc file) in a cell is incorrectly formatted, wrong type, not a reference to another sheet etc. Excel appears to have no problem with the comments once the file is recovered or save as an xlsx format.
Have limited comments to 1000 per sheet and the file saves ok once opened in excel but craches with 1050. Don’t think this is the real problem as I have other files that save in excel with over 1050 comments per sheet.