| View previous topic :: View next topic |
| Author |
Message |
rvc44 Power User


Joined: 15 May 2007 Posts: 62 Location: Tambov, Russia
|
Posted: Tue Jul 10, 2007 6:56 am Post subject: How can I use structure ArrayWrapper of module Script? |
|
|
Can anybody post an example how can I use com.sun.star.script.ArrayWrapper structure of module Script to represent UNO sequenced arrays as Multi-Dimensional arrays with 1 based indices to pass this arrays between two different languages OO Basic (Star Basic) and VFP. I have expirience in automating OO Calc from VFP and have trouble in VFP by running following piece of code:
| Code: | | oTarget.setDataArray( oTarget.getDataArray ) |
In this code oTarget.getDataArray return empty array!
In OO Basic all following code works fine:
| Code: |
oDoc = ThisComponent
oSheet2 = oDoc.getSheets().getByIndex( 1 )
oCell2 = oSheet2.getCellByPosition ( 3, 0 )
oTarget = oSheet2.getCellRangeByPosition( 3, 0, 3, 9 )
sString = "=IF(A1=0;" & Chr$( 34 ) & Chr$( 34 ) & ";MROUND(((B1-A1)/A1)*100;0.01))"
oCell2.setFormula( sString )
oTarget.fillAuto( 0, 1 )
oDoc.calculate()
oTarget.setDataArray( oTarget.getDataArray )
|
...but this code don't work in other languages while UNO used an "array of arrays" and not used Multi-Dimensional arrays by default.
If you pass from VFP Multi-Dimensional array to OO, you must transpose this array! This works fine for method setDataArray.
But method getDataArray don't work and return only empty array.
Please help! |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Tue Jul 10, 2007 12:13 pm Post subject: |
|
|
To begin with the bad news: I have no idea how to get the result of getDataArray() across your VFP bridge.
But thank you for asking about c.s.s.script.ArrayWrapper. I was not aware of this and provided a snippet how ArrayWrapper can be used to return a multi-dimensional array from a Python function. Plain Python, as it comes with OOo, handles only nested lists such as setDataArray(rows(columns()))
The snippets in Basic and Python:
http://www.oooforum.org/forum/viewtopic.phtml?p=236778#236778
May be you can work around your problem by using another language to get the DataArray and pass it over to VFP? |
|
| Back to top |
|
 |
rvc44 Power User


Joined: 15 May 2007 Posts: 62 Location: Tambov, Russia
|
Posted: Tue Jul 10, 2007 10:27 pm Post subject: |
|
|
Unfortunately there is no settings in OO object model to switching type of array which return method getDataArray: List-of-List (by default) or Multi-Dimensional array.
This problem is VERY actual for many people trying to automate OO from another languages, such as C++, VFP etc and stopped automating process!!!
Therefore many people prefer MS VBA without this problem.
This problem need to be reported to be changed in next stable version! |
|
| Back to top |
|
 |
rvc44 Power User


Joined: 15 May 2007 Posts: 62 Location: Tambov, Russia
|
Posted: Thu Jul 19, 2007 4:33 am Post subject: |
|
|
On my humble opinion, ArrayWrapper struct is designed for Python language only!
That's right or not?
Can anybody show using this structure in other languages? ... by using automation? |
|
| Back to top |
|
 |
|