Bug 120348 - Copy-paste of line chart to another spreadsheet results in data loss if the data-range of the chart contains cells that have value ERR:502
Summary: Copy-paste of line chart to another spreadsheet results in data loss if the d...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4 all versions
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:7.2.0 target:7.1.1 target:7.0....
Keywords: bibisected, regression
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2018-10-05 16:15 UTC by Tuomas J
Modified: 2022-11-25 20:29 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet contains data and chart. Copying chart to another spreadsheet results in corrupted chart. (42.59 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-10-05 16:15 UTC, Tuomas J
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tuomas J 2018-10-05 16:15:27 UTC
Created attachment 145415 [details]
Spreadsheet contains data and chart. Copying chart to another spreadsheet results in corrupted chart.

I have numerical data in four columns. These columns contains references to cells in other columns eg. LOG(C6). Some of the cells that are referenced are blank. This results in ERR:502 (log(0)!).

I select the columns and insert a chart: Insert -> Chart -> Line. I select "Lines only". I get a line chart where the parts of the lines that refer to ERR:502-cells are not drawn (This is the desired behaviour). I can copy the chart (Ctrl-C, Ctrl-V) on the same spreadsheet with no corruption.

I then paste the chart on another spreadsheet, text document, drawing or presentation. The chart is otherwise identical to the original one except:
Only the first part of the line that is non-continuous due to ERR:502-cells is present on the copied chart. The latter parts of the line are not shown.

(One of the lines is also non-continuous due to empty cells (no error). This line is copied correctly.)

I inspected the copied charts: Right-click -> Data table... The data table does not contain values after the first blank area of the corrupted line. It seems that the data for the line does not get copied after cells that contain ERR:502. 
The data table of the copied chart contains only values and empty cells. It does not contain cells that have value "ERR:502". 

Work-around:
1. "Export as image" results in correct png-images that can be imported to other documents.
2. The sheet could be modified so that no ERR:502 cells are present.
Comment 1 Oliver Brinzing 2018-10-05 17:43:49 UTC
i can confirm the described behaviour

Version: 6.1.2.1 (x64)
Build-ID: 65905a128db06ba48db947242809d14d3f9a93fe
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: 

Version: 6.2.0.0.alpha0+ (x64)
Build ID: bc32f789bb3c079eba9c07275866a7b13f76dbcc
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: de-DE (de_DE); Calc: threaded

workaround:
it worked for me using a matrix formula, for example column H:
- select D3:D159
- enter: =IF(D3:D159="";"";LOG(D3:D159))
- Shift+Ctrl+Enter
Comment 2 Xisco Faulí 2018-10-17 10:51:56 UTC
I can reproduce the issue copying the chart from the spreadsheet to a writer document.

Reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default; 

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

but not in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 3 Aron Budea 2018-11-07 23:48:55 UTC
Bibisected to the following range using repo bibisect-42max (intermediate ones failed to build), all part of Kohei Yoshida's Calc work:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=ac84ffb3c90bb5788608eadf2177f587021daaad..4c99a427ee4adaeddb2682c192384bad21d9d09b
Comment 4 QA Administrators 2020-12-27 03:36:37 UTC Comment hidden (obsolete)
Comment 5 Commit Notification 2021-02-02 00:06:04 UTC
Ouyang Leyan committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/318d384c596c1593667d6c936f55bf6ebd0c5db6

tdf#120348: Avoid data loss when copying chart with error in formulas

It will be available in 7.2.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 6 Xisco Faulí 2021-02-03 16:51:28 UTC
Verified in

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 876da94619d561e4b4c6c7d12a8d6726eb857df8
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Ouyang Leyan, thanks for fixing this issue. Should it be closed as RESOLVED FIXED ?
Comment 7 Commit Notification 2021-02-03 19:34:55 UTC
Ouyang Leyan committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#120348: Avoid data loss when copying chart with error in formulas

It will be available in 7.1.1.

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 8 Commit Notification 2021-02-03 19:35:09 UTC
Ouyang Leyan committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

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

tdf#120348: Avoid data loss when copying chart with error in formulas

It will be available in 7.0.5.

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 9 Commit Notification 2021-02-03 22:35:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/356848ed36f958c283d1863934161d6823d8b121

tdf#120348: sc: Add UItest

It will be available in 7.2.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 10 Xisco Faulí 2021-02-11 21:32:54 UTC
I think we can close this issue.
@Ouyang Leyan, thanks for fixing this issue
Comment 11 Commit Notification 2022-11-25 20:29:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6e9b99ffe0083060176dc782986d3b441b7e48ec

tdf#120348: move UItest to CppUnittest

It will be available in 7.5.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.