Hello,
I’m trying to have a Pie-Chart switch from the display of actual values, in the Data Labels, to percentages and back.
In VBA I create a 1-dimensional array (with the percentages) and assign that array to the Values-Series of the Chart. To switch back I assign the original Range back to de Values-Series. That always worked for me.
Now I’m trying to do the same thing in LO Calc. First thing in my research was to find out where the values are stored and I managed to come up with an array which holds the values:
oSh = thiscomponent.sheets.getByIndex(0)
oCh = oSh.charts.getbyindex(0)
myArray() = oCh.embeddedObject.Data.Data
I expected myArray() to be 1-dimensional, but it seems it is a 2-dimensional array:
Print myArray(2) 'Fails, which makes sense for 2-dimensional.
Print myArray(2)(0) 'That works.
Now I tought I understanded it, but to my surprise, getting the Ubound for de second dimension seemed to be inpossible:
This statement gives an error massage saying:
“Inadmissible value or data type. Index out of defined range”.
Print UBound(myArray(),2)
So I tried to get more information by applying Listing 101 from Andrew Pitonyak’s book (http://www.pitonyak.org/OOME_3_0.pdf):
The arrayInfo() function from the book gives:
“Array dimensioned as myArray(0 to 7) As Object”
Print arrayInfo(myArray, "myArray")
I hope someone will be so kind to clarify this for me, because I’m getting quite confused now.
Just to be clear: I’m not looking for a solution, I already found one. I’m just looking for an explanation for the strange behavior of the array, returned from embeddedObject.Data.Data.
Thank you in advance.
Grtz.