Macros/Python Guide/Calc/Calc ranges

From The Document Foundation Wiki
Jump to navigation Jump to search
Other languages:
English • ‎español • ‎italiano • ‎日本語

Return to Index

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)