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 2012/02/25 02:11:42 UTC

DO NOT REPLY [Bug 52764] New: Unmodified cell comments disappear after HSSFWorkbook.write

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

             Bug #: 52764
           Summary: Unmodified cell comments disappear after
                    HSSFWorkbook.write
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: kl223hun@gmail.com
    Classification: Unclassified


Created attachment 28383
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28383
Test program to reproduce bug.

Steps to reproduce bug (see attached test program):
 1. load an existing .xls file that has comments on multiple cells into a
HSSFWorkbook
 2. delete the comment from one of the cells and create a new comment on the
same cell. Do not touch any of the other cells containing comments.
 3. write the HSSFWorkbook instance to a file.
 4. the resulting file will only contain a single comment on the cell that we
modified. Any other previously existing comments disappeared into thin air.

The test program...
 1. creates A1_B1_commented.xls in the current directory. In this file there is
a single sheet with comments on the A1 and B1 cells.
 2. loads the created file again and creates a new comment for A1, then writes
the HSSFWorkbook to B1_comment_lost.xls
 3. as the name suggests, the comment for B1 is gone (can be checked in
LibreOffice or Apache POI), though nobody ever touched it.

Tested on with the latest svn release (poi-3.8-beta6-20120225).

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Laszlo Kustra <kl...@gmail.com> changed:

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

--- Comment #2 from Laszlo Kustra <kl...@gmail.com> 2012-02-25 14:12:59 UTC ---
(In reply to comment #1)
> How are you creating the additional comments? Does it by any chance include a
> call to createDrawingPatriarch?
> 
> If so, you should note the warning in the javadocs - 
> http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#createDrawingPatriarch()
> - "This will have the effect of removing any existing drawings on this sheet."
> 
> (Comments are a kind of drawing)

Please have a look at the attached test program to see the answer for yourself.
I only call the createDrawingPatriarch() method once, when creating the sheet.
The second time, after loading the file from the disk to modify cell comments,
I call the getDrawingPatriarch() method to get the existing instance.

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

--- Comment #4 from Evgeniy Berlog <su...@gmail.com> ---
In your code you try to create two comments for one cell. Thus, Excel shows
warning "The data may have been lost". Now POI checks all the comments for each
sheet and throws an exception if find two or more comments for single cell.

Regards, Evgeniy

-- 
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 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Evgeniy Berlog <su...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53010
         Depends on|53010                       |

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


DO NOT REPLY [Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Yegor Kozlov <ye...@dinom.ru> changed:

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

--- Comment #3 from Yegor Kozlov <ye...@dinom.ru> 2012-02-27 08:49:28 UTC ---
It is a known limitation of POI: if a template workbook has graphics (shapes,
comments, pictures, etc.) then an attempt to modify / append new graphic
elements *may* destroy the original drawing. The behavior is not fully
deterministic: in simple cases graphics is preserved OK, it more complex it is
lost.

In other words, POI is good to create new drawings from scratch, but it can't
append / modify existing drawings.

There is a plan to improve it, but unfortunately it is a quite a big piece of
work and no one has volunteered to implement it.


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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Evgeniy Berlog <su...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |53010

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


DO NOT REPLY [Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Nick Burch <ni...@alfresco.com> changed:

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

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2012-02-25 05:56:25 UTC ---
How are you creating the additional comments? Does it by any chance include a
call to createDrawingPatriarch?

If so, you should note the warning in the javadocs - 
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#createDrawingPatriarch()
- "This will have the effect of removing any existing drawings on this sheet."

(Comments are a kind of drawing)

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52764] Unmodified cell comments disappear after HSSFWorkbook.write

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

Evgeniy Berlog <su...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WONTFIX                     |FIXED

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