Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Implying Range 1 > Range 2
- Function getUnionRange(Byval range1, Byval range2)
- Dim rg1Addr, rg2Addr
- rg1Addr = range1.getRangeAddress()
- rg2Addr = range2.getRangeAddress()
- rg1Addr.StartRow = rg1Addr.StartRow
- rg1Addr.EndRow = rg2Addr.EndRow
- rg1Addr.StartColumn = rg1Addr.StartColumn
- rg1Addr.EndColumn = rg2Addr.EndColumn
- getUnionRange = getRangeByAddress(range1.getSpreadsheet(),rg1Addr)
- End Function
- 'pass a spreadsheet-document, sheet or range together with a c.s.s.table.CellRangeAddress
- '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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement