Bug 77352 - Copying cell range with chart results in incorrect clipboard, unless sheet renamed from "Sheet1"
Summary: Copying cell range with chart results in incorrect clipboard, unless sheet re...
Status: RESOLVED DUPLICATE of bug 99969
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: regression
Depends on:
Blocks: Calc-Images Chart-Data Cut-Copy
  Show dependency treegraph
Reported: 2014-04-11 23:18 UTC by panoworks
Modified: 2024-03-04 05:44 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

example of chart copying (21.29 KB, image/png)
2014-04-11 23:18 UTC, panoworks
test ODS (17.10 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-09-06 21:17 UTC, Stéphane Guillou (stragu)

Note You need to log in before you can comment on or make changes to this bug.
Description panoworks 2014-04-11 23:18:11 UTC
Created attachment 97246 [details]
example of chart copying

When copying a range of cells, objects within that range - such as charts - are copied as well.  In Windows, this copies not just LibreOffice data but also bitmap data which can be pasted in most graphics programs.
This is useful mostly when wanting to quickly copy/paste overlapping charts, as the standard 'Export as Image...' only applies to a single chart, and alternative means (screenshots, printing to a bitmap printer, etc.) are cumbersome as well and have their own issues (e.g. copying a selected chart directly copies it without any anti-aliasing).

Unfortunately, something appears to have broken here recently.  Repro steps:
1. Create a simple table, e.g.
Thing | Amount
A     | 1
B     | 2
C     | 3
D     | 4

2. Create a chart for that table.  A pie chart will do.
This should appear as a standard pie chart with green, yellow, orange and blue sections.

3. select the cells that contain the chart.
4. copy the selection to clipboard
5. paste into a graphics program
The pie chart itself is not visible, while the legend shows completely different colors (irfanview) or the correct colors (mspaint - but still no actual chart), or fails to paste entirely (GIMP).

Example image attached.

Potentially related: Bug 60443, Bug 61405 - though those deal in part with pasting into LibreOffice documents.
Comment 1 raal 2014-10-06 19:50:35 UTC
I can not confirm with LO (ID build: edfb5295ba211bd31ad47d0bad0118690f76407d), Windows 7.
Copy paste chart to mspaint is correct.
Comment 2 panoworks 2014-10-06 20:45:28 UTC
Thanks for the reminder to check this. (edfb5295ba211bd31ad47d0bad0118690f76407d), can still confirm actual chart is missing here - only the legend (minus text) pastes.  But at least the odd color issue disappeared (not being able to paste in Gimp shifted to happening when copying the chart object itself - will open a different bug report if required).


I decided to check out the clipboard data, just in case Gimp et al were being silly, using:

When copying cells with chart, I get output on several seemingly graphics-related clipboard streams:
CF_DIB: Mostly FF values, coinciding with the white of the chart.
PNG: Saved as binary, shows no chart.
Windows Bitmap: Mostly FF values (saved as binary, shows no chart)
GDIMetaFile: Unsure - apparently one of the few formats irfanview will not open or recognize.


Some additional info:
O/S: Windows 8

- Other charts elements do appear to copy (title, subtitle, axes labels, axes, major/minor grid).
- In most chart types, the legend's text does appear.
- In the 'net' type of chart, the net title does not appear.
- In a pie chart (any subtype), if I change the legend to appear at the top/bottom and make some of the label data longer, the legend's color squares get further apart to make room for the text.  However, in the pasted version, they are all spaced closely together (i.e. as if the chart is re-generated for the clipboard specifically, and has the text (and pie slices) missing entirely).

Any other things I could try / information I could provide?
Comment 3 raal 2014-10-07 17:36:00 UTC
I can not confirm with LO (ID build: edfb5295ba211bd31ad47d0bad0118690f76407d), Windows 7 64bit.
Copy paste chart to mspaint is correct.

But I can confirm with LO portable (portableapps.com), windows 7 32bit
Copy paste chart to mspaint is incorrect - no chart.

I can confirm with Version:
Build ID: ced24ffba2fa1754c466b7944b0ee06d21292706
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-10-04_21:31:09
Copy paste chart to gimp is incorrect - no chart.

I can not confirm with LO, Linux
Copy paste chart to gimp is correct.

Setting as NEW.
Comment 4 panoworks 2014-10-07 18:58:38 UTC
Glad you could confirm!  I figured I should check if this issue also happens in AOO - it doesn't.  That led me to checking out bug fix lists, and it looks  like this bug from AOO is relevant:

I can also confirm what is mentioned in there - renaming the sheet that the graph is on to anything other than "Sheet1" appears to cause the bug to be avoided.  We never rename it, as the first sheet is designated our 'scratch pad' sheet.

At least that's a work-around.  If you feel that this new information should lower the Importance, you'd get no complaint out of me :)
Comment 5 QA Administrators 2015-10-14 19:56:35 UTC Comment hidden (obsolete)
Comment 6 panoworks 2015-11-16 14:16:33 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2017-01-03 19:35:28 UTC Comment hidden (obsolete)
Comment 8 panoworks 2017-01-04 12:29:37 UTC
Build ID: 3d5603e1122f0f102b62521720ab13a38a4e0eb0
CPU Threads: 8; OS Version: Windows 6.2; UI Render: default; 
Locale: en-US (en_US); Calc: group

OS: Windows
Version: 8, 64-bit

Bug still present.
Renaming the sheet still a workaround.
Comment 9 QA Administrators 2018-07-05 02:49:29 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2020-07-05 03:39:12 UTC Comment hidden (obsolete)
Comment 11 Timur 2020-07-07 07:58:16 UTC
I cannot confirm this ever worked (not marked regression anyway) but I reproduce in Lo 7.1+ with rename workaround.
Comment 12 QA Administrators 2022-07-08 03:36:56 UTC Comment hidden (obsolete)
Comment 13 Stéphane Guillou (stragu) 2023-09-06 21:15:29 UTC
Tested on recent master build:

Version: (X86_64) / LibreOffice Community
Build ID: 2ae9eb8be8d7eb9c3a72953a295d128b45639ea3
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

When pasting a cell range that contains the chart into Gimp, I lose only the legend text.

Using the linux-64-releases bibisect repo
- OOo 3.3 to LO 3.6: worked as expected.
- 4.0 to alpha: chart missing, legend text missing (had to skip 4.0 betas 1 and 2, but is bad)
- beta1 to 24.2: only legend text missing

The partial fix in 7.4 is 964e2eaae9d32df201574e6f083acc630fed2f1d for bug 142635 (checked with linux-64-7.4 bibisect repo) - thanks Mike for that improvement!
However, we're still missing some legend labels.

I can also confirm the sheet-renaming workaround: the copy-paste works fine then!
Comment 14 Stéphane Guillou (stragu) 2023-09-06 21:17:35 UTC
Created attachment 189398 [details]
test ODS

Sample ODS I used for the bibisections above.
Copy the pink range of cells.
Comment 15 Mike Kaganski 2024-03-03 00:44:47 UTC

*** This bug has been marked as a duplicate of bug 99969 ***
Comment 16 Stéphane Guillou (stragu) 2024-03-04 05:44:14 UTC
Verified that it indeed pastes the full chart with its labels into GIMP 2.10.36 and Inkscape 1.3.1 when copied from:

Version: (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

Thanks Mike!