Page 1 of 1

Strange Behavior Passing in an Array of Strings

Posted: Wed Dec 26, 2012 10:32 pm
by saleem145
I have written the following function in my addin

Code: Select all

OUString MyService1Impl::test( Sequence< Sequence< OUString> > const &args) throw (RuntimeException)
{
      return args[0][0];
}
It just returns the first string in a range.

In Cell A1 type in "String1"
In Cell A2 type in "String2"

In Cell A3 type in =Test(A1:A2)

and it works -- the output will be String1.

Now in Cell B1 type in the formula = A1
In Cell B2 type in the formula = A2

In Cell B3 type in the formula = Test(B1:B2)

and it will return "..."??

Saleem

Re: Strange Behavior Passing in an Array of Strings

Posted: Wed Dec 26, 2012 11:20 pm
by Charlie Young
Your function, pasted from above, works fine for me with the scenario you describe. I get array entry [0][0].

Re: Strange Behavior Passing in an Array of Strings

Posted: Wed Dec 26, 2012 11:23 pm
by saleem145
Hmmm!

Even for =Test(B1:B2)....

where B1 and B2 contain a formula....

It works correctly for me if I paste the values from A1 and A2 to B1 and B2 thereby removing the formula. But if I put in the formula =A1 and =A2 then it returns "..."

Also Test(B1) by iteslf works correctly...this seems to only happen if we pass in a range of strings where one of the strings contains a formula....

Saleem

Re: Strange Behavior Passing in an Array of Strings

Posted: Wed Dec 26, 2012 11:36 pm
by Charlie Young
I changed the function and argument names because "Test" and "args" are too generic, and my Impl name is different, but none of that should matter

Code: Select all

OUString SAL_CALL OldProjectImpl::getFirstString( Sequence< Sequence< OUString> > const &inStrings) throw (RuntimeException)
{
      return inStrings[0][0];
}
Pasted out of the program which is open in another window on my system as I type.