Bug Hunting Session
Bug 122110 - FILESAVE XLSX, One of the cell changes its textcolor to blue for no apparent reason.
Summary: FILESAVE XLSX, One of the cell changes its textcolor to blue for no apparent ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:6.4.0 target:6.3.2 target:6.2.7
Keywords: filter:xlsx
Depends on:
Blocks: Calc-Styles
  Show dependency treegraph
 
Reported: 2018-12-14 13:19 UTC by NISZ LibreOffice Team
Modified: 2019-08-21 09:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The original document. (18.78 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-12-14 13:21 UTC, NISZ LibreOffice Team
Details
The saved document (19.90 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-12-14 13:37 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Calc. (337.90 KB, image/png)
2018-12-14 13:38 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2018-12-14 13:19:43 UTC
Description:
When the attached document gets saved in LO one of the cells (G19) changes its textcolor to blue.


Steps to Reproduce:
    1. Open the attached document in LO.
    2. Save it as xlsx.
    3. Reload

Actual Results:
G19’s text color is blue.

Expected Results:
It should stay as black.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 NISZ LibreOffice Team 2018-12-14 13:21:09 UTC
Created attachment 147556 [details]
The original document.
Comment 2 NISZ LibreOffice Team 2018-12-14 13:37:46 UTC
Created attachment 147557 [details]
The saved document
Comment 3 NISZ LibreOffice Team 2018-12-14 13:38:07 UTC
Created attachment 147558 [details]
Screenshot of the original and exported document side by side in Calc.
Comment 4 Durgapriyanka 2018-12-14 19:43:20 UTC
Thank you for reporting the bug. I can not reproduce the bug in

Version: 6.3.0.0.alpha0+
Build ID: 3c964980da07892a02d5ac721d80558c459532d0
CPU threads: 2; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-12-12_02:07:45
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 5 Roman Kuznetsov 2018-12-15 10:22:19 UTC
confirm in

Версия: 6.1.2.1
ID сборки: 65905a128db06ba48db947242809d14d3f9a93fe
Потоков ЦП: 4; ОС:Windows 6.1; Отрисовка ИП: по умолчанию; 
Локаль: ru-RU (ru_RU); Calc: group threaded

and in

Version: 6.3.0.0.alpha0+
Build ID: 3c964980da07892a02d5ac721d80558c459532d0
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-12-12_02:07:45
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded

font color in G19 changes from black to blue after resave to xlsx format

File has some conditional formatting, but G19 isn't in any range for CF.
Comment 6 Xisco Faulí 2018-12-18 17:23:40 UTC
Also reproduced in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 7 Bartosz 2019-01-23 10:22:10 UTC
For this cell in original xlsx file, there is following "Format Code":

  [RED][<=0.9]#,#%;[BLUE][>1.1]#,#%;#,#%

After exporting with LibreOffice, the "Format Code" was changed to:
   
  [<=0][RED]#,#%;[>0][BLUE]#,#%;#,#%
Comment 8 Xisco Faulí 2019-04-30 10:05:51 UTC
Dear Bartosz,
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assigned it back to yourself if you're still working on this.
Comment 9 Bartosz 2019-06-01 13:54:23 UTC
The source code responsible for exporting "numFmt":
        <numFmt numFmtId="165" formatCode="[Red][&lt;=0.9]#.#%;[Blue][&gt;1.1]#.#%;#.#%"/>

is available at sc/source/filter/excel/xestyle.cxx:

    rStyleSheet->singleElement( XML_numFmt,
            XML_numFmtId,   OString::number( mnXclNumFmt ).getStr(),
            XML_formatCode, OUStringToOString(maNumFmtString, RTL_TEXTENCODING_UTF8).getStr(),
            FSEND );

And the set of "maNumFmtString" string is in:
    pNumFormat.reset(new XclExpNumFmt( nScNumFmt, nXclNumFmt, GetNumberFormatCode( *this, nScNumFmt, xFormatter.get(), mpKeywordTable.get() )));

So the interesting method for check is: SvNumberFormatter::GetFormatStringForExcel
in svl/source/numbers/zforlist.cxx file.
Comment 10 Eike Rathke 2019-08-20 11:41:11 UTC
Actually not the export is wrong, but the import is, resulting in

  [RED][<=0.9]#,#%;[BLUE][>1.1]#,#%;#,#%

with mixed decimal separators in a locale that uses the ',' comma decimal separator, for example ru-RU or de-DE.
Comment 11 Eike Rathke 2019-08-20 15:47:45 UTC
I'm familiar with the code in question and take over.
Comment 12 Commit Notification 2019-08-20 18:39:12 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/152c4fcbf1aa5b7454834581927056cfc9d1d7e5%5E%21

Resolves: tdf#122110 convert condition decimal separator to target locale

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.
Comment 13 Eike Rathke 2019-08-20 18:39:59 UTC
Pending review
https://gerrit.libreoffice.org/77858 for 6-3
https://gerrit.libreoffice.org/77859 for 6-2
Comment 14 Xisco Faulí 2019-08-21 09:48:58 UTC
Verified in

Version: 6.4.0.0.alpha0+
Build ID: 2bed8af91fc2654b9ed2432f969d32d5741a529b
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Eike, thanks for fixing this issue!!
Comment 15 Commit Notification 2019-08-21 09:51:38 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/5f7e50ec1583e8b0a3fa916c1e2f41cbd544ff07%5E%21

Resolves: tdf#122110 convert condition decimal separator to target locale

It will be available in 6.3.2.

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.
Comment 16 Commit Notification 2019-08-21 09:51:48 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/a96b0e2f7d4e3d4b981fbe1b7902bc42af967f0e%5E%21

Resolves: tdf#122110 convert condition decimal separator to target locale

It will be available in 6.2.7.

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.