Page 1 of 1

[Solved] Change OO Options with UNO API

Posted: Thu Aug 03, 2017 7:12 pm
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?

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 7:35 pm
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.

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 7:38 pm
by oliveiratr
Can i eliminate the "invisible blank pages" programatically?

This resolve my problem too

Sorry for my english :)

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 7:53 pm
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

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 8:24 pm
by RoryOF
Chang your page style to Default, Mirrored, or alternate Right pages with Left pages.

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 8:30 pm
by oliveiratr
Sorry for my ignorance, but, how this resolve my problem and, how i can do this programatically?

Re: Change OO Options with UNO API

Posted: Thu Aug 03, 2017 8:35 pm
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

Re: Change OO Options with UNO API

Posted: Fri Aug 04, 2017 7:03 pm
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:

Re: [Solved]Change OO Options with UNO API

Posted: Fri Aug 04, 2017 7:10 pm
by RoryOF
Check that your page numbering is correct. You may find that pages are numbered 1, 3, 5...

Re: [Solved]Change OO Options with UNO API

Posted: Fri Aug 04, 2017 7:28 pm
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.