Strange Behavior Passing in an Array of Strings

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Strange Behavior Passing in an Array of Strings

Postby saleem145 » Wed Dec 26, 2012 10:32 pm

I have written the following function in my addin

Code: Select all   Expand viewCollapse view
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
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Strange Behavior Passing in an Array of Strings

Postby Charlie Young » Wed Dec 26, 2012 11:20 pm

Your function, pasted from above, works fine for me with the scenario you describe. I get array entry [0][0].
Apache OpenOffice 4.1.1
Windows XP
User avatar
Charlie Young
Volunteer
 
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: Strange Behavior Passing in an Array of Strings

Postby saleem145 » Wed Dec 26, 2012 11:23 pm

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
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Strange Behavior Passing in an Array of Strings

Postby Charlie Young » Wed Dec 26, 2012 11:36 pm

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   Expand viewCollapse view
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.
Apache OpenOffice 4.1.1
Windows XP
User avatar
Charlie Young
Volunteer
 
Posts: 1559
Joined: Fri May 14, 2010 1:07 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron