1 def SetCellColor(x
, y
, color
):
2 """Sets the background of the cell at (x,y) (zero-based column and row
3 indices, for example (2,3) == C4) on the first sheet and
4 returns the contents of the cell as a string.
6 #get the doc from the scripting context which is made available to all scripts
7 desktop
= XSCRIPTCONTEXT
.getDesktop()
8 model
= desktop
.getCurrentComponent()
9 #check whether there's already an opened document
10 if not hasattr(model
, "Sheets"):
12 sheet
= model
.Sheets
.Sheet1
13 cell
= sheet
.getCellByPosition(x
, y
)
14 cell
.CellBackColor
= color