Jump to content

Macros/Python Guide/Calc/Calc ranges

From The Document Foundation Wiki

⇐ Return to Python Guide, Calc

Ranges

CAUTION: Copy or import function msgbox from Useful functions

Get cell by name

doc = XSCRIPTCONTEXT.getDocument()
    sheet = doc.CurrentController.ActiveSheet
    cell = sheet['A1']
    msgbox(cell.AbsoluteName)

Get cell by position

doc = XSCRIPTCONTEXT.getDocument()
    sheet = doc.CurrentController.ActiveSheet
    # Cell C6
    row = 5
    column = 2
    cell = sheet[row,column]
    msgbox(cell.AbsoluteName)

⇐ Return to Python Guide, Calc