Question about PolyPolygon (and all kind of Shape involving several points) with python API
Steven Marguet
steven.marguet at free.fr
Sat Nov 3 15:11:31 PDT 2012
Hello to everyone,
I don't know if this mailing list is also for the scripting abilities of
LibreOffice. If it's not I appologize.
I have difficulties to create a PolyLineShape using the Pyhton API of
LibreOffice (in the Draw application).
In fact, I don't know what kind of data structure I have to used for the
points of the PolyLineShape I want to create.
Here is my code :
====================================================================
from com.sun.star.awt import Point
PolyLineShape = "com.sun.star.drawing.PolyLineShape"
def Test(button):
document = XSCRIPTCONTEXT.getDocument()
pages = document.getDrawPages()
page = pages.getByIndex(0)
shape = document.createInstance(PolyLineShape)
page.add(shape)
shape.setPropertyValue("LineWidth", 50)
shape.setPropertyValue("LineColor", 0)
points = (Point(120,340), Point(1200,3400), Point(1200,6000))
shape.PolyPolygon = points
====================================================================
This code creates a CannotConvertException which seems to mean that a
tuple or a list is not suitable...
I have tried to use a XIndexAccess object but python tells me the method
insertByIndex(idx, Point) does not exist...
I am circling for hours now. Does anyone has an idea of how to create a
PolyLineShape with python ?
Thank you for help :),
Steven
More information about the LibreOffice
mailing list