Загрузка документа в OpenOffice с использованием внешней программы Python
я пытаюсь создать программу на Python (используя pyUNO), чтобы внести некоторые изменения в таблицу калькуляции OpenOffice.
Мы запустили ранее OpenOffice на "принять» Режим для возможности подключения из внешней программы. Видимо, должно быть так же просто, как:
import uno
# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()
# create the UnoUrlResolver
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
# get the central desktop object
DESKTOP =smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
#The calling it's not exactly this way, just to simplify the code
DESKTOP.loadComponentFromURL('file.ods')
Но я получаюAttributeError
когда я пытаюсь получить доступloadComponentFromURL
, Если я сделаюdir(DESKTOP)
ЯМы видим только следующие атрибуты / методы: I '
['ActiveFrame', 'DispatchRecorderSupplier', 'ImplementationId', 'ImplementationName',
'IsPlugged', 'PropertySetInfo', 'SupportedServiceNames', 'SuspendQuickstartVeto',
'Title', 'Types', 'addEventListener', 'addPropertyChangeListener',
'addVetoableChangeListener', 'dispose', 'disposing', 'getImplementationId',
'getImplementationName', 'getPropertySetInfo', 'getPropertyValue',
'getSupportedServiceNames', 'getTypes', 'handle', 'queryInterface',
'removeEventListener', 'removePropertyChangeListener', 'removeVetoableChangeListener',
'setPropertyValue', 'supportsService']
Читал, что есть ошибки, которые делают то же самое, но в OpenOffice 3.0 (яиспользуя OpenOffice 3.1 поверх Red Hat5.3). Я'я пытался использовать указанный обходной путьВотно они неКажется, это работает.
Есть идеи?