| View previous topic :: View next topic |
| Author |
Message |
cootetom Newbie

Joined: 29 Nov 2011 Posts: 3 Location: United Kingdom
|
Posted: Tue Nov 29, 2011 1:49 am Post subject: Text in Impress slide |
|
|
Hi all,
I'm using pyuno to connect to an impress document and want to insert text into that document. I've managed to get my head around most things in the API but can't seem to piece together what is needed to place text into a presentation slide. Here is what I have so far...
| Code: |
all_pages = self.document.getDrawPages()
page = all_pages.insertNewByIndex(all_pages.getCount() + 1)
object_shape = self.document.createInstance('com.sun.star.drawing.RectangleShape')
object_shape.setSize(Size(10000, 5000))
object_shape.setPosition(Point(500, 500))
object_shape.FillStyle = fillstyle_none
text = object_shape.Text
text.CharColor = 25516616
text.CharHeight = 24
text.setString('Some text in here')
page.add(object_shape)
|
The text isn't showing at all but I can't figure out what I'm not doing?
Can anyone offer me any pointers on this? _________________ - Tom |
|
| Back to top |
|
 |
cootetom Newbie

Joined: 29 Nov 2011 Posts: 3 Location: United Kingdom
|
Posted: Tue Nov 29, 2011 6:09 am Post subject: |
|
|
I've figured this out now from the docs.
| Code: |
object_shape = self.document.createInstance('com.sun.star.drawing.TextShape')
object_shape.setSize(Size(26000, 4000))
object_shape.setPosition(Point(1000, 5000))
page.add(object_shape)
object_shape.TextHorizontalAdjust = uno.getConstantByName('com.sun.star.drawing.TextHorizontalAdjust.LEFT')
object_shape.TextVerticalAdjust = uno.getConstantByName('com.sun.star.drawing.TextVerticalAdjust.TOP')
object_shape.setString('CoMPASS Analysis')
object_shape.CharColor = self._rgb_color(255, 166, 16)
object_shape.CharHeight = 48
|
_________________ - Tom |
|
| Back to top |
|
 |
|