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
该脚本检查打开的编写器文档,如果不存在则创建一个新文档并将字符串输出到该文档中 .
Libreoffice / Openoffice-calc有类似的东西吗?
理想情况下,它应包括:
· Read a table cell
· Write a table cell
· Save as ODT/XLS/CSV
1 回答
对于开放式办公室检查:http://stuvel.eu/ooo-python:http://www.apidev.fr/blog/2011/07/18/utiliser-openoffice-avec-python/解释是法语但检查代码:
使用calc:
你应该这样使用它:
并检查它! http://oosheet.hacklab.com.br/