Header and Footer needed outside the page margin

Hello,
I have a page format/margin (For odd-numbered pages left 1.5", top 1.5", right 1" and bottom 1" and for even numbered pages left 1’, right 1.5’, top 1.5’, bottom 1’’ where " means inches. So i have given mirror image and the page margins as stated. But now if i give header and footer, the header and footers come inside/within the page margins and hence further decrease the space.
But headers and footers should come outside the page margins right…?? (i think in this way, so…) or is this wrong what i have said…
So, how to put the headers and footers outside the prescribed page margins…??

Thank you.

Margin is whitespace, non-printable area. So nothing is in it. Next header and footer come, and next is page body.

By design (I’m not saying it’s a good design, just that it’s by design), Writer includes headers and footers on the text area:

Bug 33304 - Header / Footer should be inserted into margin, not into text body

The only way around this is to reduce the top and bottom margins to get the right distance from page border to text area. Note that while editing the page style, on the corresponding header/footer tab you can set the vertical space taken by the header/footer.

Writer doesn’t include headers/footers into text body. It separates the three areas (margins, header/footer, and page body) from each other, and allows to control them precisely (unlike in some other suites). Placing them inside some other area is wrong and not flexible.

Btw: the premise of that bug is wrong, than “I can’t know exactly how tall a margin is” - the user just didn’t try to understand the logic behind that.

I did not say text body, but text area. Let’s use headers as example. On LaTeX when you set margins with the help of geometry package, you set the distance from page border to text area and then how much the header is above that text area. On Writer you set the text area border and the header goes bellow that border. Not a tragedy, of course, you can always work out the right settings to get the same results: it’s just different. But, IMO, LaTeX way is easier.

Hmm. Yes, definitely, setting how much header is above is much easier than setting how much it is below…

It is, because you don’t need to figure out where the text area boundaries will fall. When you write a thesis or specially a legal document you may face strict formatting rules, and usually text area boundaries are far more important than header or footer positioning. Yes, on Writer you can (1) set the header size and then (2) subtract that value to the top margin to (3) get the needed distance from page border to the real text area, but that is two more steps than what you need on LaTeX.

LO Wrtiter has a different approach to page real estate management than M$ Word.

Il Writer, margin are no man’s land forbidden to text flow. Only manually positioned objects, such as frames, can reside in there.

So, the question is: what is your page design? Draw a schema for your page. Set the margins which are “true” non-printing margins. Sketch the position of your header/footer and decide whether they have a fixed or adaptative height.

From your question, your consider the margins as defining the area where your text will be printed. With elementary arithmetic, you can compute the Writer-style margins dimensions then customise your page style in the Header or Footer tab. Spacing measures the white space between the header/footer and the text area. Size is the minimal height devoted to the header/footer and can made fixed if you uncheck the dynamic height check box.

If this answer helped you, please accept it by clicking the check mark to the left and, karma permitting, upvote it. If this is what you expected, close the question, that will help other people with the same question.

The bug tdf#33304 meanwhile was marked RESOLVED NOTABUG.
However some users still seem to have problems with adjusting the margins complying with their intention to place a header inside the area that was defined as the margin in advance of the insertion.

To ease those of them who can accept support by user code (supposed to get assigned to a sensitive area in the Format toolbar), I want to post a raw draft of a Sub doing the needed complicated calculations and setting the new margin based on the result.

Sub insertHeaderIfMissingAndAdjustMargin(Optional pDoc As Object, _
      Optional pPageStylePtr As Object, Optional pMinPrintMargin As Long, _
      Optional pHeaderBodyDistance As Long)
Const minHbd As Long = 200, minPm As Long = 400
If IsMissing(pDoc) Then pDoc = ThisComponent
If NOT pDoc.supportsService _
             ("com.sun.star.text.GenericTextDocument") Then Exit Sub
REM There may be lots of possible errors not catched by the code,
REM in specific the current selection as the default PageStylePointer
REM may not (directly) have a .PageStyleName property.
REM The CurrentSelection should be an ordinary position within the bodytext
REM on a page having set the page style which shall be processed. 
On Error Goto errorCase 
If IsMissing(pPageStylePtr) Then pPageStylePtr = pDoc.CurrentSelection(0)
If IsMissing(pMinPrintMargin) Then pMinPrintMargin = minPm
If IsMIssing(pHeaderBodyDistance) Then pHeaderBodyDistance = minHbd
If pMinPrintMargin<minPM Then pMinPrintMargin = minPm
If pHeaderBodyDistance<minHbd Then pHeaderBodyDistance = minHbd
pageStyles = pDoc.StyleFamilies.PageStyles
pgSName = pPageStylePtr.PageStyleName
pgS = pageStyles.getByName(pgSName)
If pgS.HeaderIsOn Then Exit Sub
pgS.HeaderIsOn = True
pgS.HeaderBodyDistance = pHeaderBodyDistance
With pgs
 marginCorrection = _
  .HeaderHeight + .HeaderTopBorderDistance + _
  .HeaderBottomBorderDistance + .HeaderBodyDistance
End With
newMargin = pgS.TopMargin - marginCorrection
If newMargin<pMinPrintMargin Then newMargin = pMinPrintMargin
pgS.TopMargin = newMargin
errorCase:
End Sub  

The complicated calculations I was talking of you find here:

 marginCorrection = _
  .HeaderHeight + .HeaderTopBorderDistance + _
  .HeaderBottomBorderDistance + .HeaderBodyDistance

The sole actual problem is to know the true height of the header itself if .HeaderIsDynamicHeight is True. That’s the property shown as AutoFit height in the English UI. You should probably better switch this property off by an additional line of code and define the .HeaderHeight explicitly meeting your needs.

Hi,

When applying Styles to an already existing LO document, placing the header (and footer) inside the margins does play havoc with the text body: creating differing text body heights on mirrored pages if one header, say, is one line on one page and the header is two lines on the opposite page. “Autofit height” makes it dependent on point size of the header type and shoves down the text frame further on one page than on the other by some size-differential of the point size. The text no longer “registers-true” across the mirrored pages because it is shifted by this point size-differential in the header.

The best solution seems to be to turn on “autofit height” and construct the two (or more) line header height based on point size until it holds the sized text of this larger header then set both mirrored headers to this height so that the lines of the text bodies are aligned. Then for each mirrored page, reset “Register-true” and set the “Reference Style” to “text body”.

FAQ