Bug 117297 - FILEOPEN: DOCX: table style properties are being ignored
Summary: FILEOPEN: DOCX: table style properties are being ignored
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords:
: 84680 (view as bug list)
Depends on:
Blocks: Writer-Tables-Style
  Show dependency treegraph
 
Reported: 2018-04-27 18:19 UTC by Justin L
Modified: 2019-09-18 08:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
TableGrid table style.docx: example document created in Word 2013 (11.99 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-04-27 18:19 UTC, Justin L
Details
TableGrid table style.pdf: exported from Word 2013 (90.73 KB, application/pdf)
2018-04-27 18:20 UTC, Justin L
Details
117297_debugging.diff: debugging patch with fix ideas. Use with SW_DEBUG_WRITERFILTER=1 (11.53 KB, patch)
2018-04-27 19:01 UTC, Justin L
Details
fdo80800b.docx: document that shows DEFAULT_VALUE when DIRECT_VALUE expected (11.67 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-04-30 13:25 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2018-04-27 18:19:07 UTC
Created attachment 141721 [details]
TableGrid table style.docx: example document created in Word 2013

There are several examples of the same problem being exhibited in this document. The problem area is the second table-column.
-The green text paragraph should be size 9, but is actually size 11.
-The TableGrid paragraph also is size 11, is black instead of blue, and the spacing is 108% instead of double.

The main problem is in sw/source/core/unocore/unotext.cxx:lcl_ApplyCellProperties
   if (state == beans::PropertyState_DEFAULT_VALUE)
   then apply table-style/cell properties

In these cases, state = AMBIGUOUS_VALUE, so the TableGrid properties are not applied, and the system defaults (size 11, 108% spacing, black color) are used instead.

Table styles are a relatively new feature, no regression here. Things starting looking decent in 4.1 and 4.2. Bug 80800 (4.4) dealt with a similar problem - focusing only on LINE_SPACING.
Comment 1 Justin L 2018-04-27 18:20:55 UTC
Created attachment 141722 [details]
TableGrid table style.pdf: exported from Word 2013
Comment 2 Justin L 2018-04-27 19:01:49 UTC
Created attachment 141724 [details]
117297_debugging.diff: debugging patch with fix ideas. Use with SW_DEBUG_WRITERFILTER=1

My biggest failure is not correctly enumerating the paragraphs and getting proper DIRECT/DEFAULT values for the various character and paragraph properties.
Comment 3 Justin L 2018-04-28 04:35:49 UTC
No really a bug - just a missing "emulation" where table styles properties are not converted into paragraph properties (which isn't a great solution anyway).
Comment 4 Justin L 2018-04-30 13:25:41 UTC
Created attachment 141780 [details]
fdo80800b.docx: document that shows DEFAULT_VALUE when DIRECT_VALUE expected

This document proves that my fix is inadequate. Even though the text in Cell1 has directly applied properties of 150% spacing, xCellTextProp reports state == DEFAULT_VALUE. However, if you enumerate the paragraph instead, then it reports DIRECT_VALUE.

(In my debugging patch, the ambiguous section enumerates the paragraphs. Could this ALWAYS be used, not just when ambiguous? But that only works for paragraph attrs, not IsCHRATR.)
Comment 5 Justin L 2018-05-19 14:51:31 UTC
proposed fix (for 6.2 branch) at https://gerrit.libreoffice.org/54511
Comment 6 Commit Notification 2018-05-25 07:15:26 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#117297 sw unotbl XCell: apply char/para style props to text

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 7 Justin L 2018-05-25 07:38:07 UTC
This is actually in 6.2. No intention to backport.
Comment 8 Luke 2018-07-20 05:01:48 UTC
*** Bug 84680 has been marked as a duplicate of this bug. ***