Macros/Python Guide/Calc/Calc ranges

From The Document Foundation Wiki
Jump to navigation Jump to search

Template:TopMenu/en Template:Menu/en Template:Menu.Macros/en

Other languages:
English • ‎español • ‎italiano • ‎日本語

Return to Index

Ranges

CAUTION: Copy or import function msgbox from Useful functions

Get cell by name

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

Get cell by position

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