Determining Page and Header Height in a Writer document

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
urtlet
Posts: 1
Joined: Wed Oct 07, 2015 7:07 am

Determining Page and Header Height in a Writer document

Post by urtlet »

I am positioning images on a page in OpenOffice Writer and need to know the page height, excluding margins, headers and footers.

I'm using Delphi on Windows 7, but the question is language independent.

If I get the current PageStyle, I can get the PageHeight with code that looks like:

Code: Select all

PageHeight := PageStyle.Height - PageStyle.TopMargin - PageStyle.BottomMargin
             - PageStyle.HeaderHeight - PageStyle.FooterHeight;
This works if the AutoFit Height is turned off, or if the actual Header is smaller than the specified height. If AutoFit Height is turned on, the actual header height may be greater than PageStyle.Height, and my calculation will be incorrect.

How can I find out the actual HeaderHeight when AutoFit Height is turned on and the header is bigger than the height specified in the Page Format?

Or is there a better way to find out the page height - excluding margins, headers and footers?
(I've asked this on StackOverflow already, but haven't had any responses).
OpenOffice 4.1.1 Windows 7
Post Reply