Hi Andreas,

I think the Python UNO bridge works fine;  I managed to return an array of
values by using an array function.
I needed to return multiple arrays of different lengths;  to give a specific
example I made a wrapper around a
linear programming solver with input arguments 'c' (a vector), 'G' (a
matrix) and 'h' (a vector).  This routine
outputs a status string,   a vector 'x' and a vector 'z',  and I used an IDL
as

         string lp ([in] sequence < sequence <double> > c,
                    [in] com::sun::star::table::XCellRange x,
                    [in] sequence < sequence <double> > G,
                    [in] sequence < sequence <double> > h,
                    [in] com::sun::star::table::XCellRange z);

i.e., I used the XCellRange as a way to return additional variables by
"writing back" values in x and z.   This approach
works well for me in Python.

The only problem I have left is that I have optional arguments, some of
which are also "output" argument (albeit, in
the sense of being XCellRanges),  but that's not possible with a Calc
add-in.  So my work-around for this problem
is to have a different function 'lp2' with more arguments (all mandatory).

But in summary,  the Python UNO bridge seems fine for writing add-ins.

Joachim



On 5/25/07, Andreas Saeger <[EMAIL PROTECTED]> wrote:

Joachim Dahl wrote:
> me.
>
> So my problem is not so much of how to write a prototype of an
addin,  but
> rather how to
> implement something more advanced like "methodFour".
>
> Joachim
>

Hi Joachim,
http://wiki.services.openoffice.org/wiki/CompleteAddIn has a chapter
"Transforming sequence of sequence into array". This describes the same
problem as I tried to explain with my simple Basic function TWICE(array)
in http://www.oooforum.org/forum/viewtopic.phtml?t=57196. Only
array-functions, such as the built-in LINEST, can return more than one
value. The resulting array has to be converted to a 2-dimensional matrix
rather than a list of lists. So it is possible that python alone is not
suitable for add-ins that deal with sheet functions in array context.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to