SpreadJS 13
GC.Spread.Sheets Namespace / Commands type / autoFitColumn Field
In This Topic
    autoFitColumn Field
    In This Topic
    Represents the command used to automatically resize the column in a sheet.
    Syntax
    var value; // Type: autoFitColumn
    value = GC.Spread.Sheets.Commands.autoFitColumn;
    var autoFitColumn : autoFitColumn;
    Example
    This example automatically resizes the column.
    //Add data
    for (var col = 1; col < 6; col++) {
        for (var row = 2; row < 11; row++) {
            activeSheet.setValue(row, col, row + col);
        }
    }
    
    $("#button1").click(function () {
    var columns = [ { col: 3 } ];
    spread.options.allowUndo = true;
    spread.commandManager().execute({cmd: "autoFitColumn", sheetName: "Sheet1", columns: columns, rowHeader: false, autoFitType: GC.Spread.Sheets.AutoFitType.cell});
        });
    
    <input type="button" id="button1" value="button1"/>
    See Also

    Reference

    Commands type