Bug 98700 - FILESAVE: toggled "keep with next paragraph" <w:keepNext/> incorrectly set when saving as DOCX
Summary: FILESAVE: toggled "keep with next paragraph" <w:keepNext/> incorrectly set wh...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
3.4 all versions
Hardware: All All
: medium normal
Assignee: Justin L
QA Contact:
URL: https://ask.libreoffice.org/en/questi...
Whiteboard: target:6.0.0 target:5.4.2 target:5.3.6
Keywords: filter:docx
: 97676 106657 (view as bug list)
Depends on:
Blocks: DOCX-Styles
  Show dependency treegraph
 
Reported: 2016-03-16 04:22 UTC by Kevin Suo
Modified: 2017-08-22 03:06 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test ODT file (13.78 KB, application/vnd.oasis.opendocument.text)
2016-03-16 04:22 UTC, Kevin Suo
Details
screenshots in pdf (90.11 KB, application/pdf)
2016-03-16 04:38 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2016-03-16 04:22:40 UTC
Created attachment 123614 [details]
Test ODT file

The attached ODT file has "keep with next paragraph" option *off* for paragraph "BBBBBBBBBBBBBB". When save as DOCX, this option is turned on unexpectly.

Steps to reproduce:
1. Open the attached ODT file. Obseave that the paragraph "BBBBBBBBBBBBBB" has "keep with next paragraph" option turned off (Format - Paragraph - Text Flow - Keep with next paragraph" unchecked).
2. Save as DOCX.
3. Unzip the DOCX file, obseave the following:
   (1) In word/document.xml there is <w:pStyle w:val="1"/> tag for paragraph ""BBBBBBBBBBBBBB", which means this paragraph is using Style ID 1.
   (2) In word/style.xml, we find the style with ID I: <w:style w:styleId="1" w:type="paragraph">. Observe that there is a <w:keepNext/> option in this style. (here is the bug).

Current Behaviour:
There is a <w:keepNext/> for w:styleId="1" in step 3(2). 
This causes the paragraph to "keep with next paragraph" when open with Microsoft Word.
See https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.wordprocessing.keepnext.aspx

Expected Behaviour:
No <w:keepNext/> for w:styleId="1" in step 3(2).

Version: 5.1.1.3
Build ID: 89f508ef3ecebd2cfb8e1def0f0ba9a803b88a6d
CPU Threads: 2; OS Version: Windows 6.2; UI Render: default; 
Locale: zh-CN (zh_CN)
Win 10 x64
Comment 1 Kevin Suo 2016-03-16 04:38:39 UTC
Created attachment 123615 [details]
screenshots in pdf

Actually even when you open the saved DOCX file with LibreOffice Writer, "keep with next paragraph" is set to *ON* for paragraph "BBBBBBBBBBBBBB"
Comment 2 Buovjaga 2016-03-24 17:13:13 UTC
Repro.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.2.0.0.alpha0+
Build ID: 8d267cdd48e8b736a81a9e76ea5803e6847d791e
CPU Threads: 8; OS Version: Linux 4.4; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on March 24th 2016
Comment 3 GHux 2016-06-19 23:30:02 UTC
Repro on both OSX 10.9.5 and 10.11. I try to change the style and it never saves correctly when inspecting the docx.

Version: 5.0.6.3
Build ID: 490fc03b25318460cfc54456516ea2519c11d1aa
Locale: en-AU (en.UTF-8)

Same also happened in 5.0.4.x

More people with the problem here:
https://ask.libreoffice.org/en/question/53878/writer-keep-with-next-paragraph-problem/

Very annoying for my clubs that have a page limit and I don't own MSWord!
Comment 4 Buovjaga 2016-06-20 06:24:10 UTC
Changing version due to AskLibO data.
Comment 5 Kevin Suo 2017-01-09 03:31:55 UTC
Bug exists in the old LibreOffice 3.4.0 OOO340m1 (Build:11). Set version field to "3.4 all versions".
Comment 6 V Stuart Foote 2017-03-20 18:51:30 UTC
*** Bug 106657 has been marked as a duplicate of this bug. ***
Comment 7 Andy 2017-03-20 23:47:21 UTC
Yes, bug 106657 and 98700 are mostly the same (even if I find the "keep with the next paragraph" to be wrongly set not only to a single paragraph but to all paragraphs).
Please note that this bug makes using Libreoffice almost impossible when interacting with somebody who needs to work on .docx files. From this point of view, this is really a critical issue.
Comment 8 Buovjaga 2017-03-21 06:37:27 UTC Comment hidden (off-topic)
Comment 9 GHux 2017-03-21 09:53:43 UTC Comment hidden (me-too)
Comment 10 Andy 2017-03-21 10:08:25 UTC Comment hidden (me-too)
Comment 11 Kevin Suo 2017-03-21 22:48:16 UTC
*** Bug 97676 has been marked as a duplicate of this bug. ***
Comment 12 Buovjaga 2017-03-22 05:23:46 UTC
Important note from bug 97676: changing paragraph style from Heading to Default _seems_ to make the problem disappear..
Comment 13 Kevin Suo 2017-03-22 05:57:40 UTC
(In reply to Buovjaga from comment #12)
> Important note from bug 97676: changing paragraph style from Heading to Default _seems_ to make the problem disappear..

Of cause it will make the problem disappear. The Heading style has "keep with next paragraph" enabled (i.e., the bug), but the default style does not have this attribute.
Comment 14 Buovjaga 2017-03-22 06:39:46 UTC
(In reply to Kevin Suo from comment #13)
> (In reply to Buovjaga from comment #12)
> > Important note from bug 97676: changing paragraph style from Heading to Default _seems_ to make the problem disappear..
> 
> Of cause it will make the problem disappear. The Heading style has "keep
> with next paragraph" enabled (i.e., the bug), but the default style does not
> have this attribute.

Well, it is still a workaround and not clearly expressed in the report. I will change the summary.
Comment 15 Justin L 2017-08-18 18:44:17 UTC
The mere presence of the property "ParaKeepTogether" was enough to enable it when saving as DOCX. Normally this property doesn't exist.

This applies to much more than just the Heading styles. It applies to ANYTHING that had "keep with next paragraph" enabled at one point in time as suggested by Andy in bug 106657.

Proposed fix at https://gerrit.libreoffice.org/41309
Comment 16 Commit Notification 2017-08-19 03:01:04 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98700 docxexport: don't force on ParaKeepTogether

It will be available in 6.0.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 2017-08-19 04:25:53 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7f02579376bd863a23d7f1d052aced74a5ef1906&h=libreoffice-5-4

tdf#98700 docxexport: don't force on ParaKeepTogether

It will be available in 5.4.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 2017-08-21 16:47:43 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=067746290351c62b502425713360019a9863519a&h=libreoffice-5-3

tdf#98700 docxexport: don't force on ParaKeepTogether

It will be available in 5.3.6.

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.