[Libreoffice-bugs] [Bug 36132] New: Extension: Calc-sheetAddin-function written in python don't return cell*ranges*

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Apr 11 05:18:44 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=36132

           Summary: Extension: Calc-sheetAddin-function written in python
                    don't return cell*ranges*
           Product: LibreOffice
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: medium
         Component: contrib
        AssignedTo: libreoffice-bugs at lists.freedesktop.org
        ReportedBy: karlooforum at arcor.de


Created an attachment (id=45474)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=45474)
Extensionfile ocapy.oxt with Calc-addin-function "Testrange"

Building a Calcaddin-extension I want to return a Cellrange, similar to return
of a Calcformula, for Example '=A1:C5' as Arrayformula.

I try it with following:

Xexample.idl
########################
#include  /opt/libreoffice/basis3.3/sdk/idl/com/sun/star/uno/XInterface.idl

// Xexample.idl
module com { module sheetfunctions {
    interface ocapy
    {
        any testrange( [in] any cellrange );
    };
}; };
##########################
*Test with Type "any [ ][ ] testrange.." leads to Compiler-errors from idlc

Pythonscript:
#################################
import uno
import unohelper
from com.sheetfunctions import Xexample


wrapper = uno.createUnoStruct('com.sun.star.script.ArrayWrapper')
wrapper.IsZeroIndex = False

class functions( unohelper.Base, Xocapy ):
    def __init__(self, ctx):
        self.ctx = ctx

    def testrange( self, cellrange ):
        if isinstance(cellrange, tuple):
            return  cellrange 
            #involving wrapper to return a range works only thru basic-bridge:
            #wrapper.Array = cellrange
            #return wrapper

        else:
            return cellrange


def createInstance( ctx ):
    return functions( ctx )

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
    createInstance,"com.sheetfunctions.ocapy.functions",
        ("com.sun.star.sheet.AddIn",),)
#################################################

Inside python I can work with Input "cellrange" as nestet tuple, but calling
from Calc for Example "=TESTRANGE(A1:B3)" as Arrayfomula or not returns:
'#Value'.
Calling the Function with a single Celladdress returns the Content from
Celladdress.

Is it a bug - is it a missing feature - or do I something wrong ?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Libreoffice-bugs mailing list