有一个Libre/Openoffice writer的python helloworld示例(包含在Libreoffice 4.1.6.2中:
def HelloWorldWriter( ):
"""Prints the string 'Hello World(in Python)' into the current document"""
#get the doc from the scripting context which is made available to all scripts
desktop = XSCRIPTCONTEXT.getDesktop()
model = desktop.getCurrentComponent()
#check whether there's already an opened document. Otherwise, create a new one
if not hasattr(model, "Text"):
model = desktop.loadComponentFromURL(
"private:factory/swriter","_blank", 0, () )
#get the XText interface
text = model.Text
#create an XTextRange at the end of the document
tRange = text.End
#and set the string
tRange.String = "Hello World (in Python)"
return None
该脚本检查打开的writer文档,如果不存在,则创建一个新的,并将字符串输出到该文档中。在
Libreoffice/Openoffice calc有类似的东西吗?在
理想情况下,应包括:
^{pr2}$
对于开放式办公室,请检查: http://stuvel.eu/ooo-python:http://www.apidev.fr/blog/2011/07/18/utiliser-openoffice-avec-python/解释是法语,但请检查代码:
使用计算:
^{pr2}$你应该这样使用它:
检查一下!http://oosheet.hacklab.com.br/
相关问题 更多 >
编程相关推荐