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/03/17 10:33:32 UTC

[Bug 59186] New: Wrong validation check in XSSFDrawing.createCellComment()

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

            Bug ID: 59186
           Summary: Wrong validation check in
                    XSSFDrawing.createCellComment()
           Product: POI
           Version: 3.13-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: snowy@web.de

The XSSFDrawing.createCellComment contains this validation check:
        if(comments.findCellComment(ref) != null) {
            throw new IllegalArgumentException("Multiple cell comments in one
cell are not allowed, cell: " + ref);
        }

This is wrong because this assumes the comment is added to the col1 and row1.
But this is the anchor only and does not necessarily mean that this comment is
added to this cell. Real life sample from Excel 2010:
        <x:ClientData ObjectType="Note">
            <x:MoveWithCells/>
            <x:SizeWithCells/>
            <x:Anchor>
    2, 15, 1, 14, 3, 55, 5, 21</x:Anchor>
            <x:AutoFill>False</x:AutoFill>
            <x:Row>2</x:Row>
            <x:Column>1</x:Column>
            <x:Visible/>
        </x:ClientData>
In this the anchor is cell C2 (col 2, row 1) but the comment is set for cell B3
(col 1, row 2).

So this validation check has to be removed.

-- 
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 59186] Wrong validation check in XSSFDrawing.createCellComment()

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

Javen O'Neal <on...@apache.org> changed:

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

-- 
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 59186] Wrong validation check in XSSFDrawing.createCellComment()

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

--- Comment #3 from Javen O'Neal <on...@apache.org> ---
Refer to bug 56835
Unit test which demonstrates that adding a comment in the same cell twice is
not allowed (since it would produce a corrupt workbook):
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java?r1=1633397&r2=1633396&pathrev=1633397

-- 
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 59186] Wrong validation check in XSSFDrawing.createCellComment()

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

--- Comment #1 from Mario <sn...@web.de> ---
Created attachment 33681
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33681&action=edit
Patch that removes the validation

-- 
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 59186] Wrong validation check in XSSFDrawing.createCellComment()

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

Javen O'Neal <on...@apache.org> changed:

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

--- Comment #2 from Javen O'Neal <on...@apache.org> ---
Remember that Excel's cell address format is inverted: column/row.

B3 (row 3, col B) is cell 2, 1 (0-indexed)
C2 (row 2, col C) is cell 1, 2 (0-indexed)

I believe the code works correctly.

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