Ask Your Question

Using a macro to change from portrait to landscape in calc [closed]

asked 2013-01-15 20:35:07 +0200

thorium gravatar image

updated 2013-02-06 09:08:11 +0200

qubit gravatar image

I'm trying to figure out how to change the format of a page from portrait to landscape using a LibreOffice Basic macro. When I use the record feature it'll record me getting to the page format pop-up, but not the actual toggle and enter

Thanks for any help

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-10-31 04:13:14.049778

1 Answer

Sort by » oldest newest most voted

answered 2013-05-08 17:23:56 +0200

Gaffer gravatar image

Use page styles.

Create a page style called "Landscape", which includes all the page info:

Format -> Styles and Formatting -> Click on the Page Styles icon -> Rightclick on the list -> New

Then apply it to your sheet:

oSheet = ThisComponent.Sheets.getByName("Sheet1")
oSheet.PageStyle = "Landscape"

It is a little convoluted for just setting landscape but it enables you to set everything else as well, which is probably what you really need to do anyway :-)


edit flag offensive delete link more

Question Tools


Asked: 2013-01-15 20:35:07 +0200

Seen: 1,098 times

Last updated: May 08 '13