Bug 116179 - FILEOPEN Automatic font colour is very dark blue when imported from Writer created DOCX
Summary: FILEOPEN Automatic font colour is very dark blue when imported from Writer cr...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.0.6.2 release
Hardware: All All
: medium normal
Assignee: Luke Deller
URL:
Whiteboard: target:6.1.0 target:6.0.4
Keywords: filter:docx
Depends on:
Blocks: DOCX
  Show dependency treegraph
 
Reported: 2018-03-04 12:43 UTC by Luke Deller
Modified: 2018-04-21 03:44 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Hello World DOCX (3.98 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-03-06 11:20 UTC, Luke Deller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Deller 2018-03-04 12:43:50 UTC
Description:
Automatic font colour is imported from DOCX as very dark blue (0x0A) rather than automatic.

Steps to Reproduce:
1. Create a new Text Document in LibreOffice
2. Type some text, such as "Hello World"
3. Confirm that the font colour is set to "Automatic" via "Format" menu -> "Character..." -> "Font Effects" tab -> "Font Color"
4. Save as a docx file, close, reopen
5. Now check the font colour again

Actual Results:  
The font colour is very dark blue (#00000A)

Expected Results:
The font colour should be still set to Automatic


Reproducible: Always


User Profile Reset: No



Additional Info:
Tested in 5.1.6.2, 6.0.1.1, and master.
(It is a bit harder to verify in 5.1.6.2 because the RGB value is not shown in the UI at step 5, instead it just shows the colour as "User"; but saving as ODT I can see that colour is indeed #00000A)


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
Comment 1 Xisco Faulí 2018-03-05 16:54:37 UTC Comment hidden (obsolete)
Comment 2 Luke Deller 2018-03-06 11:20:22 UTC
Created attachment 140378 [details]
Hello World DOCX

Added a document created using the steps above
(created using LibreOffice 6.0.2.1 on Ubuntu 16.04)
Comment 3 Timur 2018-03-06 12:38:05 UTC
Confirmed on RT when imported from Writer created DOCX. 
Word created DOCX imports fine in Writer. Writer created DOCX imports fine in Word.
Comment 4 Luke Deller 2018-03-08 10:35:05 UTC
I think the problem comes from this element in word/styles.xml within the docx:

<w:color w:val="auto"/>

LibreOffice unfortunately tries to parse "auto" as a hexadecimal number.  It stops at the letter 'u' which is not a valid hex digit, so we have only "a" -> 0x0000000A

Interpreted as an RGB value, this is very dark blue (#00000A), so very dark that nobody noticed it was not black :-)

When using Microsoft Word to create a similar file, the colour of the normal paragraph style is not explicitly specified in word/styles.xml, so LibreOffice does not encounter this problem.

I can reproduce the same issue way back in LibreOffice 4.0.6.2
Comment 5 Commit Notification 2018-03-13 13:07:15 UTC
Luke Deller committed a patch related to this issue.
It has been pushed to "master":

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

tdf#116179 Support reading "auto" colour from docx

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 6 Timur 2018-03-14 08:24:07 UTC
OK, I confirm the fix with master. 
Please see about backport to 6.0.

Since I see you have a number of (interop) fixes, can I ask you to see other bugs with automatic color, mostly Impress: Bug 98311, Bug 94122, Bug 60316.
Comment 7 Commit Notification 2018-03-20 09:06:20 UTC
Luke Deller committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

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

tdf#116179 Support reading "auto" colour from docx

It will be available in 6.0.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 8 Xisco Faulí 2018-04-20 09:24:43 UTC
A polite ping to Luke Deller: is this bug fixed? if so, could you
please close it as RESOLVED FIXED ? Thanks