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

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

HSSFComment aHSSFComment = aHSSFCell.getCellComment();
if(aHSSFComment != null) {
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();

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


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

HSSFRichTextString richString = new HSSFRichTextString( strNewCompleteComment );

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

comment.setAuthor("Apache POI");


// Assign the comment to the cell