Ask Your Question
0

How can I create a macro to set default margins? [closed]

asked 2013-03-05 20:47:21 +0200

updated 2015-10-27 13:01:55 +0200

Alex Kemp gravatar image

I like having half-inch (1.27 cm) margins on everything I write, but Writer provides no designated facility to make this the default. I don't like to change the default page style, because that had some unwanted side effects when I tried it. I tried recording a macro and setting the margins to what I want, but when I ran it all it did was open the Page Style dialog.

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-27 13:02:18.736069

3 Answers

Sort by » oldest newest most voted
2

answered 2013-03-05 23:12:42 +0200

qubit gravatar image

Hi @Uglyface200,

I like having half-inch (1.27 cm) margins on everything I write, but...I don't like to change the default page style, because that had some unwanted side effects when I tried it.

I believe that page styles (and in particular the default page style) are the recommended mechanism for specifying default sizes for margins. If you have multiple configurations you'd like to save, then document templates are a good solution.

What were the "unwanted side effects" that you experienced when you tweaked your default page style? Perhaps there's an underlying issue in LO that we should address!

edit flag offensive delete link more

Comments

I've rephrased the question. It would be simpler to have a macro that executed whenever I started Writer.

Uglyface200 gravatar imageUglyface200 ( 2013-03-07 21:17:05 +0200 )edit

I just got an email asking me to accept the best answer for this question. This is not the best answer. Furthermore, now I can't even figure out how to set the default template. And I never want to receive email from this site.

Uglyface200 gravatar imageUglyface200 ( 2013-03-19 22:12:51 +0200 )edit
2

It is also my opinion that the “best practice” here is to set the default page style accordingly in a template and use this template for all new documents. You could also try to put often-used paragraph and character styles in the template for even more convenience. Changing a document’s styles through programming every time the application starts sounds inefficient. It is possible to access a document’s style properties through LO Basic, but this functionality is best left to other uses.

CyanCG gravatar imageCyanCG ( 2013-03-21 04:59:30 +0200 )edit
1

answered 2013-03-20 05:38:15 +0200

qubit gravatar image

@Uglyface200 writes:

I've rephrased the question. It would be simpler to have a macro that executed whenever I started Writer [to set default margins]

To make the macro execute when Writer opens, take a look at the LibreOffice Online Help regarding Event-Driven Macros. The event you want to use is right at the top of the table:

EVENT          | An ASSIGNED MACRO IS EXECUTED...
---------------+---------------------------------
Program Start  | ... after a LibreOffice application is started.

Regarding setting the margins in a macro, take a look at Villeroy's answer to Calc Macro to set printer parameters?

edit flag offensive delete link more

Comments

I'm not a master of macro coding, in case you hadn't realized. I have only the most vague idea what the code on the page means, no idea where to enter it, and even less idea of how to make it apply to the document instead of the printer. Furthermore, this is a different office suite and product, so there might be trivial incompatibilities that throw me off for all I know.

Uglyface200 gravatar imageUglyface200 ( 2013-03-20 22:48:53 +0200 )edit

@Uglyface200 -- All good points. Sorry that we don't have more time to spend on Answers here, but we're all volunteers and we're trying to juggle our time between a lot of different Questions.

qubit gravatar imagequbit ( 2013-03-20 23:25:02 +0200 )edit
0

answered 2013-03-24 13:58:46 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi @Uglyface200

I also think the answer of @qubit is good solution.

・・・・,then document templates are a good solution.

As reference, I think the following code is helpful; http://openoffice3.web.fc2.com/OOoBasic_Writer.html#OOoWPage07

[ Properties ] => Top : .TopMargin / Bottom : .BottomMargin / Left : .LeftMargin / Right : RightMargin

edit flag offensive delete link more

Comments

Where do I enter that code? How do I make a template the default?

Uglyface200 gravatar imageUglyface200 ( 2013-03-25 03:27:53 +0200 )edit

Question Tools

Stats

Asked: 2013-03-05 20:47:21 +0200

Seen: 1,890 times

Last updated: Mar 24 '13