Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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 http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=42863
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")

REM A3
page.width=29700
page.height=42000

REM SET MARGINS LEFT, RIGHT, TOP, BOTTOM = .4 cm"
page.LeftMargin = 400
page.RightMargin = 400
page.TopMargin = 400
page.BottomMargin = 400

REM Set Page Orientation TO LANDSCAPE
Dim printerOption(0) As New com.sun.star.beans.PropertyValue
printerOption(0).Name = "PaperOrientation"
printerOption(0).Value = com.sun.star.view.PaperOrientation.LANDSCAPE
thisComponent.Printer = printerOption()

sh=ThisComponent.Sheets.getByIndex(0)
sh.PageStyle=("Default")

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

 
discard

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.