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 2016/04/28 18:03:05 UTC

[Bug 59393] New: IllegalArgumentException when set comment for Multiple cell included cell A1

https://bz.apache.org/bugzilla/show_bug.cgi?id=59393

            Bug ID: 59393
           Summary: IllegalArgumentException when set comment for Multiple
                    cell included cell A1
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: stone_me_06@163.com

when set comment for Multiple cell included cell "A1", always got a Exception:
java.lang.IllegalArgumentException: 
Multiple cell comments in one cell are not allowed, cell: A1

if don't set comment for cell "A1", Exception will not happen.

if only set comment for cell "A1", Exception will not happen.

-- 
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


Re: [Bug 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

Posted by Axel Howind <ax...@dua3.com>.
Sorry, it seems either Safari randomly changes IDs when editing a bug or something is wrong on the server side. I try to update a bug and instead another one gets changed. What a mess.

> Am 23.11.2023 um 12:40 schrieb bugzilla@apache.org:
> 
> https://bz.apache.org/bugzilla/show_bug.cgi?id=59393
> 
> Axel Howind <ax...@dua3.com> changed:
> 
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Severity|normal                      |enhancement
> 
> -- 
> 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
> 


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


[Bug 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

Axel Howind <ax...@dua3.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

--- Comment #3 from stone <st...@163.com> ---
(In reply to Dominik Stadler from comment #1)
> Can you share some of your code, ideally as self-sufficient unit-test that
> allows others to reproduce the problem? This will make it much easier for
> other to take a look.
> 
> If you are able we also gladly accept patch-submissions if you can figure
> out where it fails in Apache POI.

I made a test cases as (attachment 33825 ) to reproduce 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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

stone <st...@163.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
           Severity|normal                      |major

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

--- Comment #2 from stone <st...@163.com> ---
Created attachment 33825
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33825&action=edit
Code to reappear the bug.

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3
           Severity|major                       |normal

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

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

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

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Can you share some of your code, ideally as self-sufficient unit-test that
allows others to reproduce the problem? This will make it much easier for other
to take a look.

If you are able we also gladly accept patch-submissions if you can figure out
where it fails in Apache POI.

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

--- Comment #5 from Javen O'Neal <on...@apache.org> ---
Added disabled unit test in r1742868.

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

stone <st...@163.com> changed:

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

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

--- Comment #4 from Javen O'Neal <on...@apache.org> ---
This would require some restructuring of the way comments are added to a cell.

Right now the order to add a comment is: [1]
1. Create an anchor for the comment (that is, the box that displays the comment
with a yellow-background).
2. Create a comment on the sheet drawing patriarch and set the anchor from step
1
3. Add author and comment string to comment object
4. Assign the comment to a cell in the sheet (prior to this the comment is
parentless).

The problem occurs in step 2, since in order to create the comment, the comment
cell address is needed. The cell address is temporarily set as
CellAddress(anchor.getRow1(), anchor.getCol1()) until it's set again by step 4
above. [2]:
> return XSSFComment(comments, comments.newComment(ref), vmlShape);

The "Multiple cell comments in one cell are not allowed" error that you saw was
POI proactively avoiding a corrupt workbook. Though adding a cell comment to
the drawing without adding it to a cell also produces a corrupt workbook. Any
rewrite will need to address these issues, while considering backwards
compatibility, and hopefully make adding a cell comment easier (such as
Sheet.addCellComment(CellAddress address, String comment[, String author[,
ClientAnchor anchor]])). I'm open to suggestions; patches greatly appreciated.

In the mean time, to fix your problem, you should make row1 and col1 of the
anchor match the address of the cell that will hold the comment before you
create the comment:

    anchor.setRow1(0);
    anchor.setCol1(0);
    Comment comment1 = drawing.createCellComment(anchor);
    RichTextString richTextString1 = helper.createRichTextString("comment1");
    comment1.setString(richTextString1);
    cell1.setCellComment(comment1);

    anchor.setRow1(0);
    anchor.setCol1(1);
    Comment comment2 = drawing.createCellComment(anchor);
    RichTextString richTextString2 = helper.createRichTextString("comment2");
    comment2.setString(richTextString2);
    cell2.setCellComment(comment2);

    anchor.setRow1(0);
    anchor.setCol1(2);
    Comment comment3 = drawing.createCellComment(anchor);
    RichTextString richTextString3 = helper.createRichTextString("comment3");
    comment3.setString(richTextString3);
    cell3.setCellComment(comment3);

[1] https://poi.apache.org/spreadsheet/quick-guide.html#CellComments
[2]
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java?revision=1731980&view=markup#l302

-- 
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 59393] IllegalArgumentException when set comment for Multiple cell included cell A1

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

Axel Howind <ax...@dua3.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

-- 
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