Page 1 of 1

[Solved] Changing Page Style in Calc

Posted: Fri Apr 16, 2021 1:39 pm
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

Re: Changing Page Style in Calc

Posted: Fri Apr 16, 2021 2:08 pm
by JohnSUN-Pensioner
May be so?

Code: Select all

  oObj1 = oSheets.getByName("Paakirja")
  oObj1.PageStyle = "Paakirja"

Re: Changing Page Style in Calc

Posted: Mon Apr 19, 2021 5:25 pm
by Jule
Thanks, simply and easy...