[Solved] Change OO Options with UNO API

Creating a macro - Writing a Script - Using the API

[Solved] Change OO Options with UNO API

Postby oliveiratr » Thu Aug 03, 2017 7:12 pm

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
oliveiratr
 
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Postby RoryOF » Thu Aug 03, 2017 7:35 pm

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.4 on Xubuntu 16.04.03 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
RoryOF
Moderator
 
Posts: 25492
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Postby oliveiratr » Thu Aug 03, 2017 7:38 pm

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

Postby oliveiratr » Thu Aug 03, 2017 7:53 pm

i called this code:

Code: Select all   Expand viewCollapse view
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
oliveiratr
 
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Postby RoryOF » Thu Aug 03, 2017 8:24 pm

Chang your page style to Default, Mirrored, or alternate Right pages with Left pages.
Apache OpenOffice 4.1.4 on Xubuntu 16.04.03 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
RoryOF
Moderator
 
Posts: 25492
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Postby oliveiratr » Thu Aug 03, 2017 8:30 pm

Sorry for my ignorance, but, how this resolve my problem and, how i can do this programatically?
OpenOffice 4.1.2
oliveiratr
 
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: Change OO Options with UNO API

Postby RoryOF » Thu Aug 03, 2017 8:35 pm

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.4 on Xubuntu 16.04.03 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
RoryOF
Moderator
 
Posts: 25492
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Change OO Options with UNO API

Postby oliveiratr » Fri Aug 04, 2017 7:03 pm

I resolve with this code:

Code: Select all   Expand viewCollapse view
oDoc = ThisComponent
   
oSettings = oDoc.createInstance("com.sun.star.text.DocumentSettings")
oSettings.PrintEmptyPages = False


Thanks for your help, or no :super:
OpenOffice 4.1.2
oliveiratr
 
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm

Re: [Solved]Change OO Options with UNO API

Postby RoryOF » Fri Aug 04, 2017 7:10 pm

Check that your page numbering is correct. You may find that pages are numbered 1, 3, 5...
Apache OpenOffice 4.1.4 on Xubuntu 16.04.03 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
RoryOF
Moderator
 
Posts: 25492
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved]Change OO Options with UNO API

Postby oliveiratr » Fri Aug 04, 2017 7:28 pm

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
oliveiratr
 
Posts: 30
Joined: Thu Dec 29, 2016 12:22 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests