Bug 116436 - FILEOPEN DOC(X): background color of a table row disappears
Summary: FILEOPEN DOC(X): background color of a table row disappears
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.2.0 target:6.1.2
Keywords:
Depends on:
Blocks: DOCX-Tables DOC-Tables Writer-Table-Properties-Dialog
  Show dependency treegraph
 
Reported: 2018-03-16 20:02 UTC by haim kilov
Modified: 2018-09-20 15:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
tableBackground_cellsUndefined.docx: in MS Word, although table shd=blue, undefined cells are white (4.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-08-17 11:24 UTC, Justin L
Details
RowBackground.odt: row defines the fill color (8.67 KB, application/vnd.oasis.opendocument.text)
2018-08-17 12:22 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description haim kilov 2018-03-16 20:02:36 UTC
Background color of a table row disappears after saving as docx.

Steps to reproduce:
1. Create the following file:
A line
[a two-row and two-column table with any contents]
Another line

2. Highlight the top row; Table->properties->background->row --> use any background color (I used red)
3. Save as docx
4. Reopen the same file

Result: The background color disappears
Expected result: the background color is preserved.
Comment 1 Dieter 2018-03-17 05:57:40 UTC
I confirm it with

Version: 6.1.0.0.alpha0+ (x64)
Build ID: d64ce643275e0b2b0dea9e532fc261391dc8793c
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-03-01_03:24:30
Locale: de-DE (de_DE); Calc: CL

additional information:
the same problem occurs if you choose background => table
the backround persists, if you choose background => cell
Comment 2 haim kilov 2018-03-26 04:17:21 UTC
After saving as .doc the background color is preserved.
Comment 3 haim kilov 2018-06-24 02:17:35 UTC
After saving as .doc the background color is not preserved anymore!
LO 6.0.3.2, Mac 10.9.5
Comment 4 Dieter 2018-06-24 09:27:33 UTC
(In reply to haim kilov from comment #3)
> After saving as .doc the background color is not preserved anymore!
> LO 6.0.3.2, Mac 10.9.5

I confirm it with

Version: 6.1.0.0.beta2 (x64)
Build ID: 0f4d2060bc90b4008fbc8e6d9a49ec7eeea60b78
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
Locale: en-US (de_DE); Calc: CL
Comment 5 Regina Henschel 2018-08-14 17:48:29 UTC
The docx format is not able to store the information "color of a row". So this is not our bug. The docx format has only "color of cell" and "color of entire table". 

Solution for you: Select the row and then from the background tab do not select the item "row" but use the item "cell".

I can confirm that LibreOffice handles "color for table" wrongly in OOXML export. It should write the element nesting tbl -> tblPr -> shd. It is not a "fileopen" bug. I suggest, to change the subject accordingly.
Comment 6 Justin L 2018-08-17 11:24:08 UTC
Created attachment 144250 [details]
tableBackground_cellsUndefined.docx: in MS Word, although table shd=blue, undefined cells are white

> I can confirm that LibreOffice handles "color for table" wrongly in OOXML
> export. It should write the element nesting tbl -> tblPr -> shd.
Interestingly, MSWord almost completely ignores this value. If shd is not defined on the cell, then it becomes white regardless of the overall table color (tested with Word 2010 and 2003).

So, actually LO doesn't handle this import compatibly, because it takes the table setting and uses it as the default.
Comment 7 Justin L 2018-08-17 11:43:17 UTC
proposed fix: https://gerrit.libreoffice.org/59260 tdf#116436 docx export: add missing table background fill

I hope to also work on .doc export, and perhaps look at the import compatibility.
Comment 8 haim kilov 2018-08-17 11:52:00 UTC
After saving as .doc the background color is preserved!
Comment 9 Justin L 2018-08-17 12:22:36 UTC
Created attachment 144251 [details]
RowBackground.odt: row defines the fill color

(In reply to haim kilov from comment #8)
> After saving as .doc the background color is preserved!

Not with my test documents, for either the table or the row.  I'm attaching the one for the row (since my first suggested patch doesn't handle this yet.)
Comment 10 Regina Henschel 2018-08-17 12:36:38 UTC
(In reply to Justin L from comment #6)
> Created attachment 144250 [details]
> tableBackground_cellsUndefined.docx: in MS Word, although table shd=blue,
> undefined cells are white
> 
> > I can confirm that LibreOffice handles "color for table" wrongly in OOXML
> > export. It should write the element nesting tbl -> tblPr -> shd.
> Interestingly, MSWord almost completely ignores this value. If shd is not
> defined on the cell, then it becomes white regardless of the overall table
> color (tested with Word 2010 and 2003).

Yes you are right. The attribute is written by Word, but not read, tested in Word 365.
Comment 11 haim kilov 2018-08-17 16:27:22 UTC
In reply to Justin L from comment #9:

I stand corrected. Sorry. 

As far as I recall, the background color for a row was preserved earlier when saved as .doc, but in LO 6.0.5.2 it is not preserved anymore.
Comment 12 Justin L 2018-08-18 08:52:26 UTC
(In reply to Justin L from comment #9)
> (since my first suggested patch doesn't handle this yet.)
The patch is updated to handle rows.  A couple of additional patches do the same for DOC and RTF format.

https://gerrit.libreoffice.org/59281 tdf#116436 doc export: add missing table background fill
https://gerrit.libreoffice.org/59282 tdf#116436 rtf export: add missing table background fill
Comment 13 Commit Notification 2018-08-18 11:02:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#116436 docx export: add missing table background fill

It will be available in 6.2.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 14 Commit Notification 2018-08-18 11:09:58 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#116436 doc export: add missing table background fill

It will be available in 6.2.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 15 Justin L 2018-08-18 11:22:52 UTC
(In reply to haim kilov from comment #11)
> As far as I recall, the background color for a row was preserved earlier
> when saved as .doc, but in LO 6.0.5.2 it is not preserved anymore.
I used bibisect to spot-check 5.2, 5.3, and 5.4. They all failed my test document. If you happen to run across a document where you see it was working, I would love to analyse that.

Requesting to backport the patches to LO 6.1.
Comment 16 Commit Notification 2018-08-27 15:53:45 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#116436 rtf export: add missing table background fill

It will be available in 6.2.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 17 Commit Notification 2018-08-28 16:29:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=029951e6d3636d99b370568313b8b5c2da8b452d&h=libreoffice-6-1

tdf#116436 doc export: add missing table background fill

It will be available in 6.1.2.

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 18 Commit Notification 2018-08-28 16:30:41 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e7d3e0b101ff25bb7edd49df61e330ccb4b75a24&h=libreoffice-6-1

tdf#116436 docx export: add missing table background fill

It will be available in 6.1.2.

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 19 Commit Notification 2018-08-31 07:55:43 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3d81af669ea0886fb16282d29048f08025ace344&h=libreoffice-6-1

tdf#116436 rtf export: add missing table background fill

It will be available in 6.1.2.

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 20 BogdanB 2018-09-20 15:18:31 UTC
it's ok. I also tried with red background. Red is preserved when saved as docx.

tested on linux
Version: 6.2.0.0.alpha0+
Build ID: e005ab5d40d358adb75a64e140d46f4bf605647d
CPU threads: 4; OS: Linux 4.15; UI render: GL; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2018-09-15_02:08:38
Locale: ro-RO (ro_RO.UTF-8); Calc: threaded