我开始用libreofficecalc而不是Excel来做我的新工作。我(有点)习惯于用VBA编程。但是,由于我必须改变程序,我也想改变语言。我有一个Python的基本概念,但我有一些困难
目标
我想用宏写一个公式,看看结果
#!/bin/python3
#Script usado no programa Form_Atendimento.ods
#Cria objeto document, referenciando o documento aberto
document = XSCRIPTCONTEXT.getDocument()
#Cria objeto sheets, referenciando as planilhas
sheets = document.getSheets()
#Função que configura os parâmetros para que seja escrita a função =HOJE
def write_today():
information = '=HOJE()'
sheet = 'Form'
location = 'B5'
write_function(information, sheet, location)
return 0
#Função que escreve qualquer função
def write_function(information, sheet, location):
sheetForm = sheets.getByName(sheet)
sheetForm.getCellRangeByName(location).setString(information)
return 0
我还尝试将“sheetForm.getCellRangeByName(location).setString(information)”更改为“sheetForm.getCellRangeByName(location).setFormula(information)”,但结果也很糟糕:
信息:
另一个问题: 在哪里可以找到一些(好的)命令和函数文档,用于为libreofficecalc编写Python脚本
致以最良好的祝愿
目前没有回答
相关问题 更多 >
编程相关推荐