Bug 63902 - Cloned chart has reference to field with original sheet. Problem with method Workbook.cloneSheet(int sheetNum)
Summary: Cloned chart has reference to field with original sheet. Problem with method ...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.1-FINAL
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2019-11-03 21:14 UTC by Martin
Modified: 2021-02-17 07:14 UTC (History)
0 users

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

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2019-11-03 21:14:57 UTC
I think I found a bug related with method Workbook.cloneSheet(int sheetNum). When I cloned original sheet(sheetA) with chart(chartA) in cloned sheet(sheetB) in chart(chartB) I have reference to original sheet(sheetA) but not to new(sheetB) . That doesn't works as expected and I think new chart(chartB) in the new sheet(sheetB) should have reference to fields from new(sheetB).  I tried change references manual by CTNumRef.setF(String var1) and CTStrRef.setF(String var1) but when I did that I change reference also in original(chartA). That is only with cloned chart(chartB). I think they can be related with something together.

I want to cloned chart(chartB) has reference to new cloned sheet (sheetB) not to original. 
Comment 1 bschuhmacher 2020-02-10 10:52:01 UTC
Created attachment 36996 [details]
Test case
Comment 2 bschuhmacher 2020-02-10 10:56:50 UTC
Comment on attachment 36996 [details]
Test case

Sorry, this was for another ticket, no idea how it got attached here...
Comment 3 Johannes Paul 2021-02-09 17:54:49 UTC
I am facing almost the same issue, except the fact, that i can't even open the File anymore with Excel (2016).
It gets corrupted and can't be open, and not even be automatically repaired by Excel.

I have also a Template sheet, including a chart. If i try to clone that template (and rename the clone), and save the file, the file is corrupt.
If i repeat the same process after just deleting the chart, everything works.

How can i contribute or help?
Comment 4 Alain Fagot Bearez 2021-02-09 18:11:55 UTC

Could you repeat your experiment with the version I am trying to build on https://github.com/apache/poi/pull/227 and share your example file?

Comment 5 Johannes Paul 2021-02-16 16:00:49 UTC
Sadly i can't setup POI locally. It won't build.
If you provide me somehow the jars (or help me to setup POI), i would be happy to test it!

Comment 6 Alain Fagot Bearez 2021-02-16 23:44:21 UTC
When successful, the build https://ci-builds.apache.org/job/POI/job/POI-DSL-1.16/195/ will contain references to artifacts which you could download.

You can find guidance to setup your development environment on https://poi.apache.org/devel/index.html

You can also ask specific questions about building and testing through the mailing lists at https://poi.apache.org/help/index.html
Comment 7 Dominik Stadler 2021-02-17 07:14:09 UTC
Related change: r1886605