How I can set oDrawPage names to object and getByName oDrawPage Names?

How I can set oDrawPage names to object and getByName oDrawPage Names?

I use oDrawPage.getByIndex(0) to get the Charts from the LibreCalc.
I would like something like this oDrawPage.getByName(“chart_1”)
I know that exists “Object 1” name as well Description, and Title?

How I Can access these elements? How I can set them if empty?

See here that call them through python:

python on oDrewPage

I was able to access Ttitle and Description by using:

’ Doc.getDrawPages.getByIndex(0).getByIndex(0).Title
’ Doc.getDrawPages.getByIndex(0).getByIndex(0).Description

However, I thought that these attributes will be UPON the object and NOT inside the Object, in order to be able to call the object by its name and not by its numbered position.

However, still struggling to find a way to get the object by its name than its numbered position.

Draw pages do not support XNameAccess. So, get a shape by its name using a loop.

for oDrawPage in oDrawPages:
    for oShape in oDrawPage:
        obj1name = "Object 1"
        if oShape.getName() == obj1name:
            print(oShape.Title)
        elif not oShape.getName():
            oShape.setName(obj1name)
1 Like