NamedRange should be called NamedExpression. It is not a range. It is the item you see in the named range dialog.
It has a name, a formula expression as content, a base address for relative references (in the GUI that is the active cell) and it has a set of flags (below the More button in the GUI).
http://www.openoffice.org/api/docs/comm ... Range.html
If and only if the name refers to a absolutely absolute address,
method getReferredCells returns a
com.sun.star.table.XCellRange
The following Basi code has been recorded by the MRI tool:
Code: Select all
Sub Snippet(Optional oInitialTarget As Object)
Dim oNamedRanges As Object
Dim oObj_1 As Object
Dim sContent As String
Dim oReferredCells As Object
oNamedRanges = oInitialTarget.NamedRanges
oObj_1 = oNamedRanges.getByName("MyRange")
sContent = oObj_1.getContent()
oReferredCells = oObj_1.getReferredCells()
oReferredCells.clearContents(23)
End Sub
oInitialTarget is the same as ThisComponent
String sContent is "$Sheet1.$B$3:$E$16" which is an absolutely absolute range address with 5 $-signs so it is possible to get the referred cells.