Description: Saving to an .ods file appears to corrupt the directly formatted text in a cell. Specifically, if a cell has a style with a dark background color (e.g. red) and the cell is directly formatted with the following, the text will be rendered as white even though the background of the cell is white: - Text color for the cell is directly formatted to "automatic" - Background color for the cell is directly formatted to "no fill" Steps to Reproduce: 1. Open a new Calc spreadsheet 2. Select cell A1 and enter some text 3. Select the Styles > Error menu item. This well change the cell's background color to red and the text color to white. 3. Using the Font Color toolbar button, set the text color to "Automatic" and using the Background Color toolbar button, set the background color to "No Fill". This will change the cell's background color to transparent and the automatic text color will render as black. 4. Save Calc spreadsheet as an .ods file and then immediately save as an .xlsx. 5. Close Calc spreadsheet. Actual Results: When the .ods file is opened, the cell is correctly rendered with a white background but the text is incorrectly rendered as white instead of black. When the .xlsx file is opened, the cell is correctly rendered with black text on a white background. Expected Results: The cell in the .ods file should be rendered like the cell in the .xlsx file with black text on a white background. Reproducible: Always User Profile Reset: Yes Additional Info: Not sure when this bug started occurring but it occurs as far back as LibreOffice 7.5.7.1 but does not occur in OpenOffice 4.1.14 or NeoOffice 2022.7 (i.e. LibreOffice 4.4). My first guess is that the bug occurs when saving and .ods file since the same bug occurs when opening the .ods file in Microsoft Excel.
Created attachment 190044 [details] Screen snapshot of .ods file after saving new spreadsheet and reopening it
Created attachment 190045 [details] Screen snapshot of .xlsx file after saving new spreadsheet and reopening it
Created attachment 190046 [details] Saved .ods file
Created attachment 190047 [details] Saved .xlsx file
Note for myself: I found that the cell's ATTR_BACKGROUND gets set differently depending on whether you are opening the .ods or the .xlsx files attached to this bug. Next step: find where ATTR_BACKGROUND is set during loading of the document: diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 7638652e6857..87383ec29398 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -472,6 +472,10 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS } else { + // tdf#157618 when opening the .ods file, ATTR_BACKGROUND is set + // to the Error style's red background color whereas opening the + // .xlsx file, ATTR_BACKGROUND is set to the cell's directly + // formatted transparent background color. aBackColor = rItemSet.Get(ATTR_BACKGROUND).GetColor(); }
Unrelated for this issue, just for completeness. Resolved the contrast issues from bug 156182 with https://gerrit.libreoffice.org/c/core/+/158024 (new contrast applies to all colors but Light Blue 2 aka Tango Sky, which is the default for object background).
Thanks Patrick. Reproduced on Linux with: Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: b83f069101f1e6d8aaac09a805f02bbc4c619e7a CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded
The black color is lost also in Version: 7.1.0.0.alpha0+ Build ID: abcc4eb907661e07ad850ccce7eb06f129da4286 CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded I don't have older versions.
Reproduced in: Version: 5.4.0.0.alpha1 (x64) Build ID: 0b9f9bef65bb21ebb6a64aafad448f7f62dc824a CPU threads: 6; OS: Windows 6.19; UI render: default; Locale: en-US (en_US); Calc: CL Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 676e0527d2f31556eccae314fbb12ce204f02ec7 CPU threads: 6; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL threaded ----------------- NOT reproduced in: Version 4.0.0.0.beta1 (Build ID: 87906242e87d3ddb2ba9827818f2d1416d80cc7)
bibisected with linux-41max repo and got the following results: 7019e8654514116303a57895f660b5f3a39f364f is the first bad commit commit 7019e8654514116303a57895f660b5f3a39f364f Author: Matthew Francis <mjay.francis@gmail.com> Date: Fri Sep 18 10:43:03 2015 +0800 source-hash-77e21bb36a2cdaaa0f4049dee0d45c5b2325c6e9 commit 77e21bb36a2cdaaa0f4049dee0d45c5b2325c6e9 Author: Luke Deller <luke@deller.id.au> AuthorDate: Sat Mar 9 01:26:56 2013 +1100 Commit: Fridrich Strba <fridrich@documentfoundation.org> CommitDate: Mon Mar 11 14:54:57 2013 +0000 2601: Change definition of "dark" colour for fdo#61993 | https://gerrit.libreoffice.org/c/core/+/2601 I don't know if Luke is still contributing but I'll add Cc anyways