Hello,
I know how to assign a variable in basic a value from the spreadsheet. An in below,
Dim start_date
start_date = ThisComponent.Sheets(0).GetCellByPosition(0,0).Value
How do I assign a variable a range of values -- where the range is a named range?? I want to do something like
Dim name
name = ThisComponent.Sheets(0).GetCellsByName("NameOfRange").Value
Where names will be an array...
Thanks,
Saleem
[Solved] Pass an array from OOBasic to C++ uno Service
[Solved] Pass an array from OOBasic to C++ uno Service
Last edited by Hagar Delest on Fri Jul 13, 2012 11:40 pm, edited 2 times in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice 3.4.0
Mac OS X 10.5.8
Mac OS X 10.5.8
Re: OO Basic Question about Named Range
Actually getCellRangeByName might do this job.
Saleem
Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
Mac OS X 10.5.8
Re: OO Basic Question about Named Range
Hello,
I can define the variables as arrays
Dim compo_fields(0,3) as String
Initialize them manually in OOBasic and then pass them into C++ uno service. It works.
Instead of initializing these variable manually I want to assign the contents of a named range.
Saleem
I can define the variables as arrays
Dim compo_fields(0,3) as String
Initialize them manually in OOBasic and then pass them into C++ uno service. It works.
Instead of initializing these variable manually I want to assign the contents of a named range.
Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
Mac OS X 10.5.8
- Charlie Young
- Volunteer
- Posts: 1559
- Joined: Fri May 14, 2010 1:07 am
Re: OO Basic Question about Named Range
You can get the contents of a named range in one big gulpsaleem145 wrote:Hello,
I can define the variables as arrays
Dim compo_fields(0,3) as String
Initialize them manually in OOBasic and then pass them into C++ uno service. It works.
Instead of initializing these variable manually I want to assign the contents of a named range.
Saleem
Code: Select all
oArray = ...getCellRangeByName("name").getDataArray()Code: Select all
Dim newArray(UBound(oArray).UBound(oArray(0)))
for i = 0 to UBound(oArray)
for j = 0 to UBound(oArray(0))
newArray(i,j) = oArray(i)(j)
next j
next i
To use one of your addin functions in Basic (or JavaScript, or Python, or...), you can use XFunctionAccess, where you need that AddinInfo stuff we discussed earlier.
Code: Select all
Dim svc As Object
Dim result
svc = createUnoService("com.sun.star.sheet.FunctionAccess")
result = svc.callFunction("blahblah.myService1_implementation.ServiceName.Functionname",Array(arguments))
Apache OpenOffice 4.1.1
Windows XP
Windows XP
Re: How to pass an array from OOBasic to c++ uno Service
oArray = ...getCellRangeByName("name").getDataArray()
does the job....i was missing the getDataArray() in my code.
Thanks,
Saleem
does the job....i was missing the getDataArray() in my code.
Thanks,
Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
Mac OS X 10.5.8