Bug 99969 - COPYING cells containing a chart doesn't copy the data chart only if the sheet name was not renamed
Summary: COPYING cells containing a chart doesn't copy the data chart only if the shee...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Chart Paste Sheet
  Show dependency treegraph
Reported: 2016-05-20 15:49 UTC by Guillaume Smaha
Modified: 2019-11-04 16:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

File with a simple chart (14.13 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-05-20 15:49 UTC, Guillaume Smaha

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Smaha 2016-05-20 15:49:09 UTC
Created attachment 125192 [details]
File with a simple chart

Steps to reproduce:
1) Open the attached calc
2) Be aware that the name of the sheet in which the chart is, it is the default name Sheet1
3) Select a range containing the chart and without the data values (like C2:L25)
4) Copy the selection
5) Open a new writer file
6) Paste in the writer file
The chart will be empty (no data)

If before copy at the step 4, you rename the sheet with another name. The chart will be correctly copied.

Reproduced with :
- LibreOffice (Windows x86)
- LibreOffice (Ubuntu 16.04 x64)
- LibreOffice (Linux x64) BuildID : 2383d557e5751387451cefa33516736228429137

After some test, I think it is due to the copy, not the paste. Because when I have a sheet name as "Sheet1", if I copy the selection and rename the sheet. The result will be bad.
Comment 1 Guillaume Smaha 2016-05-20 15:50:59 UTC
I also tried with LibreOffice in a different language (here French).
And the result is the same except the result is bad when the sheet name is equal to "Feuille1"
Comment 2 raal 2016-05-20 17:05:57 UTC
I can confirm with 	Version:
Build ID: eb7593daa4bac21bd68182c8bbbd3ee3bd7b64dd
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-05-03_07:06:45
Comment 3 Seraphime Kirkovski 2016-05-24 12:57:30 UTC
After doing some further tests, I noticed that when the chart is pasted into another sheet of the same calc document
and source data is edited, the pasted chart changes also.
When I try the same thing with a chart copied from sheet with a non-default name, modifying data doesn´t modify the pasted chart.

While debugging, I think I found an explanation for that. When the chart is copied from a default named sheet, the resulting XChart object has
an internal data provider, but when the chart has a non-default name, the chart doesn´t have an internal data provider. This explains why 
a paste of the chart in Writer is empty in the first case (the chart can´t find its data, because it´s not in the same document) and is ok
in the second case (the chart is copied as-is, without referencing anything from the source document).
Comment 4 Seraphime Kirkovski 2016-05-26 11:51:13 UTC
After some more tests, I think the problem is more profound than the simple copy-paste. I forced libreoffice to name the default sheet "Sheet2" and repeated the test procedure. LO failed to copy the chart from Sheet2 as long as it kept its name. When I renamed it "Sheet1", it worked. Renaming it back to "Sheet2", the problem was still there. There must be either some initialization ( maybe subscribing to some global object ?) done for the first sheet, which isn't done for any other sheet. I don't know that part of the code, but if the binding is done using the name of the sheet, this can explain why reaming it back to its default name breaks things.

The more I look at this, the more I think the real bug is that from a renamed chart the copy-paste is successful because the data link is broken between data cells and the chart even if I copy the data cells. It is completely logical to bind the chart to its data if there are cells selected with the chart.

If one wishes to copy only the chart, one can simply click on it and copy it, one needn't select any cells.

But if one wishes to copy an editable chart without its data, I think it is completely logical to have an empty chart. Maybe to fix this "bug", we should break copy-paste of a renamed chart ?
Comment 5 Olivier DANIEL 2016-10-06 12:53:59 UTC

Is there some news about integration of this patch in the last release ?
Comment 6 QA Administrators 2018-07-04 02:49:13 UTC Comment hidden (obsolete)
Comment 7 Jean-Sebastien Bevilacqua 2018-12-17 13:02:53 UTC

Any news on this bug ?
Comment 8 Jean-Sebastien Bevilacqua 2019-04-30 14:08:51 UTC

Any news ?
Comment 9 Jean-Sebastien Bevilacqua 2019-11-04 16:58:55 UTC

bug is still present on