Cursor in python macro for LibreOffice Calc doesn't move

289 Views Asked by At

I am having difficulties with UNO to create Python macros for LibreOffice.

Final Objective: To go one row down to the last row of my table.

Table Example: enter image description here

Implemented Code (until now):

#!/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

I know the code is incomplete (for my final objective), but I expected, at least, the cursor would move to the last position in column.

Result (until now): Apparently none. The cursor doesn't move, and no other cell is selected to work with.

Important: I need to work with relative positions, because the table could have any size.

Request: Could you, please, point me how to move the cursor to the end of row or column (and one cell after too)?

0

There are 0 best solutions below