使用Ubuntu 12.04和LibreOffice 3.5.7.2。
我正在尝试了解Libre Office中的Python脚本。我在网上看了很多,看了看并运行了一些例子。我注意到一些例子导入uno而有些则没有。它们都运行良好,但是如果我注释掉import uno,那脚本就会停止工作。
当uno需要导入时,有人可以向我解释。
谢谢,吉姆
答案 0 :(得分:0)
尝试导入uno。它最多会使你的程序减慢2秒。
import uno ##JUST DO It!
答案 1 :(得分:0)
你看过什么样的例子?
当您需要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" )