Bug 58175 - Comments in cells corrupting file for Microsoft Excel
Summary: Comments in cells corrupting file for Microsoft Excel
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.12-FINAL
Hardware: PC All
: P2 regression (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on: 54920 56424 57571
  Show dependency tree
Reported: 2015-07-23 18:58 UTC by nicolas
Modified: 2015-07-24 12:05 UTC (History)
0 users

Sample program (1.70 KB, text/plain)
2015-07-23 18:58 UTC, nicolas

Note You need to log in before you can comment on or make changes to this bug.
Description nicolas 2015-07-23 18:58:19 UTC
Created attachment 32934 [details]
Sample program

When adding a comment to a specific cell using Cell.setCellComment(), it seems like it's corrupting the .xlsx file. Excel shows a message explaining that the content is not readable, and removes the comment in section "/xl/comments1.xml"

To reproduce the problem I used the snippet available at https://poi.apache.org/spreadsheet/quick-guide.html#CellComments. The full source to reproduce the problem is attached down below.

By the tests I have made, it only happens with SXSSF and Microsoft Excel. If I use XSSF (Non-streamed) or HSSF, the message is not displayed in Excel. Also, if opening the "corrupted" .xlsx with LibreOffice, no message is shown and the comment is displayed correctly.

Also, this behaviour started since we updated from version 3.9 to version 3.12 to fix some problems we had with images, and in version 3.9 it works perfetly. I also tested it in version 3.13-beta1-20150723 and the problem persists. I did not test in 3.10 and 3.11

Apache POI full version: poi-3.12-20150511
Microsoft Excel version: Microsoft Excel 2010 (14.0.7153.5000) SP2 MSO
Comment 1 Dominik Stadler 2015-07-23 20:46:38 UTC
This sounds related to bug 57571, can you try the workaround posted there.
Comment 2 Dominik Stadler 2015-07-24 07:14:56 UTC
This seems to have been caused by changes for bug 54920, we need to find out how to solve this for both cases...
Comment 3 nicolas 2015-07-24 11:05:22 UTC
I guess I missed that bug. The workaround specified there works fine for me, seems like both bugs are the same
Comment 4 Dominik Stadler 2015-07-24 12:03:30 UTC
This is now fixed again via r1692483, it was a regression that was introduced in 2013 as part of fixing Bug 54920.