Bug 118702 - FILESAVE DOCX Next Style property for page styles lost
Summary: FILESAVE DOCX Next Style property for page styles lost
Status: VERIFIED 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: Xisco Faulí
URL:
Whiteboard: target:6.2.0 target:6.1.0.2 target:6....
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: Writer-Styles-Page DOCX-Styles
  Show dependency treegraph
 
Reported: 2018-07-11 15:53 UTC by Gabor Kelemen (allotropia)
Modified: 2019-09-24 18:18 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
The original document in ODF format. (13.94 KB, application/vnd.oasis.opendocument.text)
2018-07-11 15:53 UTC, Gabor Kelemen (allotropia)
Details
The same document saved as DOCX. (14.21 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-07-11 15:53 UTC, Gabor Kelemen (allotropia)
Details
A screenshot showcasing the issue. (165.99 KB, image/png)
2018-07-11 15:54 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2018-07-11 15:53:08 UTC
Created attachment 143473 [details]
The original document in ODF format.

LibreOffice Writer has page styles, Microsoft Word doesn't. This means that every time a document with multiple page styles is saved as DOCX and reopened, page styles have to be converted back and forth.

This works well when the page styles are separated with manual breaks with directly set next page styles, but it doesn't if the next page style is applied via the Next style property from the page style settings and pages are separated with regular page breaks. I think that in this case regular page breaks should be converted to page breaks with style changes to preserve the original layout as much as possible.

Interestingly, if the page has a next style property, and there are no page breaks set at all between pages (so when the text flows freely from one to the next page) LibreOffice adds page breaks with style changes automatically.


Steps to reproduce:

1.	Create a new document in LibreOffice Writer.
2.	Open the “Style and Formatting” sidebar by pressing F11, and select the “Page Styles” view.
3.	Create a new page style: Name it as you like, set the Next Style to “Default style” and set the page orientation to Landscape.
4.	Apply the newly created page style and add some random text.
5.	Press Ctrl+Enter to insert a page break. The next page should be in portrait, if everything was done right. Add some more random text to this page.
6.	Save the document as DOCX and reload it.

Actual results:
Both the first and second page are in landscape.

Expected results:
Only the first page should be in landscape, the second page should be in portrait.

LibreOffice details:
Version: 6.2.0.0.alpha0+
Build ID: bb1d5780226bb1b9156580972eea9aa849178742
CPU threads: 1; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-07-03_05:56:48
Locale: hu-HU (hu_HU); Calc: group threaded
Comment 1 Gabor Kelemen (allotropia) 2018-07-11 15:53:58 UTC
Created attachment 143474 [details]
The same document saved as DOCX.
Comment 2 Gabor Kelemen (allotropia) 2018-07-11 15:54:21 UTC
Created attachment 143475 [details]
A screenshot showcasing the issue.
Comment 3 Dieter 2018-07-11 19:24:24 UTC
I confirm it with

Version: 6.2.0.0.alpha0+ (x64)
Build ID: b0e291a7efcd3af2a72d0b622b1f1b84723f011f
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-06-30_23:43:40
Locale: en-US (de_DE); Calc: CL


Additional information: The new page style is missing in the document and in the page style list.
Comment 4 Xisco Faulí 2018-07-12 10:48:00 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=2df0d9d32d05f08ccf673fd0f61f650438511acb

author	PriyankaGaikwad <priyanka.gaikwad@synerzip.com>	2014-05-30 17:23:45 +0530
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-04 08:05:00 +0000
commit 2df0d9d32d05f08ccf673fd0f61f650438511acb (patch)
tree 04db38af0c96180262d89c5e86ebe23db1efcac2
parent ce1d0fc63bedc5c908c0f5e92445aa16ae1326df (diff)
fdo#78907 : File crashed while saving.
   - There is pagebreak in file and footer has nested table.
   - While exporting LO write section break instead of PAGE_BREAK.
   - Due to this it was writing two sections in file and same footer
     for both sections.
   - This was causing wrong table depth values due to this it was crashing
     while writing table.
   - So in MSWordExportBase::OutputSectionBreaks if next node has
     RES_BREAK(page break) then bNewPageDesc value should be false.

Bisected with: bibisect-44max
Comment 5 Xisco Faulí 2018-07-12 12:00:45 UTC
I think I can fix it...
Comment 6 Xisco Faulí 2018-07-12 15:59:54 UTC
Patch in gerrit: https://gerrit.libreoffice.org/#/c/57338/
Comment 7 Commit Notification 2018-07-13 09:03:21 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#118702: partially revert the fix for tdf#78907

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 8 Commit Notification 2018-07-16 10:06:30 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

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

tdf#118702: partially revert the fix for tdf#78907

It will be available in 6.1.0.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 9 Commit Notification 2018-07-18 15:26:53 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

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

tdf#118702: partially revert the fix for tdf#78907

It will be available in 6.0.7.

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 10 Commit Notification 2018-07-25 08:17:10 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-0-6":

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

tdf#118702: partially revert the fix for tdf#78907

It will be available in 6.0.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.
Comment 11 Dieter 2019-09-24 18:18:51 UTC
VERIFIED with

Version: 6.3.2.2 (x64)
Build-ID: 98b30e735bda24bc04ab42594c85f7fd8be07b9c
CPU-Threads: 4; BS: Windows 10.0; UI-Render: GL; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded