至少在用python为Linux上的LibreOffice / OpenOffice开发宏时,我读到过必须将py脚本放在一个特定的目录中。
Python LibreOffice/OOo开发人员有没有首选的方法来部署这些脚本,或者有没有其他方法可以在LibreOffice/OOo中指定您想要这些脚本的位置?
发布于 2012-05-25 02:51:48
也许一个很好的方法是熟悉Python安装工具本身(http://packages.python.org/an_example_pypi_project/setuptools.html),并编写一个适当的setup.py脚本,将所有需要的文件放在适当的目录中。
您的宏甚至可以与"easy_install“Python框架一起安装
发布于 2017-02-08 17:05:19
为避免重新加载已更改的宏(即使已将其部署到正确的文件夹中),您可以在开发期间让LibreOffice侦听套接字:
import uno
def getModel():
# 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
context = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
manager = context.ServiceManager
# get the central desktop object
desktop = manager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
# access the current writer document
return desktop.getCurrentComponent()我解释了当您准备好在this article中部署时如何替换这个开发属性
https://stackoverflow.com/questions/10742188
复制相似问题