Bug 116549 - FILESAVE export to DOCX does not write border style "none"
Summary: FILESAVE export to DOCX does not write border style "none"
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Paragraph Borders
  Show dependency treegraph
 
Reported: 2018-03-21 19:44 UTC by Regina Henschel
Modified: 2018-08-10 14:09 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Document to test border (16.66 KB, application/vnd.oasis.opendocument.text)
2018-03-21 19:44 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2018-03-21 19:44:20 UTC
Created attachment 140798 [details]
Document to test border

Open attached file. The paragraphs have paragraph styles assigned, which are all based on the style "BorderBasis", which sets a 6pt orange, solid border. The style "Border0none" sets the border style to "none". That is correctly written in ODF as fo:border="none".

Save this file in .docx format, it does not matter whether strict OOXML or the MS variant. It should write a w:pBdr element with child elements having attribute w:val="none", but the w:pBdr element is empty.

Because the parent style has a border, it is necessary to set the border style explicitly to "none".

You see the error, when you open the .docx file in Word or LibreOffice. The paragraph 0 shows a border, but should not.
Comment 1 Jacques Guilleron 2018-03-22 16:41:01 UTC
Hi Regina,

I reproduce with
LO 6.1.0.0.alpha0+ Build ID: dd4f1b1bd31daf080dc0420524712dc244e539b5
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-03-20_23:26:38
Locale: en-US (fr_FR); Calc: CL
See also the error in Word 2010.
Comment 2 Xisco Faulí 2018-03-23 09:38:04 UTC
Also reproduced in

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Comment 3 Justin L 2018-08-10 05:22:54 UTC
proposed fix: https://gerrit.libreoffice.org/#/c/58803/

The existing code used "nil" instead of "none". Documentation indicates these two are identical, so I didn't attempt to change anything in that regard.
"nil" (No Border) Specifies that no border shall be applied to the current
item.
"none" (No Border) Specifies that no border shall be applied to the current
item.

Spot checks in existing unit tests provided several proof examples and tableCurrupt.docx's header was a nice visual proof.
There are no existing tests where (|| !rStyleProps->LineWidth) affects the other uses of impl_border, but almost every document shows it is definitely needed for paragraphs/styles to prevent peppering the document with "nil" borders.
Comment 4 Commit Notification 2018-08-10 10:19:40 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#116549 docx export: write "nil" to uninherit a border

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.