Ask Your Question
0

Writing more complex text into Writer using pyUno [closed]

asked 2013-04-07 03:25:51 +0100

_savage gravatar image

I am trying to export some text from Python into a Writer document which I created according to these instructions.

For example, using

cursor.setPropertyValue("CharHeight", 20)
cursor.setPropertyValue("CharWeight", 150)
document.Text.insertString(cursor, "This Is Heading One", 0)

I can make a line of text look like a heading, but it's just text and not an actual heading. What property values do I have to modify to generate a heading line that's picked up for the TOC?

In general, where is the documentation for the properties, and how to navigate the Writer document in general? I'm having a very hard time digging up anything at all!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-30 19:27:06.772472

1 Answer

Sort by » oldest newest most voted
1

answered 2013-04-21 01:06:18 +0100

_savage gravatar image

As for the first question:

cursor.ParaStyleName = "Heading 1"
document.Text.insertString(cursor, "Heading Text Here", 0)
document.Text.insertControlCharacter(cursor, uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK"), 0)
cursor.ParaStyleName = "Standard"
edit flag offensive delete link more

Comments

This works for using existing paragraph styles. Don't know (yet) how to create new paragraph styles.

_savage gravatar image_savage ( 2013-04-21 01:07:38 +0100 )edit

Question Tools

Stats

Asked: 2013-04-07 03:25:51 +0100

Seen: 838 times

Last updated: Apr 21 '13