Download it now!
Bug 128795 - FILEOPEN DOCX Rectangular gradient fill Center XY position imported/exported incorrectly
Summary: FILEOPEN DOCX Rectangular gradient fill Center XY position imported/exported ...
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Tünde Tóth
URL:
Whiteboard:
Keywords:
Depends on: 98595
Blocks: OOXML-Object-Fill
  Show dependency treegraph
 
Reported: 2019-11-14 10:44 UTC by NISZ LibreOffice Team
Modified: 2020-08-07 12:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Writer (82.53 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-14 10:46 UTC, NISZ LibreOffice Team
Details
The original file saved by Writer (58.17 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-14 10:47 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer (134.74 KB, image/png)
2019-11-14 10:47 UTC, NISZ LibreOffice Team
Details
Screenshot of the exported document side by side in Word and Writer (122.51 KB, image/png)
2019-11-14 10:48 UTC, NISZ LibreOffice Team
Details
Shape rather than Chart Background to show issue (21.43 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-16 00:40 UTC, Luke
Details
A collection of ideas, how to get MS gradient style to ODF (24.24 KB, application/vnd.oasis.opendocument.presentation)
2020-07-22 14:58 UTC, Regina Henschel
Details
MSO and LO blending (22.54 KB, application/vnd.oasis.opendocument.text)
2020-07-23 07:56 UTC, Tünde Tóth
Details
Blending examples with screenshot (27.85 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2020-07-23 11:42 UTC, Regina Henschel
Details
Blending quadratic vs linear (145.70 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2020-07-25 09:30 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2019-11-14 10:44:46 UTC
Description:
Word has 5 presets for the rectangular gradient fill type: from top/bottom left/right corner and from center. When this kind of fill is set in a chart the Center X/Y position of the fill is imported (also exported) incorrectly.

Steps to Reproduce:
Steps to reproduce:
    1. Open attached example document in Word and Writer

Actual Results:
Actual results:
From bottom left and right corner settings get 100% and 100% X/Y values and become effectively a solid blue fill.
From center setting gets 50% and 50% values, this looks effectively the same as in Word.
From top right corner setting gets 100% X and 30% Y values, this looks effectively the same as in Word.
From top left corner setting gets 30% X and 30% Y values, this looks more horizontally centered than in Word. 0% X would look more similar.

After save to DOCX, the values change to 30% X and 30% Y in all cases.

Expected Results:
Similar looks as in Word.


Reproducible: Always


User Profile Reset: No



Additional Info:
LibreOffice details:
Version: 6.4.0.0.alpha1+ (x86)
Build ID: 80109586e6cb6d3e2e0a53a9079c3125ec9b8368
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win; 
Locale: hu-HU (hu_HU); UI-Language: en-US
Calc: CL
Comment 1 NISZ LibreOffice Team 2019-11-14 10:46:15 UTC
Created attachment 155803 [details]
Example file from Writer
Comment 2 NISZ LibreOffice Team 2019-11-14 10:47:16 UTC
Created attachment 155804 [details]
The original file saved by Writer
Comment 3 NISZ LibreOffice Team 2019-11-14 10:47:36 UTC
Created attachment 155805 [details]
Screenshot of the original document side by side in Word and Writer
Comment 4 NISZ LibreOffice Team 2019-11-14 10:48:00 UTC
Created attachment 155806 [details]
Screenshot of the exported document side by side in Word and Writer
Comment 5 Durgapriyanka 2019-11-15 16:51:59 UTC
Thank you for reporting the bug. I can confirm the bug present in

Version: 6.4.0.0.alpha1+ (x86)
Build ID: ec7374ff84c71edfbb30d6e4dc5b486b6df7107f
CPU threads: 2; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-11-10_21:37:30
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 6 Luke 2019-11-16 00:40:10 UTC
Created attachment 155865 [details]
Shape rather than Chart Background to show issue

This is not a chart bug. Neither Quadratic nor Square not map 1-to-1 to MSO's Rectangular gradient. See Bug 98595. 

Our gradient system needs a major overhaul to achieve compatibility with MSO.
Comment 7 Regina Henschel 2020-07-20 19:40:29 UTC
@Tünde Tóth: I have seen your work in https://gerrit.libreoffice.org/c/core/+/98944 about a new kind of calculating blend values. That patch refers to this issue.
Can you please explain, how the patch is supposed to solve wrong position and size of the gradient?

Microsoft stretches the gradient from the fillToRect edges to the tileRect area. Such concept does not exist in LibreOffice. We have either width=height circles (UI radial) or squares (UI quadratic) or concentric ellipses (UI ellipsoid) or rectangles (UI square). Our concept does not exist in OOXML. How will your patch address this?
Comment 8 Regina Henschel 2020-07-22 14:58:19 UTC
Created attachment 163411 [details]
A collection of ideas, how to get MS gradient style to ODF

The document contains some ideas how to get OOXML gradients to ODF. Currently their gradients are not compatible.
The mentioned element fillToRect is in section 20.1.8.31 and tileRect is in section 20.1.8.59 in standard ISO/IEC 29500-1:2016(E).
Comment 9 Tünde Tóth 2020-07-23 07:56:27 UTC
Created attachment 163435 [details]
MSO and LO blending
Comment 10 Regina Henschel 2020-07-23 11:42:04 UTC
Created attachment 163447 [details]
Blending examples with screenshot

Blending in MS Office depends on gradient stop position.

The 6cm-square on the left side has stop position 0% and 100%.

The 8cm-square on the left side has stop position 0% and 75%, which results in gradient fill area of 6cm x 6cm.

On the right side are screenshots of the 6cm-square and of the 8cm-square. I have cropped the 6cm-screenshot to eliminate the white margins.

When you drag the 6cm-screenshot over the 8cm-screenshot you can directly see, that the blending is different.
Comment 11 Regina Henschel 2020-07-25 09:30:03 UTC
Created attachment 163513 [details]
Blending quadratic vs linear

MS Office uses linear blending too in the other kind of gradients, if a outer gradient stop is not at 0% or 100% respectively. The attached file has in the upper row the yellow gradient stop at 0% and in the lower row at 1%. It is obvious, that the blending methods are different.

Therefore I suggest to use a property "blending algorithm" independent from the form of the gradient. So you would need two properties, one for the form of the gradient and the other for the blending algorithm.
Comment 12 Regina Henschel 2020-08-07 12:42:48 UTC
FYI: The position of the gradient is determined by fillToRect and tileRect. The implementation in MS Office differs from OOXML standard. 

I have ask on https://social.msdn.microsoft.com/Forums/office/en-US/09a12c17-e87e-4992-b815-36be28ac5ec2/filltorect-relative-to-tilerect-or-to-bounding-box?forum=os_binaryfile about that. The answer, "Thank you for noticing the differences, this is considered as designed. Hence, there will be no change to ISO 29500, MS-OI29500, and PowerPoint for this particular scenario."

Which would mean for LibreOffice to follow MS Office and not the standard.