Bug 134385 - FILESAVE DOCX Don’t add space between paragraphs of the same style not overridden
Summary: FILESAVE DOCX Don’t add space between paragraphs of the same style not overri...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2020-06-29 10:25 UTC by NISZ LibreOffice Team
Modified: 2021-06-10 10:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word (11.82 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-06-29 10:25 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer (114.94 KB, image/png)
2020-06-29 10:25 UTC, NISZ LibreOffice Team
Details
The original file saved by Writer (9.41 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-06-29 10:26 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Word (89.90 KB, image/png)
2020-06-29 10:26 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 2020-06-29 10:25:16 UTC
Created attachment 162495 [details]
Example file from Word

Attached file contains a few paragraphs formatted with List Paragraph style in Word.
This style has the “Don’t add space between paragraphs of the same style” setting turned on.
One of the paragraphs overrides this setting with direct formatting, which is imported correctly in Writer.
Saving to DOCX however loses this override.

Steps to reproduce:
    1. Open attached document and save as DOCX

Actual results:
Paragraph3 loses its direct format setting of “Don’t add space between paragraphs of the same style” being OFF.

Expected results:
Direct formatting setting retained.

LibreOffice details:
Version: 7.1.0.0.alpha0+ (x86)
Build ID: 8ed11b7289533bd609fbcb2adfb7b2982ef6fe22
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Also happens in:
Verzió: 6.0.0.3
Build az.: 64a0f66915f38c6217de274f0aa8e15618924765
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: alapértelmezett; 
Területi beállítások: hu-HU (hu_HU); Calc: CL

Version: 5.0.0.5
Build ID: 1b1a90865e348b492231e1c451437d7a15bb262b
Locale: hu-HU (hu_HU)

Verzió: 4.2.0.4
Build az.: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

But not in:
Verzió: 4.1.0.4
Build az.: 89ea49ddacd9aa532507cbf852f2bb22b1ace28
Comment 1 NISZ LibreOffice Team 2020-06-29 10:25:59 UTC
Created attachment 162496 [details]
Screenshot of the original document side by side in Word and Writer
Comment 2 NISZ LibreOffice Team 2020-06-29 10:26:19 UTC
Created attachment 162497 [details]
The original file saved by Writer
Comment 3 NISZ LibreOffice Team 2020-06-29 10:26:38 UTC
Created attachment 162498 [details]
Screenshot of the original and exported document side by side in Word
Comment 4 Xisco Faulí 2020-07-14 10:30:53 UTC
Reproduced in

Version: 7.1.0.0.alpha0+
Build ID: fa844c15233f108a0e9b0b2e8c9757c1aa088a4b
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 5 Justin L 2021-03-24 09:41:43 UTC
repro 7.2.   Also true for .doc and .rtf formats.

I bibisected this to 6.0 IMPORT patch:
commit f8b5ecc622e2b3e82576b27bf0ded9c8eac21cae
Author: Miklos Vajna on Oct 24 09:27:19 2017 +0200
    tdf#113202 RTF import: fix lack of expected contextual spacing

HOWEVER, I wasn't comparing with MS Word. MS Word 2016 also does display any spacing. So actually this 6.0 bibisect is a fix.

So, if I bibisect using MS Word 2016 as the verifier, then I confirm NISZ's conclusion that it was in broken at LO 4.2 with:
commit 33e97347ac5b1a3206ddcc2c8313c7e88461bb0b
Author:     Jan Holesovsky on Oct 9 14:39:35 2013 +0200
     DOCX export: Write contextualSpacing only if it takes place.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=33e97347ac5b1a3206ddcc2c8313c7e88461bb0b

So the fix here will be to see if it inherits contextualspacing == true, and in that case write out a false. (see https://gerrit.libreoffice.org/c/core/+/106315 for a similar case for character properties.)


P.S. At this point, MSWord shows RTF with no spacing - same as with 7.2.
However, DOC has spacing between every single one of the first five paragraphs (which was mysteriously fixed shortly thereafter in the range https://cgit.freedesktop.org/libreoffice/core/log/?id=33e97347ac5b1a3206ddcc2c8313c7e88461bb0b&qt=range&q=ff3b823ef4b867263711703fab596584314e4f58..fdba797bd9c2a3fe4de82f92c3ee815c15f8ac84)
Comment 6 Justin L 2021-03-24 16:32:42 UTC
RTF has "\contextualspace", but no negation of that. So I don't think it is possible to cancel in RTF.  (In MS Word, it removes \contextualspace from the string of formatting in front of Paragraph3.)

Proposed fix at https://gerrit.libreoffice.org/c/core/+/113064
Comment 7 Commit Notification 2021-03-31 07:09:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5c90f3d28de6262bb730bad106d4652e458054df

tdf#134385 doc/docxexport: maybe export false contextualspacing

It will be available in 7.2.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 8 NISZ LibreOffice Team 2021-06-10 10:19:26 UTC
Verified in:
Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: aa9cb8e14749e7fb7a83b55a2bb095501f731a18
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded