Hello, I am trying to format a small book in writer and I would like to know how I can make the Page Header use the last heading to appear on the page instead of the first? The way it handles it is unusual and not the standard way navigation headers operate. Help is a appreciated.
Headers capture outline state as it is in the very first line of the page (so, beware if you space above heading with empty paragraphs!). And footers do the same with the very last line in the page.
Consequently, the last heading in the page is available in the footer and this is where you’ll insert a field for it. This is the standard way and there is nothing unusual in it.
Now you want to render the value at a location different from its capture. The trick is to use a frame.
- enable the footer in your page style
- in the footer paragraph,
Insert→Frame
Don’t bother for the default look of the frame; don’t touch it in any way. - apply the dedicated frame style you prepared beforehand
More on this later. - inside the frame,
Insert→Field→More Fieldsfor the required heading
The key here is the frame is anchored to the footer. But frame have an interesting property: they can be rendered anywhere in the page, independently from their anchor.
Create a new frame style, e.g. Footer2Header:
- in
Type- set Anchor to To paragraph
- give a default Size like W 2.00cm and H 0.5cm and tick both AutoSize
- set Position Horizontal to Center relative to Page text area; Vertical to From top by 2.0cm relative to Entire page
- in
Wrap, untick Allow overlap and keep Parallel - in
Borders, make sure there is none and padding is 0.0cm
You’ll have to manually tune the 2.0cm from top so that the field aligns with notmal text in the header, if any. The other Position parameters allow for various alignments (left or right).
Don’t move a frame (or resize it) in any way with the mouse because this will cancel the effect of the frame style and change the position property in undesired way. Frames are extremely sensitive to direct formatting.
When you make a change to a frame style, make sure the target frame(s) are not selected otherwise there is no immediate update in layout. Sometimes it is necassary to Tools → Update → Update All to see the changes.
Here is an example where the header shows the first heading at left and the last heading at centre:
AskLOFooter2Header.odt (13.1 KB)
PS: when asking here, always mention OS name, LO version and save format. The latter is most important, in particular here because there is no frame style in DOCX, only in .odt.
Thank you! This seems to work most of the time, however it seems somewhat finicky. I am unable to set up a template that uses this, however about 80% of the time when I try to set it up in a pre-typed document it seems to work. Any tips on getting it to work in a templates or why it wouldn’t always be working?
info:
LIbreoffice Version: 26.2.4.2 (X86_64)
OS: Windows 11 X86_64 (build 26200)
File Format: .odt
Arrach your template. If you consider it private, attach it to a private mail (click on the icon at left of my answer, then on Message button).