@PKG’s answer is the simplest, safest and correct solution. I recommend it.
However if you feel like exploring more exotic ways, here are a few suggestions. They make sense when you are not printing stationery but have some text in your pages (I mean an argumentation developing over several pages; in other words, your text is not a constant repeating on every page).
Use heading numbering
Create a Heading 1 paragraph containing at least a space (so that it is not considered empty by Writer which would then eliminate it for [wrong IMHO] compatibility with M$ Word).
Customise Heading 1 so that it is preceded by a page break (in Text Flow
tab). Set font colour the same as your background in Font Effects
tab (this is usually white to print white characters on white background). Change font size to 2pt in Font
tab (this is the minimum allowed by Writer). Make sure that spacing above and below is 0cm in Indents & Spacing
tab.
Enable Tools
>Heading Numbering
for level 1.
In your page header, Insert
>Field
>More Fields
, Document
tab, Type Heading (was Chapter in older releases), Format Heading Number, Up to level 1.
As long as you don’t change the “chapter”, the number remains the same. To change the number, insert a new blank (= containing one space) chapter heading.
Several variations are possible.
- The type of number can be alphabetical, Roman, … Select the appropriate setting in the heading numbering dialog.
- Instead of “numbering” your pages, you can have any text. In this case, your chapter heading is not a space but the text you want. Field insertion then selects Heading contents instead of number.
Note that this interferes with chapter numbering if you use the feature. It is dealt with by offsetting your current chaptering by one level. You can do it in a single operation with the Navigator.
Using several page styles
This makes possible to have different orientations (landscape and portrait) and independent headings among others. However it is less automatic and may not give your expected results if you reuse a previous page styles. The “best” counter-example is alternating Left Page and Right Page styles where all left pages bear the same number as do the right pages.
In this approach, you create one page style per sequence. Numbering is done by a Number range. This is an internal counter which value changes every time you reference it.
In the header of every page style, Insert
>Field
>More Fields
, Variables
tab, Type Number range. On first insertion, create a new counter by entering a new Name and Insert
. Of course, you can use a built-in counter if you don’t use it already in your document. On subsequent insertion, Select the counter and Insert
.
It works because presently a page header is computed and cached the first time it is met in Writer. I consider this behaviour as faulty because it has many adverse consequences when trying to share variable values between text and header/footer. However, it gives the result you expect. Note that if my request for change is ever accepted and implemented, it will stop working.