I know that there are no "two dimensional arrays" in OpenOffice.org Basic,
but rather arrays of arrays, but that is kind of what this problem is all
about. I have an array like this:

StringArray=ThisComponent.Sheets.getByName("Example").getCellRangeByPosition(1,1,1,101).getDataArray()

I want to use the data of a single column to add to a combo box.
Unfortunately the data in String Array is organized "the wrong way", so I
can't use the addItems function of the combo box to put the whole array in
there in only one step. I figured that would be a quick way to fill a combo
box, wouldn't it?

However, the StringArray then have to be "transposed". In this example,
looking at it in the Watch window, it could look like this:

StringArray(0)(0)="Test"
StringArray(1)(0)="Text"
StringArray(2)(0)="Albatross"
…and so on.

So now, I have to bring all one-element-arrays out of the big array one by
one in a loop, which is time consuming. If the array looked like this, it
would be way easier and quicker:

StringArray(0)(0)="Test"
StringArray(0)(1)="Text"
StringArray(0)(2)="Albatross"
…and so on.

Then I just had to bring the whole array out from StringArray(0) and then I
could just bring the whole resulting array directly to the combo box,
without any loops what so ever.

So it seems like I need a transpose function, making rows into columns. If I
create one myself in OpenOffice.org Basic, the function will probably be
time consuming enough to make it meaningless, so my hope is now that there
already is such a function built into the system and that it's very fast
(for example, the built in search function seems to be very much faster than
a function created by myself in OpenOffice.org Basic that does the same job
would be, no matter how smart I am).

Or maybe there is a way to bring out a one dimensional array from a single
column? If there was, I think I should have found it myself, but maybe it
has a strange name or something… I would imagine something like this (and
now I am just making it up):

StringArray=ThisComponent.Sheets.getByName("Example").getColumnByPosition(1,1,101).getDataArray()

This would, if it existed, mean that StringArray would contain all data from
column 1, row 1 until 101.

Maybe there are other smart solutions for this? Anyone?

J.R.

Reply via email to