SpreadJS 13
GC.Spread.Sheets Namespace / Workbook type / addCustomFunction Method
The function to add.
In This Topic
    addCustomFunction Method
    In This Topic
    Adds a custom function.
    Syntax
    var instance = new GC.Spread.Sheets.Workbook(host,
                                                options,
                                                options.sheetCount,
                                                options.font,
                                                options.allowUserDragMerge,
                                                options.allowUserDragDrop,
                                                options.allowUserDragFill,
                                                options.allowUserZoom,
                                                options.allowUserResize,
                                                options.allowUndo,
                                                options.allowSheetReorder,
                                                options.allowContextMenu,
                                                options.allowUserDeselect,
                                                options.defaultDragFillType,
                                                options.showDragFillSmartTag,
                                                options.showHorizontalScrollbar,
                                                options.showVerticalScrollbar,
                                                options.scrollbarShowMax,
                                                options.scrollbarMaxAlign,
                                                options.tabStripVisible,
                                                options.tabStripRatio,
                                                options.tabEditable,
                                                options.newTabVisible,
                                                options.tabNavigationVisible,
                                                options.cutCopyIndicatorVisible,
                                                options.cutCopyIndicatorBorderColor,
                                                options.backColor,
                                                options.backgroundImage,
                                                options.backgroundImageLayout,
                                                options.grayAreaBackColor,
                                                options.showResizeTip,
                                                options.showDragDropTip,
                                                options.showDragFillTip,
                                                options.showScrollTip,
                                                options.scrollIgnoreHidden,
                                                options.highlightInvalidData,
                                                options.useTouchLayout,
                                                options.hideSelection,
                                                options.resizeZeroIndicator,
                                                options.allowUserEditFormula,
                                                options.enableFormulaTextbox,
                                                options.autoFitType,
                                                options.referenceStyle,
                                                options.calcOnDemand,
                                                options.allowCopyPasteExcelStyle,
                                                options.allowExtendPasteRange,
                                                options.copyPasteHeaderOptions,
                                                options.scrollByPixel,
                                                options.scrollPixel,
                                                options.allowAutoCreateHyperlink,
                                                options.columnResizeMode,
                                                options.rowResizeMode,
                                                options.customList,
                                                options.scrollbarAppearance);
    var value; // Type: any
    value = instance.addCustomFunction(fn);
    function addCustomFunction( 
       fn : Function
    ) : any;

    Parameters

    fn
    The function to add.
    Example
    This example uses the addCustomFunction method.
    sheet.setValue(0,0,"112");
    sheet.setValue(1,0,"10");
    sheet.setValue(2,0,"223");
    sheet.setValue(3,0,"20");
    sheet.setValue(4,0,"334");
    sheet.setValue(5,0,"30");
    sheet.sortRange(0, 0, 6, 1, true, [
                    {index:0, ascending:true}
                      ]);
    
    function fn() {
        this.name = "fn";
        this.minArgs = 0;
        this.maxArgs = 0;
    }
    fn.prototype = new GC.Spread.CalcEngine.Functions.Function();
    fn.prototype.evaluate = function(args){
        return 100;
    }
    fn.prototype.description = function(){
        return {name:"fn",description:"This is my first function"};
    }
    spread.addCustomFunction(new fn());
    See Also