A com.sun.star.table.CellRangeAddress is another type of struct than com.sun.star.table.CellAddress. A cell has both, a range has a range address only.
For a single cell the following holds true:
CellRangeAddress.StartRow=CellRangeAddress.EndRow=CellAddress.Row
CellRangeAddress.StartColumn=CellRangeAddress.EndColumn=CellAddress.Column
http://api.openoffice.org/docs/common/r ... dress.html
http://api.openoffice.org/docs/common/r ... dress.html
One of my helper functions to get a range (single cell or rectangle) from a given range address
within a given document, a sheet or another range.
Code: Select all
'pass a spreadsheet-document, sheet or range.
'return empty if oAddr out of bounds or wrong obj
Function getRangeByAddress(obj, oAddr as com.sun.star.table.CellRangeAddress)
on error goto nullErr:
Dim oSheet
If obj.supportsService("com.sun.star.sheet.SpreadsheetDocument") then
REM use the sheet specified by given address
oSheet = obj.getSheets.getByIndex(oAddr.Sheet)
else
REM use given object (range/sheet) as parent range
oSheet = obj
endif
getRangeByAddress = oSheet.getCellRangeByPosition(oAddr.StartColumn,oAddr.StartRow,oAddr.EndColumn,oAddr.EndRow)
exit function
nullErr:
getRangeByAddress = Null
End Function