Bug 99969 - COPYING cells containing a chart and pasting as embedded spreadsheet doesn't copy the data chart (comment 14)
Summary: COPYING cells containing a chart and pasting as embedded spreadsheet doesn't ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.2
Keywords:
: 77352 153562 153685 (view as bug list)
Depends on:
Blocks: Chart Paste Sheet
  Show dependency treegraph
 
Reported: 2016-05-20 15:49 UTC by Guillaume Smaha
Modified: 2024-03-13 07:54 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


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

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 4.3.5.2 (Windows x86)
- LibreOffice 5.1.2.2 (Ubuntu 16.04 x64)
- LibreOffice 5.2.0.0.alpha (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: 5.2.0.0.alpha1+
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 Comment hidden (no-value)
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 Comment hidden (no-value)
Comment 8 Jean-Sebastien Bevilacqua 2019-04-30 14:08:51 UTC Comment hidden (no-value)
Comment 9 Jean-Sebastien Bevilacqua 2019-11-04 16:58:55 UTC
hello, 

bug is still present on 6.2.7.1
Comment 10 Arnaud Versini 2020-10-12 10:17:16 UTC Comment hidden (no-value)
Comment 11 Arnaud Versini 2020-10-12 10:26:55 UTC Comment hidden (no-value)
Comment 12 QA Administrators 2022-10-13 03:32:41 UTC Comment hidden (obsolete)
Comment 13 Buovjaga 2022-12-02 13:17:47 UTC
Still repro

Arch Linux 64-bit
Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 2b093d27b7e6f231512920f20089fcac291b021f
CPU threads: 8; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 2 December 2022
Comment 14 Stéphane Guillou (stragu) 2024-03-01 11:27:06 UTC
Some history (all with linux-64 bibisect repos):

* This issue is reproduced in OOo 3.3 -> inherited.

* Since 6.4 and Kendy's e9e6d4b058e13165f3dde1ca7822eec97dfe8aa7 (for bug 116685), the default paste is RTF instead of an embedded spreadsheet. Therefore, from 6.4, one has to test this bug by pasting with Ctrl + Shift + V > LibreOffice Spreadsheet.

* Since 7.0 and Mike's 1782810f886acd26db211d8fdd7ae8796d203c57 (for bug 130725), there is no chart object whatsoever in the pasted embedded spreadsheet, but the rename workaround still works.

* Finally, since 7.4 and Mike's 964e2eaae9d32df201574e6f083acc630fed2f1d (and all the way to a current 24.8 alpha0+ build), the workaround of renaming the sheet before copying does not work anymore.

Mike, any chance you could have a look at this one?
Comment 15 Mike Kaganski 2024-03-01 15:51:47 UTC
(In reply to Stéphane Guillou (stragu) from comment #14)

Oh, fun.
My change made the previous problem "fail correctly": previously, it misinterpreted the DBL_MIN value (2.2250738585072014e-308) as 0, and the chart showed these zeroes. After 1782810f886acd26db211d8fdd7ae8796d203c57, the value is recognized correctly, and as it is used in chart to denote empty cells, all the data is "empty" -> the chart is shown completely empty (actually, since some other change, not shown at all).

The only thing that is needed here is passing the values (the inherited-from-OOo problem). I will try to find the original problem.
Comment 16 Commit Notification 2024-03-03 00:05:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/709866a3b8e073fab4937dcf91dcd33ff1d2bc13

tdf#99969: make sure to copy the chart source ranges to clipboard

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Mike Kaganski 2024-03-03 00:44:47 UTC
*** Bug 77352 has been marked as a duplicate of this bug. ***
Comment 18 Mike Kaganski 2024-03-03 01:00:34 UTC
*** Bug 153685 has been marked as a duplicate of this bug. ***
Comment 19 Mike Kaganski 2024-03-03 01:23:32 UTC
*** Bug 153562 has been marked as a duplicate of this bug. ***
Comment 20 Stéphane Guillou (stragu) 2024-03-04 05:36:47 UTC
Thanks for tackling it, Mike! Fix verified in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 709866a3b8e073fab4937dcf91dcd33ff1d2bc13
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded
Comment 21 Commit Notification 2024-03-05 08:33:03 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/44141fbb32c181a1fea2730b194b2664521d0a79

tdf#99969: make sure to copy the chart source ranges to clipboard

It will be available in 24.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2024-03-05 13:15:43 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f03cb8214a2b1b3de8d93c1a19319ecc82e4b21d

tdf#99969: chart2_uichart: Add unittest

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.