SpreadJS 13
GC.Spread.Sheets Namespace / Worksheet type / setCellType Method
The row index.
The column index.
The cell type.
The sheet area. If this parameter is not provided, it defaults to viewport.
In This Topic
    setCellType Method
    In This Topic
    Sets the cell type.
    Syntax
    var instance = new GC.Spread.Sheets.Worksheet(name);
    var returnValue; // Type: any
    returnValue = instance.setCellType(row, col, value, sheetArea);
    function setCellType( 
       row : number,
       col : number,
       value : Base,
       (optional) sheetArea : SheetArea
    ) : any;

    Parameters

    row
    The row index.
    col
    The column index.
    value
    The cell type.
    sheetArea
    The sheet area. If this parameter is not provided, it defaults to viewport.
    Example
    This example uses the setCellType method.
    var cellType = new GC.Spread.Sheets.CellTypes.Button(); 
    cellType.buttonBackColor("#FFFF00"); 
    cellType.text("this is a button"); 
    activeSheet.setCellType(1,1,cellType);
    
    spread.bind(GC.Spread.Sheets.Events.ButtonClicked, function (e, args) {
        var sheet = args.sheet, row = args.row, col = args.col;
        var cellType = activeSheet.getCellType(row, col);
        if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
            alert("Button Clicked");
        }
    });
    See Also

    Reference

    Worksheet type