You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/08/14 09:21:06 UTC

[Bug 56852] New: add the comment large than 1024, the excel will only display the last 1024 comments

https://issues.apache.org/bugzilla/show_bug.cgi?id=56852

            Bug ID: 56852
           Summary: add the comment large than 1024, the excel will only
                    display the last 1024 comments
           Product: POI
           Version: 3.10-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: silencon@gmail.com

hello,

Our project will need to import the excel for some data init. cell will be
added the comment about the reasons of error, so there may be add more than
1024 comments, but will only display the last 1024.

e.g.
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("mysheet");
HSSFPatriarch p = null;
final Map<HSSFSheet, HSSFPatriarch> drawings = new HashMap<HSSFSheet,
HSSFPatriarch>();
if(drawings.containsKey(sheet)) {
  p = drawings.get(sheet);
} else {
  p = sheet.createDrawingPatriarch();
}
for (int i = 0; i < 2000; i++) {
  HSSFCell cell = sheet.createRow(i).createCell(1);
  cell.setCellValue(new HSSFRichTextString("comment" + i));
  HSSFAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) 1, i, (short) 3,
i + 3);
  HSSFComment comment = p.createComment(anchor);
  comment.setAuthor("fzb");
  comment.setString(new HSSFRichTextString("add the comment" + i +
"success!"));
  cell.setCellComment(comment);
}

FileOutputStream out = new FileOutputStream("writerPostil.xls");
wb.write(out);

Regards

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 56852] add the comment large than 1024, the excel will only display the last 1024 comments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56852

--- Comment #3 from zhibin fang <si...@gmail.com> ---
(In reply to Darren Roberts from comment #2)
> Would you mind creating a patch or sharing how you fixed the problem please? 
> 
> This issue has come up a few times and since I also need more than 1024
> comments in my project it would be good for it to be fixed once and for all.

the class HSSFShape HSSFShapeGroup HSSFComment will set the shape id through
the setSharpId method, the setSharpId value is sharpId % 1024, this is the
problem.
HSSFPatriarch's createCellComment method will call the class EscherAggregate's
addTailRecord method finally.
the addTailRecord is:
tailRec.put(note.getShapeId(), note);
the tailRec is the LinkedHashMap<Integer, NoteRecord> object.

the type of map key is Integer. the key's value is note.getShapeId().

the key --> sharpId % 1024 --> the value of key will be repeated.

the size of the tailRec is 1024 forever.

this is the point of the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 56852] add the comment large than 1024, the excel will only display the last 1024 comments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56852

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 56852] add the comment large than 1024, the excel will only display the last 1024 comments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56852

zhibin fang <si...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from zhibin fang <si...@gmail.com> ---
i fixed this problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 56852] add the comment large than 1024, the excel will only display the last 1024 comments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56852

--- Comment #2 from Darren Roberts <ro...@yahoo.com> ---
Would you mind creating a patch or sharing how you fixed the problem please? 

This issue has come up a few times and since I also need more than 1024
comments in my project it would be good for it to be fixed once and for all.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org