Hi,

when answering your question (privately), I wasn't aware, that it should be a calc addin. I never created a calc addin, but my impression from reading

http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/AddIn.html

is, that there can only be exactly one return value, at least it is not explicitly mentioned, that out parameters are supported. Maybe someone who knows Calc better can confirm this.

Assuming this is correct, your idl description can't work, you then cant return a string and a 2 dimensional double array at the same time. What should work is

interface Xcvxopt : com::sun::star::uno::XInterface
{
   sequence < sequence < long > > lp( [in] sequence <sequence<long>> c);
};

Your code below was still errornously, because you just passed a 1 dimensional array (and this will not convert correctly). This should work:

    def lp(self, c):
        x = (1,2),  # the additional , makes this a 2 dimensional array
        return x

BTW: you seem to have a weakness for short/cryptic function/inferface/argument names, haven't you ? You should at least stick to the convention to write the 2nd letter of the interface name in capitals.

Bye,

Joerg

Joachim Dahl wrote:
Maybe I got a small step further.  I received a few advices from Jörg
Budischewski:

Say, I define my IDL like this:
   interface Xcvxopt : com::sun::star::uno::XInterface
   {
     string lp( [in] sequence < sequence < long > > c,
         [out] sequence < sequence < long > > x);
   };

The Jörg suggested I define my Python method as:
   def lp(self, c, x):
       x = (1,2)
       return "test", x

but whenever I try to invoke it from the spreadsheet as
=lp(A1:A2,B1:B2)   (and all sorts of variations)
I get a #NAME? error,  so it's like oocalc doesnt parse my Python add-in
because of an error.  I should mention
that if I only have [in] fields in the IDL,  then my add-in works fine.

How else would I invoke it from the spreadsheet?



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

Reply via email to