I'm trying to figure out how to get absolute name of a range from cellrangeaddressconversion. This code already returns cellrangeaddress. But I need absolutename.
Anyone has any idea?
I am not able to find com.sun.star.table.CellRangeAddressConversion in the API documentation. Where did you find that?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
The closest thing to an absolute address is the XLA2Representation. I suppose you could manipulate that into an absolutes address but OO Basic is clumsy handling strings.
@RoryOF - Thanks for the tip. Andrew must have found that service in the OpenOffice code.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
I should try to learn using this MRI and other extension but I don't have a coding background and I easily feel like I'm lost. Anyhow thanks.
Now I made up another way to get absolutename. Here I add the code for the people like me. this code creates tags for ranges in a loop.
REM ***** BASIC *****
Sub AddNamedRange1()
Dim oRange ' The created range.
Dim oNamedRanges ' All named ranges.
Dim nameOfRange ' Name of the named range to create.
Dim oCell ' Cell object.
Dim oConvxa$
Dim sK1
Dim sK2
Dim ocl1 as integer
Dim orw1 as integer
Dim ocl2 as integer
Dim orw2 as integer
osht=thiscomponent.sheets(0)
for i= 0 to 1
nameOfRange1 = "HST" & 10 + i
oNamedRanges = ThisComponent.NamedRanges
Dim oCellAddress1 As new com.sun.star.table.CellAddress
oCellAddress1.Sheet = 0
oCellAddress1.Column = oc11
oCellAddress1.Row = orw1 + 1
ocl1 = 0
orw1 = 675 + i * 25
ocellrange1=osht.getcellrangebyposition(ocl1 , orw1 + 1 , ocl1 + 23 , orw1 + 24)
sK1 = ocellrange1.absolutename
msgbox sk1
oNamedRanges.addNewByName(nameOfRange1, sK1, ocelladdress1, 0)
nameOfRange2 = "vST" & 10 + i
Dim oCellAddress2 As new com.sun.star.table.CellAddress
oCellAddress2.Sheet = 0
oCellAddress2.Column = ocl2
oCellAddress2.Row = orw2 + 1
ocl2 = 25
orw2 = 675 + i * 25
ocellrange2=osht.getcellrangebyposition(ocl2 , orw2 + 1, ocl2 + 23 , orw2 + 24)
sK2 = ocellrange2.absolutename
msgbox sk2
oNamedRanges.addNewByName(nameOfRange2, sK2, ocelladdress2, 0)
next
end sub
REM ***** BASIC *****
option explicit
sub test
Dim oDoc as object
Dim oSheets as object
Dim oSheet as object
Dim oRange as object
Dim oConvx as object
Dim oCellRangeAddress As new com.sun.star.table.CellRangeAddress
Dim lCol as long
Dim lRow as long
Dim sConvxa as string
Dim sConvxb as string
Dim sAbsName as string
oDoc = ThisComponent
oSheets = oDoc.Sheets
oSheet = oSheets.GetByIndex(0)
lCol = 0
lRow = 1
oCellRangeAddress.Sheet = 0
oCellRangeAddress.StartColumn = lCol
oCellRangeAddress.EndColumn = lCol + 23
oCellRangeAddress.StartRow = lRow + 1
oCellRangeAddress.EndRow = lRow + 24
oConvx = thiscomponent.createInstance("com.sun.star.table.CellRangeAddressConversion")
oConvx.Address = oCellRangeAddress
sConvxa = oConvx.persistentrepresentation
sConvxb = oConvx.UserInterfaceRepresentation
oRange = oSheet.getCellRangeByName(sConvxb)
sAbsName = oRange.AbsoluteName
Print sAbsName
end sub
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.