Bug 145998 - Page styles in docx-file revert to previous settings after reopening the document
Summary: Page styles in docx-file revert to previous settings after reopening the docu...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.5.0 target:7.6.0 target:7.5.5
Keywords:
: 144947 (view as bug list)
Depends on:
Blocks: Writer-Styles-Page DOCX-Styles
  Show dependency treegraph
 
Reported: 2021-12-01 21:14 UTC by Gregory Amato
Modified: 2023-06-01 07:24 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file as requested (6.80 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-12-03 21:56 UTC, Gregory Amato
Details
145998_unnecessarySectionBreaks.odt: proofs and caveats (11.15 KB, application/vnd.oasis.opendocument.text)
2022-07-20 17:12 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gregory Amato 2021-12-01 21:14:48 UTC
Description:
The document (.docx) begins with the Default page style and changes to the Converted1 page style at page 67. The rest of the document has page style set to Converted2, Converted3, etc. that do not correspond to manual page breaks and that were not set by the user. After changing all sections to page style Default, the sections all revert to page style Converted1, Converted2, etc. upon reopening the document.

This only occurs in a document I am editing.

Steps to Reproduce:
1. Open my document.
2. Press F11 and open the Page Style settings.
3. Navigate in document to a section that has a page style set to Converted1.
4. Change the page style to Default.
5. Save the document.
6. Close the document.
7. Open the document.
8. Navigate to the same section that was changed to the Default page style in step 4.

Actual Results:
The page style is Converted1.

Expected Results:
The page style should be Default.


Reproducible: Always


User Profile Reset: No



Additional Info:
I think what happened is these "Converted" page styles were inherited when I copied my Grammarly-edited pieces of the document. This is the only explanation I can think of since the Page Style is not changing after every chapter with a page break. However, I don't understand why the changes I make aren't retained after saving the document.
Comment 1 Ezinne 2021-12-03 21:06:20 UTC
Please, can you attach the sample file for testing?
Comment 2 Gregory Amato 2021-12-03 21:56:10 UTC
Created attachment 176682 [details]
Sample file as requested
Comment 3 Gregory Amato 2021-12-03 21:59:11 UTC
I have attached a sample file as requested. The attached file is two pages copied from the original document with the text replaced. I verified the steps to reproduce are the same as for the original document.
Comment 4 Gregory Amato 2021-12-16 20:28:46 UTC
(In reply to Ezinne from comment #1)
> Please, can you attach the sample file for testing?

The file is attached. I am uncertain if I need to do anything else. I have changed the bug status back to UNCONFIRMED.
Comment 5 Dieter 2021-12-30 13:50:31 UTC
I confirm it with provided document and

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 9c95415de877af1430ab5b7123e11dedd0ea622c
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Bug only occurs, if you save it as docx-file. Saving as odt works.
Comment 6 Justin L 2022-06-24 19:01:37 UTC
DOCX has no concept of page styles. Everything here is based on emulation, so it is impossible to keep the page style names.

In your specific document, you are using "section page breaks" - specifying a style to use. Change that to a normal page break, and you will be fine. [It is virtually impossible to compare equality with a existing page styles.]

Perhaps we can be smarter on export?  If the "section page break" is to the same style as the current page, could we just change that into a normal page break? Likely not, since everything "smartly" done about page styles backfires.
Comment 7 Justin L 2022-06-24 19:02:20 UTC
*** Bug 144947 has been marked as a duplicate of this bug. ***
Comment 8 Justin L 2022-07-20 17:12:13 UTC
Created attachment 181350 [details]
145998_unnecessarySectionBreaks.odt: proofs and caveats

Alwas exporting a "new" page style is also messing up "first header". In ODT, specifying a repeated page style doesn't impact the "first header" status, but of course if it is a different (converted) style, then it comes into effect.

A "section break" cannot be replaced by a "page break" if:
-the new section does not match the current page style's "follow style".
-resets the page number

Proposal at http://gerrit.libreoffice.org/c/core/+/137273
Comment 9 Commit Notification 2022-07-22 18:13:13 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c37f62b71fa59917ef85ff98480dff18aa936e41

tdf#145998 sw ms export: use page break, not section break

It will be available in 7.5.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 10 Commit Notification 2022-07-23 02:46:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fa5d80106080fa305479758dd43d0defb684376a

related tdf#145998 docx export: fix writing blank headers/footers

It will be available in 7.5.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 11 Justin L 2022-07-23 02:53:26 UTC
(In reply to Justin L from comment #6)
> Perhaps we can be smarter on export?
Three improvements made here (one more on the way) so I'm going to mark this as fixed.

Please do not backport any of this. I want lots of space to back-pedal.
Comment 12 Commit Notification 2022-07-23 10:29:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/28a947c8ceae8bb4b9306801ff4503970e9b1e76

related tdf#145998 sw ms export: smarter first header

It will be available in 7.5.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 13 BogdanB 2022-07-25 21:27:45 UTC
Solved.
Verified with
Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 41f02927b6d8470c298c8a2f407c98420a5ebe24
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 14 Commit Notification 2023-05-31 22:30:20 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a05dc1591ca9122056e95cb2801e7f924bb7ecdb

tdf#104704 tdf#145998 doc/rtf import: don't lose section page break

It will be available in 7.6.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 15 Commit Notification 2023-06-01 07:24:07 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/641e8be6cd60bbb4117eb7f127b125be05ba4e21

tdf#104704 tdf#145998 doc/rtf import: don't lose section page break

It will be available in 7.5.5.

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.