Hello,

I am writing a large excell file using java poi version 3.9
(the file has 3500 lines). I have a problems with writing excell comments.

I mean, if write just hundred excell lines, everythihg works fine.

If I write the "real" file, with thousands of lines, the program does not give any exception/error.
But when I open the excell file, many of the comments are missing.

It seems that comments are missing after a certain point, like POI (or excell ?) is not able to manage
a large number of comments.

Any suggestions ?

Here below is my source code.

thank you
Fabio






public static void appendComment(HSSFCell aHSSFCell, String strComment)
{
String strCurrentComment = "";
String strNewCompleteComment = "";

HSSFComment aHSSFComment = aHSSFCell.getCellComment();
if(aHSSFComment != null) {
aHSSFCell.removeCellComment();
HSSFRichTextString aHSSFRichTextString = aHSSFComment.getString();
if(aHSSFRichTextString != null) {
strCurrentComment = aHSSFRichTextString.getString().trim();
}
}


if(strCurrentComment.equals("") == true) {
strNewCompleteComment = strComment;
} else {
strNewCompleteComment = strCurrentComment + "\n" + strComment;
}




CreationHelper factory = aHSSFCell.getSheet().getWorkbook().getCreationHelp er();

// When the comment box is visible, have it show in a 1x3 space
ClientAnchor anchor = factory.createClientAnchor();
anchor.setCol1(aHSSFCell.getColumnIndex());
anchor.setCol2(aHSSFCell.getColumnIndex()+5);


Drawing drawing = aHSSFCell.getSheet().createDrawingPatriarch();

anchor.setRow1(aHSSFCell.getRow().getRowNum());
anchor.setRow2(aHSSFCell.getRow().getRowNum()+3);

// Create the comment and set the text+author
Comment comment = drawing.createCellComment(anchor);


HSSFRichTextString richString = new HSSFRichTextString( strNewCompleteComment );
//richString.

//RichTextString str = factory.createRichTextString("Hello, World!");
//str.getString()

comment.setString(richString);
comment.setAuthor("Apache POI");

//comment.getString()

// Assign the comment to the cell
aHSSFCell.setCellComment(comment);
}