Bug 113271 - FILEOPEN: XLSX: Incorrect font colour
Summary: FILEOPEN: XLSX: Incorrect font colour
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Bartosz
URL:
Whiteboard: target:6.1.0 target:5.4.4 target:6.0....
Keywords: filter:xlsx
Depends on:
Blocks: OOXML-Doc-Themes
  Show dependency treegraph
 
Reported: 2017-10-19 15:48 UTC by Dave Richards
Modified: 2021-03-15 20:47 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
File that will not open in Calc (22.30 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-10-19 15:48 UTC, Dave Richards
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Richards 2017-10-19 15:48:29 UTC
Created attachment 137121 [details]
File that will not open in Calc

We are receiving these documents, and they will not display correctly in LibreOffice Calc.  It's missing much of the information.

File opens with Microsoft Office 2016

File did not open LO-5.4/Linux, LO-6.0/Linux, LO-5.4/Windows.
Comment 1 Xisco Faulí 2017-10-19 16:20:18 UTC
Actually the content is there, but the font colour is incorrect. If you copy the sheet to a new one and you change the background or the font colour, you will see the content.

Reproduced in

Version: 6.0.0.0.alpha0+
Build ID: cfbb8b5090537e79ba70e250ddee86d53facbe15
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

and back to

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 2 Bartosz 2017-11-24 22:23:51 UTC
The wrong colour information is inside the file:
xl/styles.xml file.

The wrong code which is causing this issue is:

    <fonts count="3" x14ac:knownFonts="1">
        <font>
            <sz val="11"/>
            <color theme="1" rgb="FFFFFF"/>
            <name val="Calibri"/>
            <family val="2"/>
            <scheme val="minor"/>
        </font>

Generally rgb="FFFFFF" colour could be for background, but I need to confirm.

The colours with themes are inside file:
xl/theme/theme1.xml
Comment 4 Bartosz 2017-11-25 00:21:13 UTC
Import of font attributes is inside the file sc/source/filter/oox/stylesbuffer.cxx inside method "void Font::importAttribs(". We need to make sure that "color" is used properly according to design (which is Data Bar Color):
http://www.contextures.com/excel-conditional-formatting-data-bars.html
Comment 5 Bartosz 2017-11-25 00:29:18 UTC
Generally both rgb="FFFFFF" and rgb="000000", MS Excel is interpreting as Black colour.
I think this is the main difference between LO and MS Excel.
Comment 7 Bartosz 2017-11-25 01:18:59 UTC
I understand what is the root cause of problem.
If both rgb and theme is specified, like:
<color theme="1" rgb="FFFFFF"/>

Then the "theme" should be taken into account instead of rgb
Comment 8 Bartosz 2017-11-25 01:50:31 UTC
With indexed colour, rgb and them, 
<color theme="1" rgb="FFFFFF" indexed="62" />

The priority is as follows:
1. theme
2. rgb
3. indexed
Comment 9 Bartosz 2017-11-26 00:27:36 UTC
Review: 
https://gerrit.libreoffice.org/#/c/45279/
Comment 10 Commit Notification 2017-11-28 18:49:17 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=51a1fb0beb813624b5bc3255a889f9d630ccb0d4

tdf#113271 Fix order of color's attributes import.

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2017-11-28 18:49:27 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3278c8f9bb040cddd15d9e7eb4991d0447cbc964&h=libreoffice-5-4

tdf#113271 Fix order of color's attributes import.

It will be available in 5.4.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2017-11-30 12:46:37 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5930033f050e933a134a1ff11974b8601d8a7f9a&h=libreoffice-6-0

tdf#113271 Fix order of color's attributes import.

It will be available in 6.0.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2021-03-15 20:47:46 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/034fa64b2becaf1b1eefa0a24d52808f30ce7c12

tdf#113271: sc_subsequent_export: Add unittest

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