2010年1月18日 星期一
學習記錄:OpenOffice Basic (9)
Sub Main
dim a1
rem 取得 Active SpreadSheet 的控制權
oSSheet=ThisComponent
oSheet = ThisComponent.CurrentController.ActiveSheet
rem msgbox oSSheet.title 取得 Active SpreadSheet 名稱
rem msgbox oSheet.name ' 取得 ActiveSheet 名稱
rem msgbox oSheet.getSpreadSheet.getName ' 取得 ActiveSheet 名稱
rem msgbox oSheet.getSpreadSheet.name ' 取得 ActiveSheet 名稱
a1=oSheet.getCellRangeByName("A1") 'Cell ("A1")
'a1=oSheet.getCellByPosition(0, 0) 'Cell ("A1")
rem msgbox a1.value
a1.setValue(999.99)
'a1.setString("4")
'a1.setFormula("=B1")
rem 取得 ActiveCell 的位置
oSelectedCells = ThisComponent.CurrentSelection
oActiveCell = oSelectedCells.CellAddress
rem Ooo 的 row 和 column 是由 0 開始
nRow = oActiveCell.Row +1
nCol = oActiveCell.column +1
MSGBOX "nRow is " & nRow & " and nCol is " & nCol
rem 另一個取得 ActiveCell 的位置
Document = ThisComponent
AllSheets = Document.getSheets()
MySheet = AllSheets.getByIndex(0)
' 讀取 ActiveCell 的資料
print ThisComponent.getCurrentSelection.AbsoluteName
print ThisComponent.getCurrentSelection.value
print ThisComponent.getCurrentSelection.CellAddress.row
print ThisComponent.getCurrentSelection.CellAddress.column
End Sub
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言