Ask Your Question
0

UNO: change page style?

asked 2015-08-16 16:47:47 +0100

Hi-Angel gravatar image

updated 2015-08-22 08:42:48 +0100

Alex Kemp gravatar image

I'm trying to set the first page style to, well… «First page» ☺

But I couldn't get it work. E.g. supposing the file is the current document, then:

>>> cursor = file.Text.createTextCursor()
>>> cursor.setPropertyValue("PageStyleName", "First Page")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
__main__.PropertyVetoException: Property is read-only: 'PageStyleName

Why is this? What am I supposed to do? I also found that the property appears for enumerating paragraphs, however attempt to change it there ends the same way for me.

[edit: removed redundant tag]

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-08-16 21:29:44 +0100

Hi-Angel gravatar image

In the end I am again figured it out by myself ☺ The page style could be set for a paragraph with the property «PageDescName». So I wrote a function in python — it accepts the opened document as a "file", and just changes the style name of the very first paragraph. Works like a charm.

def setFirstPage(file):
    """Sets the first page style to «First Page»"""
    enumeration = file.Text.createEnumeration()
    enumeration.nextElement().PageDescName = 'First Page'
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-08-16 16:47:47 +0100

Seen: 247 times

Last updated: Aug 22 '15