[Solved] Changing Page Style in Calc

Creating a macro - Writing a Script - Using the API
Post Reply
Jule
Posts: 2
Joined: Fri Apr 16, 2021 1:19 pm

[Solved] Changing Page Style in Calc

Post by Jule »

Hi

I made a macro that creates a new page style called "Paakirja". The problem is that I can not put the style on to the sheet which also called "Paakirja":
...
Doc2.Sheets.insertNewByName("Paakirja", 0)
oSheets = Doc2.getSheets()
oObj1 = oSheets.getByName("Paakirja")
dim args1(1) as new com.sun.star.beans.PropertyValue
Dim dispatcher1 as Object
dispatcher1 = createUnoService("com.sun.star.frame.DispatchHelper")
args1(0).Name = "Template"
args1(0).Value = "Paakirja"
args1(1).Name = "Family"
args1(1).Value = 8
dispatcher1.executeDispatch(oObj1, ".uno:StyleApply", "", 0, args1())

Any help?
Regards Jue
Last edited by Jule on Mon Apr 19, 2021 5:26 pm, edited 1 time in total.
LibreOffice 6.2.8.2 on Windows 10
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine
Contact:

Re: Changing Page Style in Calc

Post by JohnSUN-Pensioner »

May be so?

Code: Select all

  oObj1 = oSheets.getByName("Paakirja")
  oObj1.PageStyle = "Paakirja"
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Jule
Posts: 2
Joined: Fri Apr 16, 2021 1:19 pm

Re: Changing Page Style in Calc

Post by Jule »

Thanks, simply and easy...
LibreOffice 6.2.8.2 on Windows 10
Post Reply