Working with Linux (Ubuntu20.04) I’ve got a P&ID made with LibreOffice Draw (.odg file).
There are a lot of objects (each 1text+1symbol grouped together) in the .odg file, each containing the attributes: title,description.
My macro for to list text,title,description of all these objects starts with command:
soffice --invisible --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"
then with python3.8 the .odg file opens and I get the drawpages as follows:
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localContext )
ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
fileURL = uno.systemPathToFileUrl('/home/simkiss/testfile.odg')
model = desktop.loadComponentFromURL(fileURL, "_blank", 0, ())
pages = model.getDrawPages()
for apage in pages:
pass # I realy don't know ???
`desktop.terminate()`
How can I get a list containing text,title,description of the objects.
For me without any java-knowledge it’s hard to understand libreoffice uno concept/documentation and there are less python macro examples.
Farther question: is it possible to change this attributes via python macro?
[Edit - Opaque] Use preformatted text for code
[Edit - Jim K] Fixed code formatting and spellchecked.