Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When opening a document made by someone else, I would like the margins to automatically be set to 0.4 cm, the page orientation to landscape and page size to A3.

My dad gets emailed a spreadsheet weekly and he prints them off. To fit them onto one page he applies these settings, which is quite laborious. I thought that there must be a quicker way of doing this!

I tried creating a new default template with these settings but this only works for a new blank document. I tried to create a style to quickly apply these settings but I realised these styles are document / template specific (?) and so don't appear when opening someone else's document.

Anyone have any ideas how I can do this? Thanks =]

share|improve this question
up vote 1 down vote accepted

One way would be to use a macro to set the page parameters and save the macro in a library accessible by all sheets. The macro could be assigned to the libreoffice menu. It wouldn't be automatic, but it could be run by clicking on the menu entry in the spreadsheet you want to change.

This macro in an OpenOffice forum is as close as I could find. It appears to work in LibreOffice.

sub formatpage()
rem from
rem original by GWS with addition by Villory
rem modified for A3 and 0.4 cm margin
Dim sS      as String     '$     'Style name
Dim oStyle    as Object   'The current page style

pageStyles = thisComponent.StyleFamilies.getByName("PageStyles")
page = pageStyles.getByName("Default")


page.LeftMargin = 400
page.RightMargin = 400
page.TopMargin = 400
page.BottomMargin = 400

REM Set Page Orientation TO LANDSCAPE
Dim printerOption(0) As New
printerOption(0).Name = "PaperOrientation"
printerOption(0).Value =
thisComponent.Printer = printerOption()


end sub
share|improve this answer
This is very close indeed - thank you! I do not know about macros or basic but I can adapt it easily enough because it's so similar. Thanks =] – alex Apr 16 '12 at 16:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.