Tabellenkalkulation: Einführung in die Makroprogrammierung II

Lesen und Schreiben in eine Tabelle

 

 

'
' utility functions
'

' writeCell writes a number to the table cell.
' @param xPos  zero based table position
' @param yPos  zero based table position
' @param value

Function writeCell( xPos as Integer, yPos as Integer, value as Double)
Dim myDoc
Dim mySheet
Dim myCell

myDoc   = thisComponent
mySheet = myDoc.sheets( 0 )
myCell  = mySheet.getCellByPosition( xPos, yPos ) 
myCell.setValue( value )
End Function

' readCell reads a number from the given cell position.
' @param xPos zero based table position
' @param yPos zero based table position
' @return a double (integer) value representing the given position


Function readCell( xPos as Integer, yPos as Integer) as Double
Dim myDoc
Dim mySheet
myDoc    = thisComponent
mySheet  = myDoc.sheets( 0 )
readCell = mySheet.getCellByPosition( xPos, yPos ).getValue() 
End Function