Determining Page and Header Height in a Writer document

The Application Programming Interface and the OASIS Open Document Format

Determining Page and Header Height in a Writer document

Postby urtlet » Wed Oct 07, 2015 7:22 am

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   Expand viewCollapse view
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
Posts: 1
Joined: Wed Oct 07, 2015 7:07 am

Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest