Bug 142108 - Calc chart loses data number formatting in new source Data Table when copied to non calc LibO document (Writer, Draw)
Summary: Calc chart loses data number formatting in new source Data Table when copied ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 150198 (view as bug list)
Depends on:
Blocks: OOXML-Chart 159109
  Show dependency treegraph
 
Reported: 2021-05-05 17:45 UTC by szz
Modified: 2024-03-04 07:21 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Calc document with chart with decimals formatted to 2 digits (14.28 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-05-05 17:51 UTC, szz
Details
Writer text document with pasted chart (14.23 KB, application/vnd.oasis.opendocument.text)
2021-05-05 17:58 UTC, szz
Details
screenshot: as I see the pasted chart (40.55 KB, image/png)
2021-05-05 18:02 UTC, szz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description szz 2021-05-05 17:45:39 UTC
Description:
Pasted bar-chart bar in 

Writer shows 4.12345678 while its original in 
Calc   shows 4.12

A chart which has decimal values shown on bars loses cell level formatting and shows all decimals in Writer (seems like 4.123456768) instead showing the value in the original format which was set in Calc (like 4.12) It worked different way in previous versions. 
- In 6.2.0.3 if I have copy pasted a chart from Calc to Writer, decimal value formatting was the same in Writer. (4.00 was correct too)
- In 6.4.7 the whole numbers are shown without any decimal part but decimal numbers are shown the same way as they are formatted in Calc.

The correct way would be to show values exactly the same format.
if in Calc 
the source value is 4      and value shown on bar is 4.00 Writer must show 4.00
the source value is 4.1234 and value shown on bar is 4.12 Writer must show 4.12


Steps to Reproduce:
1. create a table like this in Calc 
	col1	      col2
row1	  4	  4.12345678912345

2 format BOTH cells with numeric values to show exactly 2 decimals
(format cells, category "number" options Decimal places: 2)
you should see 4.00 and 4.12
 
3. create bar chart from data in point 1)

4. right click on chart /EDIT

5. right click on any bar in chart /Insert Data Labels (to show values on bars) 

6. click out from chart to leave edit mode

7. copy bar chart to clipboard

8. open new text document from file/New/text document menu

9. paste Chart from clipboard to the text document


Actual Results:
in Writer's text document bar chart bars show "4" and "4.12345678912345"

Expected Results:
to show exactly the same format as it was in Calc on bar chart:
"4.00" and "4.12"


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 7.1.2.2 (x86) / LibreOffice Community
Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

I was informed about this error from other 3 people who could not use my charts due to this error. I could reproduce it after that on my machine.
I used portable version for error reporting because I need to use the installed version 6.2.0.3 daily, which does not have this error.
Comment 1 szz 2021-05-05 17:51:50 UTC
Created attachment 171657 [details]
Calc document with chart with decimals formatted to 2 digits

Calc spreadsheet with simple test chart

if you copy paste this chart to a blank Writer document
you can reproduce the error I want to report.
Comment 2 szz 2021-05-05 17:58:45 UTC
Created attachment 171658 [details]
Writer text document with pasted chart

Writer document that I have created used te Calc source : decimal_part_fmt_error_source_chart_in_Calc.ods
Comment 3 szz 2021-05-05 18:02:58 UTC
Created attachment 171659 [details]
screenshot: as I see the pasted chart


screenshot: as I see the pasted chart in LO version 7.1.2.2
Comment 4 Eleonora Govallo 2021-08-23 22:16:49 UTC
Repro in Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 008f28c9e01114e731f785e9e238236a1ed069d2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: ru-RU (ru_RU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-08-22_15:17:36
Calc: threaded
Comment 5 Rainer Bielefeld Retired 2022-07-31 06:47:57 UTC
I updated Summary to root of the problem
Please also see comment and screenshot in Bug 150198 Comment 9

Still REPRODUCIBLE with Server Installation of Version: 7.5.0.0.alpha0+  Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU-Threads: 4; BS: Windows 6.1 Service Pack 1 Build 7601; UI-Render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL |  Auto Colibre Theme  |  Special devUserProfile  (based on my normal one)
Comment 6 Rainer Bielefeld Retired 2022-07-31 06:49:07 UTC
*** Bug 150198 has been marked as a duplicate of this bug. ***
Comment 7 Rainer Bielefeld Retired 2022-07-31 06:51:41 UTC
a) OS = All due to Bug 150198 
b) I already see this in oOO 3.2.0. so probably this never worked 
c)Bug or RfE, that is the question here.
Comment 8 Justin L 2024-01-10 15:31:15 UTC
When loading charts, sometimes a Microsoft document with a chart goes through an ODF export/import cycle when loading the chart. For example
chart2/qa/extras/data/docx/testSeriesIdxOrder.docx

I was expecting that bug 137691 would have fixed round-tripping the correct formatting for this DOCX chart, but it didn't and I think the reason is related to what this bug is describing.

Steps to reproduce for testSeriesIdxOrder.docx
1.) open testSeriesIdxOrder.docx, edit the chart, then View - Data Table
and notice that "Production" is formatted as 1,234 while "wine grape" is formatted as 1234.56 (which surprisingly is correct in both cases).
2.) Round-trip the file (save and reload) and see that all formatting is lost.

After some debugging, it seem like import is the problem here. If you xray the file and look at how it is represented internally, the formatting code is already lost at initial file import. (ThisComponent.EmbeddedObjects(0).Model.DataSequences(1).Values.NumberFormatKey)

My debugging patch is at https://gerrit.libreoffice.org/c/core/+/161826.