SpreadJS製品ヘルプ
addCustomFunction メソッド
GC.Spread.Sheets 名前空間 > Workbook タイプ : addCustomFunction メソッド
追加する関数。
カスタム関数を追加します。
シンタックス
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.allSheetsListVisible,
                                            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.enableAccessibility,
                                            options.allowAutoCreateHyperlink,
                                            options.columnResizeMode,
                                            options.rowResizeMode,
                                            options.customList,
                                            options.scrollbarAppearance,
                                            options.pasteSkipInvisibleRange,
                                            options.allowAutoExtendFilterRange);
var value; // Type: any
value = instance.addCustomFunction(fn);
function addCustomFunction( 
   fn : Function
) : any;

パラメータ

fn
追加する関数。
使用例
次のサンプルコードは、addCustomFunctionメソッドを使用します。
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());
関連トピック

参照

Workbook タイプ
カスタム数式の作成