使用Ubuntu12.04和LibreOffice 3.5.7.2。
我正在尝试理解Libre Office中的Python脚本。我在网上读了很多,看过并运行了一些例子。我注意到有些例子导入uno,有些不导入,它们都运行得很好,但是如果我注释掉import uno,脚本就会停止工作。
谁能给我解释一下什么时候需要导入uno?
谢谢,吉姆
发布于 2013-07-08 05:38:16
尝试只导入uno。它最多会使你的程序减慢2秒。
import uno ##JUST DO It!发布于 2014-02-07 03:42:00
你看过什么例子?
当您需要UNO上下文时,需要UNO。这允许您在LO或OOo上进行连接。
当您需要使用UNO时,这里有一个小示例。
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 )
ctx = resolver.resolve( "uno:pipe,name=addtemppipe;urp;StarOffice.ComponentContext" )https://stackoverflow.com/questions/17516589
复制相似问题