On Thu, 10 Mar 2005 11:41:53 +0800,
[EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hello
> 
> I'm stuck on what is probably a simple question. I have created a function
> in StarBasic to simplify the cell formulae that I'm writing in a Calc
> spreadsheet. I want to be able to call the standard sheet functions like
> LOG10, POWER, LOOKUP from my little BASIC function and I can't figure out
> if (or what) fully qualified name I need to prefix (in this example) Log10.
[snip]

Hi there,

To access spreadsheet's builtin functions, you need to use the
FunctionAccess service.

You can see the code below just for an example of how to use it.

------------------------------------------------------------------
Sub funcAccess

        svc = createUnoService( "com.sun.star.sheet.FunctionAccess" )
        arg = array( 3.456 )
        print svc.callFunction( "LOG10", arg )
        arg = array( 10, 2 )
        print svc.callFunction( "POWER", arg )
        arg = array( "A-", "FOO", 2, "BAR" )
        print svc.callFunction( "CONCATENATE", arg )
        
        oSheet = ThisComponent.Sheets(0)
        oCellRange = oSheet.getCellRangeByPosition( 0, 0, 0, 2 )
        arg = array( oCellRange )
        print svc.callFunction( "SUM", arg )
        
End Sub
------------------------------------------------------------------

It gets a bit tricky on how arguments are passed to a function of
different type, but I hope you get the idea.

More on this below:
http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/XFunctionAccess.html

HTH,

Kohei

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

Reply via email to