OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How can I use structure ArrayWrapper of module Script?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
rvc44
Power User
Power User


Joined: 15 May 2007
Posts: 62
Location: Tambov, Russia

PostPosted: Tue Jul 10, 2007 6:56 am    Post subject: How can I use structure ArrayWrapper of module Script? Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Tue Jul 10, 2007 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
rvc44
Power User
Power User


Joined: 15 May 2007
Posts: 62
Location: Tambov, Russia

PostPosted: Tue Jul 10, 2007 10:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
rvc44
Power User
Power User


Joined: 15 May 2007
Posts: 62
Location: Tambov, Russia

PostPosted: Thu Jul 19, 2007 4:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group