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


Yegor Kozlov <[EMAIL PROTECTED]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #9 from Yegor Kozlov <[EMAIL PROTECTED]>  2008-03-28 05:00:34 PST 
---
Hi,

(1) A comment can be assigned to only one cell. If you assign the same comment
object to multiple cells then only the last cell will have it. 
(2) HSSFPatriarch is a sheet-scope object, not comment-scope. Move it out of
the loop and all will be fine:

HSSFPatriarch patr = finalsheet.createDrawingPatriarch();
for(int i=0;i<3;i++)
{
  HSSFCell cell1=finalsheet.createRow(2).createCell((short) i);
  HSSFComment comment1 = patr.createComment(new HSSFClientAnchor(0, 100, 0, 0,
(short)4, 2, (short) 6, 5));
}

I updated the docs to state it.

(3) In the forth example you don't set comment text for comment2 and comment3.
Excel doesn't like it and says the file is corrupted.

Check the code:

 HSSFPatriarch patr = finalsheet.createDrawingPatriarch();
 HSSFComment comment1 = patr.createComment(new HSSFClientAnchor(0, 100, 0, 0,
(short)4, 2, (short) 6, 5));
 comment1.setString(new HSSFRichTextString("help me 1"));
 HSSFComment comment2 = patr.createComment(new HSSFClientAnchor(0, 100, 0, 0,
(short)4, 2, (short) 6, 5));
 //should it be comment2 
 comment1.setString(new HSSFRichTextString("help me 2"));

 HSSFComment comment3 = patr.createComment(new HSSFClientAnchor(0, 100, 0, 0,
(short)4, 2, (short) 6, 5));
 //should it be comment3 
 comment1.setString(new HSSFRichTextString("help me 3"));

 cell1.setCellComment(comment1);
 cell2.setCellComment(comment2);
 cell3.setCellComment(comment3);

It looks like a copy/paste bug. 

(4) Your problem has nothing to do with serialization. It doesn't matter if you
write directly to FileOutputStream or serialize in a byte buffer and then to a
file. 

Regards,
Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to