我在使用 UNO 为 LibreOffice 创建 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()
sheetForm = sheets.getByName('Form')
sheetBase = sheets.getByName('Base_de_Dados')
def testa_deslocamento(oEvent):
selectedsheet = sheetBase
cursor = selectedsheet.createCursor()
cursor.gotoEnd()
return 0
我知道代码不完整(对于我的最终目标),但我预计,至少,光标会移动到列中的最后一个位置。
结果(直到现在): 显然没有。光标不移动,并且没有选择其他单元格来使用。
重要提示: 我需要使用相对位置,因为表格可以有任何大小。
请求: 请指点我如何将光标移动到行或列的末尾(以及后面的一个单元格)?