如何使用Python Un向文档添加TextShape

2024-09-20 03:47:32 发布

您现在位置:Python中文网/ 问答频道 /正文

连接到文档后,我有以下代码:

page = document.getDrawPages().getByIndex( 0 )

textshape = document.createInstance('com.sun.star.drawing.TextShape')
textshape.setSize(Size(150, 150))
textshape.setPosition(Point(100, 100))
textshape.setString('Test') 
textshape.CharColor = 0
textshape.CharHeight = 12

page.add(textshape)

代码没有给出错误,但是什么也没有发生。在

用Python向文档添加TextShape的正确方法是什么?在


Tags: 代码文档comsizepagedocumentstarsun