Spread.Sheets Documentation
autoFitColumn Field
Represents the command used to automatically resize the column in a sheet.
* The command has a boolean field canUndo that indicates whether the command supports undo and redo operations, and an execute method that performs an execute or undo operation.
* The arguments of the execute method are as follows.
context {GC.Spread.Sheets.Workbook} The context of the operation.
options {Object} The options of the operation.
* options.sheetName {string} The sheet name.
* options.columns {Array} The resize columns; each item is an object which has a col.
* options.rowHeader {boolean} Whether the resized columns are in the row header area.
* options.autoFitType {GC.Spread.Sheets.AutoFitType} Whether the auto-fit action includes the header text.
isUndo {boolean} true if this is an undo operation; otherwise, false.
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, isRowHeader: false, autoFitType: GC.Spread.Sheets.AutoFitType.cell});
    });

<input type="button" id="button1" value="button1"/>
See Also

Reference

Commands type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.