Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.