[Solved] Changing Page Style in Calc

Creating a macro - Writing a Script - Using the API

[Solved] Changing Page Style in Calc

Postby Jule » Fri Apr 16, 2021 1:39 pm

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
Jule
 
Posts: 2
Joined: Fri Apr 16, 2021 1:19 pm

Re: Changing Page Style in Calc

Postby JohnSUN-Pensioner » Fri Apr 16, 2021 2:08 pm

May be so?
Code: Select all   Expand viewCollapse view
  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
User avatar
JohnSUN-Pensioner
Volunteer
 
Posts: 862
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Changing Page Style in Calc

Postby Jule » Mon Apr 19, 2021 5:25 pm

Thanks, simply and easy...
LibreOffice 6.2.8.2 on Windows 10
Jule
 
Posts: 2
Joined: Fri Apr 16, 2021 1:19 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests