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
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.
Similar looks as in Word.
User Profile Reset: No
Version: 220.127.116.11.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
Created attachment 155803 [details]
Example file from Writer
Created attachment 155804 [details]
The original file saved by Writer
Created attachment 155805 [details]
Screenshot of the original document side by side in Word and Writer
Created attachment 155806 [details]
Screenshot of the exported document side by side in Word and Writer
Thank you for reporting the bug. I can confirm the bug present in
Version: 18.104.22.168.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
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.
@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?
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 22.214.171.124 and tileRect is in section 126.96.36.199 in standard ISO/IEC 29500-1:2016(E).
Created attachment 163435 [details]
MSO and LO blending
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.
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.
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.