Ask Your Question
0

Configure Libreoffice to listen for uno connection

asked 2016-09-18 02:54:13 +0200

cellsee6 gravatar image

Running LibreOffice version 4.0.4.2 on Windows 7 pro.

My understanding is if I write Python programs and run them externally to LibreOffice, then LibreOffice must be configured to listen for an uno connection.

How do I configure LibreOffice to listen for an uno connection?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-09-18 13:09:12 +0200

karolus gravatar image

updated 2017-02-14 16:54:00 +0200

Hallo

See the answers in this thread
No, ipython notebook ( now jupyter notebook ) is not necessary to run soffice in servermode, but IMHO it's currently the best Environment for (small) interactiv Development from|with python.

to repeat the essential parts:

# run soffice as 'server'
from subprocess import Popen

officepath = 'soffice' #respectivly the full path
calc = '--calc'
pipe = "--accept=pipe,name=abraxas;urp;StarOffice.Servicemanager"
Popen([officepath, calc, pipe]);

# to connect as client
import uno
from pythonscript import ScriptContext

local = uno.getComponentContext()
resolver = local.ServiceManager.createInstance("com.sun.star.bridge.UnoUrlResolver")

client = resolver.resolve( "uno:pipe,"
                       "name=abraxas;"
                       "urp;"
                       "StarOffice.ComponentContext")
# for the conviniance of prior basic-adopters
createUnoService = client.ServiceManager.createInstance

# for (roughly) the same namespace as from "inside" soffice
XSCRIPTCONTEXT = ScriptContext(client, None, None)
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-09-18 02:54:13 +0200

Seen: 1,114 times

Last updated: Feb 14 '17