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
Attach 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).
Shared header test template 7 26.ott (11.9 KB)
Apologies for the late reply, I never received the notification. This is the template. And thank you immensely for the help you’ve offered.
It does not work because your frame is not anchored in the footer: it is anchored to a paragraph inside the text area. Depending on how you edit your page, said paragraph may ot may not be the last one in the page. In addition, since your footer is empty, you have to manually adjust your frame practically on ever page (no automation).
How to fix ?
First be consistent in your page styles. To avoid bad looking “geometry”, give all your styles the same margins, mainly top and bottom margins. Enable header and footer everywhere and constrain them to the same size. It is better to have an empty footer than no footer with text extending too low compared with pages showing a bottom page number.
Don’t use Gutter. It is a compatibility artefact for DOCX documents (yours is .ott/.odt). From personal experience, it does not behave like it should.
I moved your frame in Right Page footer and now it works as you expect.
Improvements
The tables in your header and frame are useless. Just style the paragraph as Header. I adjusted the tab stops to match your paper size (centre and right edge) after setting margins without gutter and enabling both header and footer.
Your dummy paragraphs are Default Paragraph Style (DFS). This is wrong. DFS is intended to stored your preferred typographical and “geometric” preferences which are forwarded to all other styles. Consequently it should not be used for real text because you’ll be tempted to tune it to fit the look of your discourse, with detrimental effects on the other styles you’ll try to fix (avalanche effect). The “normal” style for text is Body Text.
Here is my “corrected” template. I haven’t tuned it.
Shared header test template 7 26.ott (11.2 KB)
Thank you, I see what you mean about the page margins, the gutter, and body text. This template works when I paste text in, but I’m not entirely understanding what you did.
Could you perhaps explain how you fixed the text frame in another way as well as how you did that Tab stops feature?
I was also wondering if it would be possible to add a double underline in as I previously had. I was using the table to provide that as a divider between the body text and the header.
To add more context, btw, this was a book template. I had created my right header info in the footer and after creating a text frame, adjusted the footer to .04 inches as I was trying to avoid extra large margins, since those significantly increase page count.
I simply enabled the footer and put the cursor in it. I moved the frame there. I could also have inserted it there from scratch.
I applied Header paragraph style because it is factory-configured with one centring tab stop in the middle and one right-aligning tab stop at right. But the distances are computed for “standard” sheet sizes. So I opened Header paragraph style Tabs tab and added 2 new stops with the adapted distances, then deleted the old ones (because you can’t edit stop properties).
I didn’t pay enough attention to your header settings and made a little mistake. It is important to enable AutoHeight so that our header has at least the size set by Header paragraph style. Otherwise your setting of 0.41cm will completely “erase”/hide the header.
Regarding the footer, you are free to set it as you like because nothing prints from it. But be consistent with the other pages for best visual results.
Of course. In the Header tab, press More button. Here you can configure borders and distance between border and text.
Adjusted template:
Shared header test template 7 26.ott (11.3 KB)
Thank you for the help so far. I’ll get back on whether I can get it to work. I’m scratching my head as I can’t get any templates I’ve made to work.
Thank you immensely after some tweaking I’ve finally gotten templates that work. You’ve been extraordinarily helpful.