You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2013/12/14 18:19:32 UTC
[Bug 118237] python add-in cannot return array in calc in-cell
function
https://issues.apache.org/ooo/show_bug.cgi?id=118237
hanya <ha...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hanya.runo@gmail.com
--- Comment #2 from hanya <ha...@gmail.com> ---
The following add-in function written in Python can return array.
import uno
import unohelper
from com.sun.star.lang import XServiceInfo
from mytools.sheet import XPySheetFuncTest
class PyFuncTest(unohelper.Base, XPySheetFuncTest, XServiceInfo):
def __init__(self, ctx, *args):
pass
NAMES = ("com.sun.star.sheet.AddIn",
"mytools.sheet.PySheetFuncTest")
def supportsService(self, name):
return name in self.NAMES
def getSupportedServiceNames(self):
return self.NAMES
def getImplementationName(self):
return "mytools.sheet.PySheetFuncTest"
def pyFuncTest(self):
""" Returns always 100.0
@return double """
return 100.0
def pyFuncArrayTest(self):
""" Returns ((1, 2), (3, 4))
@return double[][] """
a = ((1, 2), (3, 4))
return a
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
PyFuncTest,
"mytools.sheet.PySheetFuncTest",
("com.sun.star.sheet.AddIn", "mytools.sheet.PySheetFuncTest"))
The own interface is defined as follows:
#ifndef __MYTOOLS_SHEET_XPYSHEETFUNCTEST_IDL__
#define __MYTOOLS_SHEET_XPYSHEETFUNCTEST_IDL__
#ifndef __com_sun_star_uno_XInterface_idl__
#include <com/sun/star/uno/XInterface.idl>
#endif
#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
#include <com/sun/star/lang/IllegalArgumentException.idl>
#endif
module mytools { module sheet {
/** Test functions.
*/
interface XPySheetFuncTest : ::com::sun::star::uno::XInterface
{
/** Normal function test.
*/
double pyFuncTest();
/** Array function test.
*/
sequence< sequence< double > > pyFuncArrayTest();
};
}; };
#endif
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.