Bug 62581 - If source sheet of cloneSheet has comments, adding more comments creates inconsistant xlsx
Summary: If source sheet of cloneSheet has comments, adding more comments creates inco...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: https://stackoverflow.com/questions/5...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-29 17:39 UTC by Ed Holland
Modified: 2020-02-10 10:55 UTC (History)
0 users



Attachments
Test case (1.74 KB, text/x-java)
2020-02-10 10:55 UTC, bschuhmacher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Holland 2018-07-29 17:39:55 UTC
Related info: https://stackoverflow.com/questions/51559133/poi-3-17-creating-cell-comments-in-a-cloned-sheet-creates-inconsistent-xlsx

How to reproduce:
- Source sheet contains comments
- Use cloneSheet to copy
- Create new comment in new sheet
- Save
- Open file with Excel

Result:
Excel wants to recover the excel. Afterwards the comments from the original sheet are gone.

Workaround stated in url reference is working.
Comment 1 PJ Fanning 2018-07-30 09:29:14 UTC
I suspect it would be better to rewrite cloneSheet to use the XSSF APIs to create a new sheet and to copy the data and comments from the source sheet instead of trying to work at the low-level CT generated class level and cloning all the relationships.
Comment 2 bschuhmacher 2020-02-10 10:51:43 UTC
A related problem regarding cloneSheet with comments is that removing the comment from the cloned sheet produces a NullPointerException in XSSFCell.java:1087 (POI 4.1.1)

Attached a sample to reproduce.
Comment 3 bschuhmacher 2020-02-10 10:55:04 UTC
Created attachment 36997 [details]
Test case