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 2009/05/13 08:33:59 UTC

DO NOT REPLY [Bug 47188] New: setCellComment corrupts workbook (2007 XML format)

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

           Summary: setCellComment corrupts workbook (2007 XML format)
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: vinu.kumar@gmail.com


Created an attachment (id=23648)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23648)
Attachment for the bug

XSSFComment comment = sheet.createComment() and then calling
cell.setCellComment(comment);

corrupts the workbook.

Opening the workbook gives the following error:

Removed Records: Comments from /xl/comments1.xml part (Comments)

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

--- Comment #3 from rajeev <rs...@ketera.com> 2009-12-21 03:32:09 UTC ---
Hi,
I have tried creating comments in the excel file, using below code

ClientAnchor anchor = ch.createClientAnchor();
                    Comment comment = drawing.createCellComment(anchor);
                    comment.setString(ch.createRichTextString(alias));
                    cell.setCellComment(comment);

after writing the xls and opening the file it gives error "File error data may
have been lost" and opens the file

In the file, content is anchored to first cell as well as minimized which you
need to expand to see the comment. 

Rajeev

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


Re: DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

Posted by ram_dwivedi <ra...@cisco.com>.
Hello friends,

I was able to overcome of this issue as well. The issue was with my code
itself. In my code, I was suppose to write comments within a for loop and a
condition in that for loop. I was setting anchor before that if condition.
So, if IF condition fails, comment will not get set but anchor is already on
that Drawing, hence the issue.

In .xlsx, you can see the erroneous comment if you open your .xlsx in 7-Zip
or some other zip utility, go to xl folder and open comments1.xml. You'll
find some tag without any comments like <comment ref="B2" authorId="0"/>.
Rest of the comments would be fine. You just remove this, save your xml and
get it zipped back, close your zip utility and open .xlsx. It'll open fine.

Hope this helps someone else!

Thanks,
Ram

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/DO-NOT-REPLY-Bug-47188-New-setCellComment-corrupts-workbook-2007-XML-format-tp2331422p4378295.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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


Re: DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

Posted by ram_dwivedi <ra...@cisco.com>.
Hi, I am having the same problem. I am using POI3.6. I am having our xl
template in a ByteArrayInputStream which takes xl data from DB, does some
processing and populates it with comments. However, 

when we get the .xlsx, below is the error message while opening the file and
all comments wipe off.
"Removed Records: Comments from /xl/comments1.xml part (Comments)"

If we write it to .xls format, message is:
"File Error: Data may have been lost"

however, comments are visible. Any help will be greatly appreciated.
Thanks!!

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/DO-NOT-REPLY-Bug-47188-New-setCellComment-corrupts-workbook-2007-XML-format-tp2331422p4377356.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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


DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |LATER

--- Comment #9 from Nick Burch <ni...@alfresco.com> 2011-02-25 17:04:02 EST ---
I believe this is now fixed, please re-open if the problem remains with a
recent svn nightly build / recent release, and include details of how to
replicate the problem

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

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

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

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2009-11-27 09:51:12 UTC ---
the problem should be fixed in r884918.

Was the attached template created by POI? If so, please re-create it using the
latest build from trunk. Your template contains comments not having visual
properties that are stored in the vmlDrawing.vml part. r884918 fixed this and
some other bugs.

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


DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

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

--- Comment #6 from rajeev <rs...@ketera.com> 2010-01-06 03:58:33 UTC ---
yes I am using 3.6 and without any template
below is the code snippet

    ClientAnchor anchor = ch.createClientAnchor();
                        anchor.setCol1(6+i);
                        anchor.setRow1(4+i);
                        anchor.setCol2(12+i);
                        anchor.setRow2(13+i);
                        anchor.setDx1(i*4);
                        anchor.setDy1(i*4);
                        anchor.setDx2(i*4);
                        anchor.setDy2(i*4);

                        Comment comment = drawing.createCellComment(anchor);
                        comment.setString(ch.createRichTextString(alias));
                        comment.setColumn(i);
                        comment.setRow(0);
                        cell.setCellComment(comment);

Setting co-ordinates solved the anchoring problem but still i guess the same
old error

Opening the workbook gives the following error:

Removed Records: Comments from /xl/comments1.xml part (Comments)

Not sure whether I am missing anything.

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

--- Comment #2 from Vinu Kumar <vi...@gmail.com> 2009-12-01 23:57:41 UTC ---
Now setting comment on a xlsx file works!

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

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

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

--- Comment #8 from Yegor Kozlov <ye...@dinom.ru> 2010-01-24 06:00:33 UTC ---
Rajeev,

I can't reproduce the problem with the current trunk. The following code
snippet works fine and produces readable output: 

    public static void main(String[] args) throws Exception {
        Workbook wb = new XSSFWorkbook();
        Sheet sh = wb.createSheet();

        int i = 0;
        Cell cell = sh.createRow(0).createCell(i);
        CreationHelper ch = wb.getCreationHelper();
        Drawing drawing = sh.createDrawingPatriarch();

        ClientAnchor anchor = ch.createClientAnchor();
        anchor.setCol1(6+i);
        anchor.setRow1(4+i);
        anchor.setCol2(12+i);
        anchor.setRow2(13+i);
        anchor.setDx1(i*4);
        anchor.setDy1(i*4);
        anchor.setDx2(i*4);
        anchor.setDy2(i*4);

        Comment comment = drawing.createCellComment(anchor);
        comment.setString(ch.createRichTextString("Testing 47188"));
        comment.setColumn(i);
        comment.setRow(0);
        cell.setCellComment(comment);

        FileOutputStream out = new FileOutputStream("/temp/47188.xlsx");
        wb.write(out);
        out.close();
    }

Try the latest build from trunk. Nightly builds can be downloaded from
http://encore.torchbox.com/poi-svn-build/. 

If the problem persists, please attach full sample code to reproduce, ideally a
junit test case.

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


DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

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

rajeev <rs...@ketera.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #4 from rajeev <rs...@ketera.com> 2009-12-21 03:39:47 UTC ---
Reopening the bug.

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

rajeev <rs...@ketera.com> changed:

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

--- Comment #7 from rajeev <rs...@ketera.com> 2010-01-06 04:53:36 UTC ---
changing the status after providing asked info

-- 
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 47188] setCellComment corrupts workbook (2007 XML format)

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

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

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

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2009-11-30 06:45:11 UTC ---
the problem should be fixed in r884918.

Was the attached template created by POI? If so, please re-create it using the
latest build from trunk. Your template contains comments not having visual
properties that are stored in the vmlDrawing.vml part. r884918 fixed this and
some other bugs.

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


DO NOT REPLY [Bug 47188] setCellComment corrupts workbook (2007 XML format)

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO

--- Comment #5 from Yegor Kozlov <ye...@dinom.ru> 2009-12-21 06:29:20 UTC ---
Rajeev,

Please attach sample code to reproduce the problem. The code snippet you posted
is not enough. If your code uses a template then attach it as well. 

Which version of POI are you using? Make sure it is POI-3.6 or 3.7-SNAPSHOT. 

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