Using python and uno I want to connect to an open document and, for example, save it.
The following code connects to libreoffice, but I don’t know how to connect to the file I have open in writer. Anyone know what comes next?
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localContext )
# connect to the running office
ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager