Bug 131132 - Change to different PAGE STYLE does not update headers: needs save and reload (or web-view toggle)
Summary: Change to different PAGE STYLE does not update headers: needs save and reload...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:26.2.0
Keywords: bibisected, bisected
Depends on:
Blocks: Writer-Header-Footer Writer-Styles-Page-Odd-Even
  Show dependency treegraph
 
Reported: 2020-03-04 18:22 UTC by R. Green
Modified: 2025-09-04 12:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer file: problem with headers (25.62 KB, application/vnd.oasis.opendocument.text)
2020-03-04 18:22 UTC, R. Green
Details
headerInvalidation.odt: removing blue header doesn't refresh on "odd" page (10.60 KB, application/vnd.oasis.opendocument.text)
2025-08-28 11:53 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description R. Green 2020-03-04 18:22:44 UTC
Created attachment 158392 [details]
Writer file: problem with headers

Version: 6.4.0.3 (x64)
Build ID: b0a288ab3d2d4774cb44b62f04d5d28733ac6df8
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: en-GB (en_GB); UI-Language: en-GB
Calc: threaded

Open the attached writer file. The page style is set to "Default." Note that the header are set to give a different content for left and right pages, and for the first page. They read "1st", "2nd", "3rd".

1. Click on the first page and then double-click the "Chapter 1" page style. Note that this has been set up exactly the same as the "Default" page style.

Expected result: Exactly the same headers, i.e.: "1st", "2nd", "3rd".
Actual result: The headers have all reverted to the first page header.

3. Save, close and reload the file.

Result: The headers correct themselves
Comment 1 Dieter 2020-03-06 08:01:48 UTC
I confirm it with

Version: 7.0.0.0.alpha0+ (x64)
Build ID: eeb2d19e77d6dc47c68e8ba0920a02cf64a1247b
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded
Comment 2 Justin L 2020-12-18 19:29:09 UTC
Hmm - true ever since6.0 when first-headers were introduced for ODT.
author	Luke Deller on 2017-07-18 09:50:17 +0200
commit bff8cd3d52223002263dcb8c09758c4fc753b6e3
tdf#109080 First page header/footer ODF (1/2)

I'm assuming this must be a layout issue. It seems to work fine when saving as DOC format. If the page size or orientation changes, then it works better - although no always perfect. Switching to web view and back "fixes" it.
Comment 3 Justin L 2021-01-13 17:33:51 UTC
*** Bug 130913 has been marked as a duplicate of this bug. ***
Comment 4 Justin L 2021-03-23 15:44:54 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2023-03-24 03:25:00 UTC Comment hidden (obsolete)
Comment 6 Dieter 2023-03-28 08:59:14 UTC
Still present in

Version: 7.5.2.1 (X86_64) / LibreOffice Community
Build ID: e8bf3b441b8370f8440b0339fd9490765a8d57ca
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

Steps:
1. Open attachment 158392 [details]
2. Place cursor in first page and change page style "Chapter 1"

Actual result:
Headers changes (every header is now "1st")

Expected result:
No change (1st, 2nd, 3rd)

Save and reload -> Expected result
Comment 7 Justin L 2024-05-31 17:35:09 UTC
repro 24.8+
Comment 8 Justin L 2025-08-28 11:53:07 UTC Comment hidden (off-topic)
Comment 9 Justin L 2025-08-30 12:48:18 UTC
Dealing with page styles is always discouraging. Nothing ever makes sense.

comment 8 was reported separately as bug 168196.

Hopefully useful code pointers:
-the dialog is called in SwDocShell::Edit, and calls pApplyStyleHelper on OK
-SwDoc::ChgPageDesc is probably the most interesting function which invalidates
-SwPageFrame::SwClientNotify is where layout is notified about the change
Comment 10 Commit Notification 2025-09-04 08:14:40 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7a49318fd929901b4814d23d6ff763d099c35234

tdf#131132 SwFrame::OnFirstPage: replace GetPageDesc w/ FindPageDesc

It will be available in 26.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.