Hi Joachim,
glad to hear that your add-in works now. Well not everything was
possible but you are able to workaround the multiple returns.
I would suggest that you take a look on new add-in with a configuration
file to define the new add-in function 8with localization if you want).
This new approach has several advantages and it would be nice if you can
support this. I know it is not so important for you because your add-in
works but i think it is worth to support the latest features at least
for new implementations.
Or did you already have an xcu file for your add-in?
Juergen
Joachim Dahl wrote:
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]