Bug 108065 - [FILESAVE DOCX] Gradient property of the data series not preserved when saved as DOCX
Summary: [FILESAVE DOCX] Gradient property of the data series not preserved when saved...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Balázs Varga
URL:
Whiteboard: target:6.4.0
Keywords:
Depends on:
Blocks: OOXML-Chart OOXML-Object-Fill
  Show dependency treegraph
 
Reported: 2017-05-24 15:41 UTC by Gabor Kelemen (allotropia)
Modified: 2019-11-05 15:06 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from LO 5.3 (14.03 KB, application/vnd.oasis.opendocument.text)
2017-05-24 15:41 UTC, Gabor Kelemen (allotropia)
Details
Example file saved from LO 5.3 (15.00 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-05-24 15:42 UTC, Gabor Kelemen (allotropia)
Details
Docx in Word 2013 and odt in LO 5.3 side by side (154.86 KB, image/png)
2017-05-24 15:42 UTC, Gabor Kelemen (allotropia)
Details
Extended example file (29.18 KB, application/vnd.oasis.opendocument.text)
2019-10-16 14:49 UTC, Gabor Kelemen (allotropia)
Details
The extended example file saved to docx (8.52 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-10-16 14:50 UTC, Gabor Kelemen (allotropia)
Details
Example document with color and gradient transparency (13.21 KB, application/vnd.oasis.opendocument.text)
2019-10-18 13:03 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the exported example document in LO master and word - with color transparency (97.35 KB, image/png)
2019-10-18 13:03 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the exported example document in LO master and word - with gradient transparency (103.76 KB, image/png)
2019-10-18 13:04 UTC, Gabor Kelemen (allotropia)
Details
Column area with gradient transparency (26.19 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2019-10-18 13:38 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2017-05-24 15:41:56 UTC
Created attachment 133531 [details]
Example file from LO 5.3

The gradient property of the data series in charts is not preserved when the file is saved as DOCX in LibreOffice Writer.

Steps to reproduce:
1. Create an empty text document in LibreOffice Writer
2. Insert a Chart
3. Change the Data Series Transparency property to Gradient
4. Save the file as DOCX
5. Reopen the file either in LibreOffice Writer or Microsoft Word 2013

Actual results:
The gradient disappears

Expected results:
The gradient should be preserved
Comment 1 Gabor Kelemen (allotropia) 2017-05-24 15:42:24 UTC
Created attachment 133532 [details]
Example file saved from LO 5.3
Comment 2 Gabor Kelemen (allotropia) 2017-05-24 15:42:49 UTC
Created attachment 133533 [details]
Docx in Word 2013 and odt in LO 5.3 side by side
Comment 3 Xisco Faulí 2017-05-24 16:12:00 UTC
Confirmed in

- Version: 5.4.0.0.alpha1+
Build ID: 74d2e606fd3605fe0a585f596eaa215ae4e20d18
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk2; 
Locale: en-US (ca_ES.UTF-8); Calc: group

- Version: 4.2.0.0.alpha1+
Build ID: fc8f44e82de4ebdd50ac5fbb9207cd1a59a927e3

In previous versions the chart wasn't exported at all.
Comment 4 QA Administrators 2018-05-25 02:43:34 UTC Comment hidden (obsolete)
Comment 5 Gabor Kelemen (allotropia) 2019-10-16 14:49:50 UTC
Created attachment 155040 [details]
Extended example file

In reality this can be a more widespread problem. Based on the original file, it is possible to set this gradient transparency for paragraph (although that does not work in odt either), page, frame, drawing object and most chart components: background, data series, data point (originally this bug was about that), legend, title, axis title.

On OOXML export all these are lost, although do not cause invalid XML error, only a waste of time.
Comment 6 Gabor Kelemen (allotropia) 2019-10-16 14:50:51 UTC
Created attachment 155041 [details]
The extended example file saved to docx

Gradient settings are now gone.
Comment 7 Regina Henschel 2019-10-16 16:33:49 UTC
From the proposed patch, "It is possible in ODF to set a gradient type transparency for several objects: paragraph background, page background, shape and frame background and most of the chart components. In OOXML it is not possible to use/save that, only a simple transparency expressed as a percentage value. To avoid user confusion and possible waste of work time a centrally manageable configuration key is introduced to disable this UI option in OOXML-heavy environments. Default setting is true so it means no change compared to current feature set."

In MSO each gradient stop has its own transparency value, whereas our color has no transparency. So you need the transparency gradient on import from OOXML. Perhaps instead of totally disabling it, it would be better to restrict the kind of the transparency gradient to the kind as the color gradient and only allow setting the transparency value.
Comment 8 Gabor Kelemen (allotropia) 2019-10-18 12:59:05 UTC
(In reply to Regina Henschel from comment #7)
> From the proposed patch, "It is possible in ODF to set a gradient type
> transparency for several objects: paragraph background, page background,
> shape and frame background and most of the chart components. In OOXML it is
> not possible to use/save that, only a simple transparency expressed as a
> percentage value. To avoid user confusion and possible waste of work time a
> centrally manageable configuration key is introduced to disable this UI
> option in OOXML-heavy environments. Default setting is true so it means no
> change compared to current feature set."
> 
> In MSO each gradient stop has its own transparency value, whereas our color
> has no transparency. 

Hi Regina

Thanks for the review. This is not a straightforward area, so help thinking about it is much appreciated.

My understanding so far is that in MSO the solid color fill can have a transparency which is expressed as a percentage value. 
This is interoperable in LO when we select a color on Area -> Color and set a percentage transparency value on the Transparency tab.

It is also possible to set a Transparency value for a Gradient type fill in MSO, and that could be imported/exported, but the export currently does not work.

> So you need the transparency gradient on import from
> OOXML. 

This is only about not setting something that cannot be exported anyways. Import would be a different beast... I mean bug.

> Perhaps instead of totally disabling it, it would be better to
> restrict the kind of the transparency gradient to the kind as the color
> gradient and only allow setting the transparency value.

What I'd like disable here is, to my understanding: the gradient of the transparency, which is nonexisting in OOXML.
Not the gradients transparency, which is similarly to the color fills transparency a percentage value and could be transformed to the Transparency spinbox of the Transparency tab.
Comment 9 Gabor Kelemen (allotropia) 2019-10-18 13:03:03 UTC
Created attachment 155120 [details]
Example document with color and gradient transparency
Comment 10 Gabor Kelemen (allotropia) 2019-10-18 13:03:57 UTC
Created attachment 155121 [details]
Screenshot of the exported example document in LO master and word - with color transparency
Comment 11 Gabor Kelemen (allotropia) 2019-10-18 13:04:21 UTC
Created attachment 155122 [details]
Screenshot of the exported example document in LO master and word - with gradient transparency
Comment 12 Regina Henschel 2019-10-18 13:38:02 UTC
Created attachment 155124 [details]
Column area with gradient transparency

If the MSO document has transparency on the stop, then it is currently correctly imported as a solid color in the gradient itself and parallel a transparency gradient for the transparency of the original stop.

It is correct, that this transparency is not exported currently. But for that problem the solution should be to fix the export.
Comment 13 Regina Henschel 2019-10-21 09:05:54 UTC
Hi Balázs, what are you going to implement? The proposed configuration key or will you fix export of transparency?
Comment 14 Balázs Varga 2019-10-21 12:24:47 UTC
(In reply to Regina Henschel from comment #13)
> Hi Balázs, what are you going to implement? The proposed configuration key
> or will you fix export of transparency?

I will fix the export of gradient transparency. :)
Comment 15 Balázs Varga 2019-10-21 12:30:40 UTC
I already have a working patch for this bug, but more time is needed for the optimization.
Comment 16 Regina Henschel 2019-10-21 12:55:59 UTC
OK, then I will stop my efforts there. Can you put the patch into Gerrit already now and set me for review?

Nevertheless, some results of my investigations are in https://lists.freedesktop.org/archives/libreoffice/2019-October/083643.html and https://gerrit.libreoffice.org/#/c/81165/
Comment 17 Balázs Varga 2019-10-21 13:58:49 UTC
(In reply to Regina Henschel from comment #16)
> OK, then I will stop my efforts there. Can you put the patch into Gerrit
> already now and set me for review?
> 
> Nevertheless, some results of my investigations are in
> https://lists.freedesktop.org/archives/libreoffice/2019-October/083643.html
> and https://gerrit.libreoffice.org/#/c/81165/

Thank you very much for the helping. Of course, I will push the patch into gerrit, maybe tomorrow.
Comment 18 Regina Henschel 2019-10-23 13:27:49 UTC
I have written bug 128345 to separate the case of solid fill. It makes sense to separate it despite the attachment [2019-10-18 13:03 UTC, Gabor Kelemen], because it is a problem with ordinary shapes too.

 	
Balázs Varga: Can you please test your patch on a chart in Calc? It crashes for me, if I only build oox. And building totally needs some time.
Comment 19 Regina Henschel 2019-10-23 19:56:03 UTC
Balázs Varga: With a full build, it is OK now.

The import of the transparency gradient is missing. Will you do it in the same patch?
Comment 20 Commit Notification 2019-11-05 14:57:00 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "master":

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

tdf#108065 tdf#128609 OOXML chart export: fix transparent color gradient

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