[Solved] Change OO Options with UNO API

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

[Solved] Change OO Options with UNO API

Post by oliveiratr »

Hi everybody :D

Can i change the option on "Tools->Options->OpenOffice Writer->Print check Print automatically inserted blank pages" programatically with UNO API?
Last edited by oliveiratr on Fri Aug 04, 2017 7:05 pm, edited 1 time in total.
OpenOffice 4.1.2
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Post by RoryOF »

Don't know the answer to this, but if it is possible, be aware that the Table of Contents will most probably not update.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Post by oliveiratr »

Can i eliminate the "invisible blank pages" programatically?

This resolve my problem too

Sorry for my english :)
OpenOffice 4.1.2
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Post by oliveiratr »

i called this code:

Code: Select all

Function fchange_initial_page_number(alInitValue as Integer)
	oText = ThisComponent.getText()
	oCursor = oTexto.createTextCursor()
	oCursor.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE
	oCursor.PageNumberOffset = alInitValue + 1
End Function
After this, when my doc have 2, 4 ,6 ,8 , 10, 12, 14... pages always generate "invisible blank pages" before each page

But, i dont want generate this blank pages, how can i remove these pages, or other solutions

OBS.: I need put the fchange_initial_page_number to my macho works fine
OpenOffice 4.1.2
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Post by RoryOF »

Chang your page style to Default, Mirrored, or alternate Right pages with Left pages.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Post by oliveiratr »

Sorry for my ignorance, but, how this resolve my problem and, how i can do this programatically?
OpenOffice 4.1.2
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Post by RoryOF »

This will resolve your problem because left pages will follow right pages and there will be no blank pages inserted.

How you do this programatically is up to you - you are writing the program; I don't need to do that and have other calls on my time. You should refer to the Andrew Pitonyak books on macro programming, at
http://www.pitonyak.org/oo.php
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Post by oliveiratr »

I resolve with this code:

Code: Select all

oDoc = ThisComponent
	
oSettings = oDoc.createInstance("com.sun.star.text.DocumentSettings")
oSettings.PrintEmptyPages = False
Thanks for your help, or no :super:
OpenOffice 4.1.2
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved]Change OO Options with UNO API

Post by RoryOF »

Check that your page numbering is correct. You may find that pages are numbered 1, 3, 5...
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
oliveiratr
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: [Solved]Change OO Options with UNO API

Post by oliveiratr »

RoryOF wrote:Check that your page numbering is correct. You may find that pages are numbered 1, 3, 5...
Yes, works fine, thanks for your time.
OpenOffice 4.1.2
Post Reply