[]
        
(Showing Draft Content)

GC.Spread.Sheets.Commands

Namespace: Commands

Spread.Sheets.Commands

Table of contents

Variables

Functions

Variables

DefineColumn

DefineColumn: Object

Represents the command used to define the column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The specified col for inserting, optional.

param The defined column.

param true if this is an undo operation; otherwise, false.

example

//This example uses the define column action.
// define the column properties
spread.commandManager().execute({cmd: "DefineColumn", sheetName: "Sheet1", { col: 1, column: { value: 'column1' }}});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col?: number ; column: IColumn ; sheetName: string }) => any

ModifyColumn

ModifyColumn: Object

Represents the command used to modify the column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The specified col.

param The modified column.

param true if this is an undo operation; otherwise, false.

example

//This example uses the modify column action.
// modify the column properties
spread.commandManager().execute({cmd: "ModifyColumn", sheetName: "Sheet1", { col: 1, column: { value: 'column1' }}});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; column: IColumn ; sheetName: string }) => any

RemoveColumn

RemoveColumn: Object

Represents the command used to remove the column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The specified col.

param true if this is an undo operation; otherwise, false.

example

//This example uses the remove column action.
// remove the column properties
spread.commandManager().execute({cmd: "RemoveColumn", sheetName: "Sheet1", { col: 1 }});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; sheetName: string }) => any

autoFitColumn

autoFitColumn: Object

Represents the command used to automatically resize the column in a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize columns; each item is an object which has a col.

param Whether the resized columns are in the row header area.

param Whether the auto-fit action includes the header text.

param true if this is an undo operation; otherwise, false.

example

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});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { autoFitType: AutoFitType ; columns: Object[] ; rowHeader: boolean ; sheetName: string }, isUndo: boolean) => any

autoFitRow

autoFitRow: Object

Represents the command used to automatically resize the row in a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize rows; each item is an object which has a row.

param Whether the resized rows are in the column header area.

param Whether the auto-fit action includes the header text.

param true if this is an undo operation; otherwise, false.

example

spread.options.allowUndo = true;
var rows = [ { row: 3 } ];
spread.commandManager().execute({cmd: "autoFitRow", sheetName: "Sheet1", rows: rows, columnHeader: false, autoFitType: GC.Spread.Sheets.AutoFitType.cell});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { autoFitType: AutoFitType ; columnHeader: boolean ; rows: Object[] ; sheetName: string }, isUndo: boolean) => any

cancelInput

cancelInput: Object

Represents the command used to stop cell editing and cancel input.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// stop cell editing with invoking command
// this sample will cancel the input editor after 2 Second
activeSheet.setValue(0, 0, '12312');
activeSheet.startEdit();
window.setTimeout(function() {
    spread.commandManager().execute({ cmd: "cancelInput", sheetName: "Sheet1" });
}, 2000);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

changeEditorStatus

changeEditorStatus: Object

Represents the command used to switch the editor status between enter and edit mode when a cell is editing.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// start editing a cell with invoking command
spread.commandManager().execute({cmd: "changeEditorStatus", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

changeFormulaReference

changeFormulaReference: Object

Represents the command used to switch the formula reference between relative, absolute, and mixed when editing formulas.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false. //This example uses the changeFormulaReference action to switch the formula reference. spread.commandManager().execute({cmd: "changeFormulaReference", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clear

clear: Object

Represents the command used to clear the cell value.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// clear selected cells with the tab key
spread.commandManager().setShortcutKey('clear', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key

// clear selected cells with invoking command
spread.commandManager().execute({cmd: "clear", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clearAndEditing

clearAndEditing: Object

Represents the command used to clear the active cell value and enters edit mode.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// clear active cell and enter edit mode with invoking command
spread.commandManager().execute({cmd: "clearAndEditing", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clearValues

clearValues: Object

Represents the command used to clear cell values on a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The clear cell value ranges whose item type is GC.Spread.Sheets.Range.

param true if this is an undo operation; otherwise, false.

example

spread.options.allowUndo = true;
spread.commandManager().execute({cmd: "clearValues", sheetName: "Sheet1", ranges: [new GC.Spread.Sheets.Range(8, 5, 2, 1)]});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { ranges: Range[] ; sheetName: string }, isUndo: boolean) => any

clipboardPaste

clipboardPaste: Object

Represents the command used for a Clipboard paste on the worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The source sheet.

param The source range array which item type is GC.Spread.Sheets.Range.

param The target range array which item type is GC.Spread.Sheets.Range.

param Whether the operation is cutting or copying.

param The text on the clipboard.

param The Clipboard pasting option that indicates which content to paste.

param true if this is an undo operation; otherwise, false.

example

//This example uses the clipboardPaste method.
activeSheet.setValue(0, 0, 1, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(1, 0, 2, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setFormula(2, 0, "=A1+A2", GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(0, 1, 3, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(1, 1, 4, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setFormula(2, 1, "=B1+B2", GC.Spread.Sheets.SheetArea.viewport);
var fromRange = [new GC.Spread.Sheets.Range(0, 0, 3, 2)];
var toRanges = [new GC.Spread.Sheets.Range(5, 0, 3, 2)];
$("#button1").click(function () {
    //Cut Paste Action
    spread.commandManager().execute({cmd: "clipboardPaste", sheetName: "Sheet1", fromSheet: activeSheet, fromRanges: fromRange, pastedRanges: toRanges, isCutting: true, clipboardText: "", pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all});
});
$("#button2").click(function () {
    spread.commandManager().execute({cmd: "clipboardPaste", sheetName: "Sheet1", fromSheet: activeSheet, fromRanges: fromRange, pastedRanges: toRanges, isCutting: false, clipboardText: "", pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all});
});
//Add button controls to page
<input type="button" id="button1" value="button1"/>
<input type="button" id="button2" value="button2"/>

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { clipboardText: string ; fromRanges: Range[] ; fromSheet: Worksheet ; isCutting: boolean ; pasteOption: ClipboardPasteOptions ; pastedRanges: Range[] ; sheetName: string }, isUndo: boolean) => any

commitArrayFormula

commitArrayFormula: Object

Represents the command used to commit the cell editing and sets the array formula to the active range.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// commit the cell editing and sets the array formula to the active range with invoking command
spread.commandManager().execute({cmd: "commitArrayFormula", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

commitInputNavigationDown

commitInputNavigationDown: Object

Represents the command used to stop cell editing and moves the active cell to the next row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// stop cell editing and moves the active cell to the next row with invoking command
activeSheet.setValue(1, 1, '12312');
activeSheet.setActiveCell(1,1);
activeSheet.startEdit();
window.setTimeout(function() {
    spread.commandManager().execute({cmd: "commitInputNavigationDown", sheetName: "Sheet1"});
}, 1000);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

commitInputNavigationUp

commitInputNavigationUp: Object

Represents the command used to stop cell editing and moves the active cell to the previous row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// stop cell editing and moves the active cell to the previous row with invoking command
activeSheet.setValue(1, 1, 'SpreadJS');
activeSheet.setActiveCell(1,1);
activeSheet.startEdit();
window.setTimeout(function() {
    spread.commandManager().execute({cmd: "commitInputNavigationUp", sheetName: "Sheet1"});
}, 1000);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

copy

copy: Object

Represents the command used to copy the selected item text to the Clipboard.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// copy the selected items text to the Clipboard with invoking command
spread.commandManager().execute({cmd: "copy", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

copySheet

copySheet: Object

Represents the command used to copy sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The clone sheet name.

param The target index.

param The new sheet name.

param Whether to bind data source to clone sheet

example

//This example copy a sheet.
spread.commandManager().execute({cmd: "copySheet", sheetName: "Sheet1", targetIndex: targetIndex, newName: "Sheet1 (2)", includeBindingSource: true});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { includeBindingSource: boolean ; newName: string ; sheetName: string ; targetIndex: number }) => void

cut

cut: Object

Represents the command used to cut the selected item text to the Clipboard.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// cut the selected items text to the Clipboard with invoking command
spread.commandManager().execute({cmd: "cut", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

deleteFloatingObjects

deleteFloatingObjects: Object

Represents the command for deleting the floating objects.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// delete the floating objects with invoking command
spread.commandManager().execute({cmd: "deleteFloatingObjects", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => boolean

dragCopyFloatingObjects

dragCopyFloatingObjects: Object

Represents the command used to drag and copy the floating objects on the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The names array of floating objects.

param The horizontal offset.

param The vertical offset.

param true if this is an undo operation; otherwise false.

example

// copy floating objects with invoking command
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("floatingObject1", 10, 10, 60, 64);
var div = document.createElement('div');
div.innerHTML = '<span> SpreadJS supports FloatingObject.</span>'+
'<div style="border: 1px dotted  gray; width: 60%; height:70%; margin:auto;">' +
'<ul><li>First list</li></ul><ul><li>Second list</li></ul></div>';
customFloatingObject.content(div);
activeSheet.floatingObjects.add(customFloatingObject);
spread.commandManager().execute({cmd: "dragCopyFloatingObjects", sheetName: "Sheet1", floatingObjects: ["floatingObject1"], offsetX: 100, offsetY: 200});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

dragDrop

dragDrop: Object

Represents the command used to drag a range and drop it onto another range on the worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation. commandOptions The options of the operation. commandOptions.sheetName The sheet name. commandOptions.fromRow The source row index for the drag drop. commandOptions.fromColumn The source column index for the drag drop. commandOptions.toRow The destination row index for the drag drop. commandOptions.toColumn The destination column index for the drag drop. commandOptions.rowCount The row count for the drag drop. commandOptions.columnCount The column count for the drag drop. commandOptions.copy If set to true copy; otherwise, cut if false. commandOptions.insert If set to true inserts the drag data in the drop row or column. commandOptions.option Indicates the content type to drag and drop.

param true if this is an undo operation; otherwise, false.

example

spread.options.allowUndo = true;
spread.commandManager().execute({cmd: "dragDrop",  sheetName: "Sheet1", fromRow:2, fromColumn:1, toRow:12, toColumn:2, rowCount:2, columnCount:2, copy: true, insert: false, option: GC.Spread.Sheets.CopyToOptions.value});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { columnCount: number ; copy: boolean ; fromColumn: number ; fromRow: number ; insert: boolean ; option: CopyToOptions ; rowCount: number ; sheetName: string ; toColumn: number ; toRow: number }, isUndo: boolean) => boolean

editCell

editCell: Object

Represents the command used to apply a new value to a cell on the worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The row index of the cell.

param The column index of the cell.

param The new value of the cell.

param Whether to format the new value automatically.

param true if this is an undo operation; otherwise, false.

example

// apply a new value to a cell with invoking command
spread.commandManager().execute({cmd: "editCell", sheetName: "Sheet1", row: 1, col: 1, newValue: "123", autoFormat: true});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { autoFormat: boolean ; col: number ; newValue: any ; row: number ; sheetName: string }, isUndo: boolean) => any

expandColumnOutline

expandColumnOutline: Object

Represents the command to expand or collapse a column range group.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline summary index.

param The outline level.

param Whether to make the outline collapsed or expanded.

param true if this is an undo operation; otherwise, false.

example

// collapse a column range group with invoking command
spread.commandManager().execute({cmd: "expandColumnOutline", sheetName: "Sheet1", index: 5, level: 0, collapsed: true});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { collapsed: boolean ; index: number ; level: number ; sheetName: string }, isUndo: boolean) => boolean

expandColumnOutlineForLevel

expandColumnOutlineForLevel: Object

Represents the command used to expand or collapse column range groups on the same level.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline level.

param true if this an undo operation; otherwise, false.

example

// expand or collapse a column range group with invoking command
spread.commandManager().execute({cmd: "expandColumnOutlineForLevel", sheetName: "Sheet1", level: 0});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { level: number ; sheetName: string }, isUndo: boolean) => boolean

expandRowOutline

expandRowOutline: Object

Represents the command to expand or collapse a row range group.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline summary index.

param The outline level.

param Whether to make the outline collapsed or expanded.

param true if this is an undo operation; otherwise, false.

example

// expand a row range group with invoking command
spread.commandManager().execute({cmd: "expandRowOutline", sheetName: "Sheet1", index: 5, level: 0, collapsed: false});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { collapsed: boolean ; index: number ; level: number ; sheetName: string }, isUndo: boolean) => boolean

expandRowOutlineForLevel

expandRowOutlineForLevel: Object

Represents the command used to expand or collapse row range groups on the same level.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline level.

param true if this is an undo operation; otherwise, false.

example

// expand or collapse a row range group with invoking command
spread.commandManager().execute({cmd: "expandRowOutlineForLevel", sheetName: "Sheet1", level: 0});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { level: number ; sheetName: string }, isUndo: boolean) => boolean

fill

fill: Object

Represents the command used to drag and fill a range on the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The start range.

param The fill range.

param The auto fill type.

param The fill direction.

param true if an undo operation; otherwise, false.

example

spread.options.allowUndo = true;
var srange = new GC.Spread.Sheets.Range(10, 5, 1, 1);
var frange = new GC.Spread.Sheets.Range(11, 5, 5, 1);
spread.commandManager().execute({cmd: "fill", sheetName: "Sheet1", startRange: srange, fillRange: frange, autoFillType: GC.Spread.Sheets.Fill.AutoFillType.fillSeries, fillDirection: GC.Spread.Sheets.Fill.FillDirection.down });

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { autoFillType: AutoFillType ; fillDirection: FillDirection ; fillRange: Range ; sheetName: string ; startRange: Range }, isUndo: boolean) => boolean

moveFloatingObjects

moveFloatingObjects: Object

Represents the command for moving floating objects.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The names array of floating objects.

param The horizontal offset.

param The vertical offset.

param true if this is an undo operation; otherwise, false.

example

// move floating objects with invoking command
spread.commandManager().execute({cmd: "moveFloatingObjects", sheetName: "Sheet1", floatingObjects: ["floatingObject1", "floatingObject2"], offsetX: 10, offsetY: 20});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

moveSheet

moveSheet: Object

Represents the command used to move sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The target index.

example

//This example move a sheet.
spread.commandManager().execute({cmd: "moveSheet", sheetName: "Sheet1", targetIndex: targetIndex});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; targetIndex: number }) => boolean

moveToNextCell

moveToNextCell: Object

Represents the command used to move the active cell to the next cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the moveToNextCell action.
spread.focus();
spread.commandManager().setShortcutKey('moveToNextCell', GC.Spread.Commands.Key.a, false, false, false, false); // a

// move the active cell to the next cell with invoking command
spread.commandManager().execute({cmd: "moveToNextCell", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToNextCellThenControl

moveToNextCellThenControl: Object

Represents the command used to select the next control if the active cell is the last visible cell; otherwise, move the active cell to the next cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the moveToNextCellThenControl action.
spread.commandManager().setShortcutKey('moveToNextCellThenControl', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('moveToPreviousCellThenControl', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToPreviousCell

moveToPreviousCell: Object

Represents the command used to move the active cell to the previous cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the moveToPreviousCell action.
spread.commandManager().setShortcutKey('moveToPreviousCell', GC.Spread.Commands.Key.a, false, false, false, false); // a

// move the active cell to the previous cell with invoking command
spread.commandManager().execute({cmd: "moveToPreviousCell", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToPreviousCellThenControl

moveToPreviousCellThenControl: Object

Represents the command used to select the previous control if the active cell is the first visible cell; otherwise, move the active cell to the previous cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the moveToPreviousCellThenControl action.
spread.commandManager().setShortcutKey('moveToNextCellThenControl', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('moveToPreviousCellThenControl', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationBottom: Object

Represents the command used to move the active cell to the last row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the navigationBottom action to the Tab key.
spread.commandManager().setShortcutKey('navigationDown', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('navigationBottom', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationDown: Object

Represents the command used to move the active cell to the next row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the navigationDown key.
spread.commandManager().setShortcutKey('navigationDown', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('navigationBottom', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationEnd: Object

Represents the command used to move the active cell to the last column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationEnd method.
spread.commandManager().setShortcutKey('navigationEnd', GC.Spread.Commands.Key.tab,  false, false, false, false); // Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationEnd2: Object

Represents the command used to move the active cell to the last column without regard to frozen trailing columns.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationEnd2 action.
spread.commandManager().setShortcutKey("navigationEnd2", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationFirst: Object

Represents the command used to move the active cell to the first cell in the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationFirst action.
spread.commandManager().setShortcutKey("navigationFirst", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationHome: Object

Represents the command used to move the active cell to the first column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationHome action.
spread.commandManager().setShortcutKey("navigationHome", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationHome2: Object

Represents the command used to move the active cell to the first column without regard to frozen columns.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationHome2 action.
spread.commandManager().setShortcutKey("navigationHome2", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationLast: Object

Represents the command used to move the active cell to the last cell in the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationLast action.
spread.commandManager().setShortcutKey("navigationLast", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationLeft: Object

Represents the command used to move the active cell to the previous column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationLeft action.
spread.commandManager().setShortcutKey("navigationLeft", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationNextSheet: Object

Represents the command used to move the active sheet to the next sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationNextSheet action.
spread.commandManager().setShortcutKey("navigationNextSheet", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPageDown: Object

Represents the command used to move the active cell down one page of rows.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationPageDown action.
spread.commandManager().setShortcutKey("navigationPageDown", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPageUp: Object

Represents the command used to move the active cell up one page of rows.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationPageUp action.
spread.commandManager().setShortcutKey("navigationPageUp", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPreviousSheet: Object

Represents the command used to move the active sheet to the previous sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationPreviousSheet action.
spread.commandManager().setShortcutKey("navigationNextSheet", GC.Spread.Commands.Key.a, false, false, false, false);
spread.commandManager().setShortcutKey("navigationPreviousSheet", GC.Spread.Commands.Key.c, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => any

navigationRight: Object

Represents the command used to move the active cell to the next column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationRight action.
spread.commandManager().setShortcutKey("navigationRight", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationTop: Object

Represents the command used to move the active cell to the first row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the navigationTop action.
spread.commandManager().setShortcutKey("navigationTop", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationUp: Object

Represents the command used to move the active cell to the previous row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the navigationUp action to a.
spread.commandManager().setShortcutKey('navigationUp', GC.Spread.Commands.Key.a, false, false, false, false); // a

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

openCalculator

openCalculator: Object

Represents the command used to open a calculator picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a calculator with invoking command
spread.commandManager().execute({cmd: "openCalculator", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openColorPicker

openColorPicker: Object

Represents the command used to open a color picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a color picker with invoking command
spread.commandManager().execute({cmd: "openColorPicker", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openDateTimePicker

openDateTimePicker: Object

Represents the command used to open a datetime picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a dateTimePicker with invoking command
spread.commandManager().execute({cmd: "openDateTimePicker", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openList

openList: Object

Represents the command used to open a list picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a list with invoking command
spread.commandManager().execute({cmd: "openList", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openMonthPicker

openMonthPicker: Object

Represents the command used to open a month picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a month picker with invoking command
spread.commandManager().execute({cmd: "openMonthPicker", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openMultiColumn

openMultiColumn: Object

Represents the command used to open a multi-column list picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a MultiColumn with invoking command
spread.commandManager().execute({cmd: "openMultiColumn", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openPasteSpecialDialog

openPasteSpecialDialog: Object

Represents the command used to open paste special dialog.

param The context of the operation.

example

//This example opens the paste special dialog.
spread.commandManager().execute({cmd: "openPasteSpecialDialog", sheetName: spread.getActiveSheet().name()});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook) => void

openSlider

openSlider: Object

Represents the command used to open a slider picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a slider with invoking command
spread.commandManager().execute({cmd: "openSlider", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openTimePicker

openTimePicker: Object

Represents the command used to open a time picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a TimePicker with invoking command
spread.commandManager().execute({cmd: "openTimePicker", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openUrl

openUrl: Object

Represents the command used to open the url of the hyperlink cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The url string.

param The target type, it's default is blank.

param true if this is an undo operation; otherwise, false.

example

// clear open the url of the hyperlink cell with invoking command
spread.commandManager().execute({cmd: "openUrl", sheetName: "Sheet1", url: "https://www.spreadjs.com", target: GC.Spread.Sheets.Hyperlink.HyperlinkTargetType.blank});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; target?: HyperlinkTargetType ; url: string }, isUndo: boolean) => any

openWorkflowList

openWorkflowList: Object

Represents the command used to open a workflow list picker in specified cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet area.

param The rowIndex.

param The columnIndex.

param true if this is an undo operation; otherwise, false.

example

// open a color picker with invoking command
spread.commandManager().execute({cmd: "openWorkflowList", sheetName: "Sheet1", row: 1, col: 2});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

outlineColumn

outlineColumn: Object

Represents the command for grouping a column outline (range group) on a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline starting index.

param The number of rows or columns to group or ungroup in the outline.

param true if this is an undo operation; otherwise, false.

example

//This example creates a group.
spread.options.allowUndo = true;
spread.commandManager().execute({cmd: "outlineColumn", sheetName: "Sheet1", index: 3, count: 5});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

outlineRow

outlineRow: Object

Represents the command for grouping a row outline (range group) on a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline starting index.

param The number of rows or columns to group or ungroup in the outline.

param true if this is an undo operation; otherwise, false.

example

//This example undoes an action.
spread.options.allowUndo = true;
spread.commandManager().execute({cmd: "outlineRow", sheetName: "Sheet1", index: 3, count: 5});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

paste

paste: Object

Represents the command used to paste the selected items from the Clipboard to the current sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The inserted data needs to be moved in the direction.

param The option of paste.

param The pasting text of clipboard.

param The pasting HTML of clipboard.

param

param The option of paste operation.

param whether to skip the blank cells in the copied range without replacing the corresponding cells.

param whether to change columns of copied data to rows and vice versa.

param whether to paste cell references.

param true if this is an undo operation; otherwise, false.

example

// paste the selected items from the Clipboard to the current sheet with invoking command
spread.commandManager().execute({cmd: "paste", sheetName: "Sheet1", pasteText: "test"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { pasteOption: ClipboardPasteOptions ; pasteSpecialOptions: Object ; sheetName: string ; shiftCells?: InsertShiftCell }) => any

pasteFloatingObjects

pasteFloatingObjects: Object

Represents the command for pasting the floating objects on the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// paste the floating objects with invoking command
spread.commandManager().execute({cmd: "pasteFloatingObjects", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => boolean

redo

redo: Object

Represents the command used to perform a redo of the most recently undone edit or action.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the redo command.
spread.commandManager().execute({cmd: "redo", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

removeColumnOutline

removeColumnOutline: Object

Represents the command for ungrouping a column outline (range group) on a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline starting index.

param The number of rows or columns to group or ungroup in the outline.

param true if this is an undo operation; otherwise, false.

example

// ungroup a column outline with invoking command
spread.commandManager().execute({cmd: "removeColumnOutline", sheetName: "Sheet1", index: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

removeRowOutline

removeRowOutline: Object

Represents the command for ungrouping a row outline (range group) on a sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The outline starting index.

param The number of rows or columns to group or ungroup in the outline.

param true if this is an undo operation; otherwise, false.

example

// ungroup a row outline with invoking command
spread.commandManager().execute({cmd: "removeRowOutline", sheetName: "Sheet1", index: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

renameSheet

renameSheet: Object

Represents the command used to rename a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The sheet's new name.

param true if this is an undo operation; otherwise, false.

example

//This example renames a sheet.
spread.commandManager().execute({cmd: "renameSheet", sheetName: "Sheet1", name: "SheetName"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { name: string ; sheetName: string }, isUndo: boolean) => any

resizeColumn

resizeColumn: Object

Represents the command used to resize the column on a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize columns; each item is an object which has firstCol and lastCol.

param The size of the column that is being resized.

param Whether the column being resized is in the row header area.

param true if this is an undo operation; otherwise, false.

example

// resize the col with invoking command
spread.commandManager().execute({cmd: "resizeColumn", sheetName: "Sheet1", columns: [{firstCol: 1, lastCol: 5}], size: 200, rowHeader: false});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { columns: Object[] ; rowHeader: boolean ; sheetName: string ; size: number }, isUndo: boolean) => any

resizeFloatingObjects

resizeFloatingObjects: Object

Represents the command for resizing floating objects.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The names array of floating objects.

param The offset left.

param The offset top.

param The offset width.

param The offset height.

param true if this is an undo operation; otherwise, false.

example

// resize floating objects with invoking command
spread.commandManager().execute({cmd: "resizeFloatingObjects", sheetName: "Sheet1", floatingObjects: ["floatingObject1", "floatingObject2"], offsetWidth: 100, offsetHeight: 100});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetHeight: number ; offsetWidth: number ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

resizeRow

resizeRow: Object

Represents the command used to resize the row on a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize rows; each item is an object which has firstRow and lastRow.

param The size of the row that is being resized.

param Whether the row being resized is in the column header area.

param true if this is an undo operation; otherwise, false.

example

// resize the row with invoking command
spread.commandManager().execute({cmd: "resizeRow", sheetName: "Sheet1", rows: [{firstRow: 1, lastRow: 5}], size: 100, rowHeader: false});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { columnHeader: boolean ; rows: Object[] ; sheetName: string ; size: number }, isUndo: boolean) => any

selectNextControl

selectNextControl: Object

Represents the command used to select the next control.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the selectNextControl action to the Tab key.
spread.commandManager().setShortcutKey('selectNextControl', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('selectPreviousControl', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectPreviousControl

selectPreviousControl: Object

Represents the command used to select the previous control.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example maps the selectPreviousControl action to the Shift + Tab key combination.
spread.commandManager().setShortcutKey('selectNextControl', GC.Spread.Commands.Key.tab, false, false, false, false); // Tab key
spread.commandManager().setShortcutKey('selectPreviousControl', GC.Spread.Commands.Key.tab, false, true, false, false); // Shift key and Tab key

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionBottom

selectionBottom: Object

Represents the command used to extend the selection to the last row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionBottom action.
spread.commandManager().setShortcutKey('selectionBottom', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionDown

selectionDown: Object

Represents the command used to extend the selection down one row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionDown action.
spread.commandManager().setShortcutKey('selectionDown', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionEnd

selectionEnd: Object

Represents the command used to extend the selection to the last column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionEnd action.
spread.focus();
spread.commandManager().setShortcutKey('selectionEnd', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionFirst

selectionFirst: Object

Represents the command used to extend the selection to the first cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionFirst action.
spread.focus();
spread.commandManager().setShortcutKey('selectionFirst', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionHome

selectionHome: Object

Represents the command used to extend the selection to the first column.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionHome action.
spread.focus();
spread.commandManager().setShortcutKey('selectionHome', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionLast

selectionLast: Object

Represents the command used to extend the selection to the last cell.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionLast action.
spread.focus();
spread.commandManager().setShortcutKey('selectionLast', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionLeft

selectionLeft: Object

Represents the command used to extend the selection one column to the left.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionLeft action.
spread.commandManager().setShortcutKey('selectionLeft', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => any

selectionPageDown

selectionPageDown: Object

Represents the command used to extend the selection down to include one page of rows.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionPageDown action.
spread.commandManager().setShortcutKey('selectionPageDown', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionPageUp

selectionPageUp: Object

Represents the command used to extend the selection up to include one page of rows.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionPageUp action.
spread.commandManager().setShortcutKey('selectionPageUp', GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionRight

selectionRight: Object

Represents the command used to extend the selection one column to the right.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionRight action.
spread.commandManager().setShortcutKey("selectionRight", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionTop

selectionTop: Object

Represents the command used to extend the selection to the first row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionTop action.
spread.commandManager().setShortcutKey("selectionTop", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionUp

selectionUp: Object

Represents the command used to extend the selection up one row.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the selectionUp action.
spread.commandManager().setShortcutKey("selectionUp", GC.Spread.Commands.Key.a, false, false, false, false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

splitResizeColumn

splitResizeColumn: Object

Represents the command used to split resize the column on a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize columns; each item is an object which has firstCol and lastCol.

param The size of the column that is being resized.

param Whether the column being resized is in the row header area.

param true if this is an undo operation; otherwise, false.

example

// split resize the column with invoking command
spread.commandManager().execute({cmd: "splitResizeColumn", sheetName: "Sheet1", columns: [{firstCol: 1, lastCol: 2}]}, size: 100, rowHeader: false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { columns: Object[] ; rowHeader: boolean ; sheetName: string ; size: number }, isUndo: boolean) => any

splitResizeRow

splitResizeRow: Object

Represents the command used to split resize the row on a worksheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The resize rows; each item is an object which has firstRow and lastRow.

param The size of the row that is being resized.

param Whether the row being resized is in the column header area.

param true if this is an undo operation; otherwise, false.

example

// split resize the row with invoking command
spread.commandManager().execute({cmd: "splitResizeRow", sheetName: "Sheet1", rows: [{firstRow: 1, lastRow: 2}]}, size: 100, columnHeader: false);

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { columnHeader: boolean ; rows: Object[] ; sheetName: string ; size: number }, isUndo: boolean) => any

startEdit

startEdit: Object

Represents the command used to start editing the active cell with the edit mode.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

// start editing a cell with invoking command
spread.commandManager().execute({cmd: "startEdit", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

tableDeleteColumns

tableDeleteColumns: Object

Represents the command used to delete columns for table.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The table name.

param The index of the starting column to delete, the col index is based on table index.

param The number of columns to delete.

param true if this is an undo operation; otherwise, false.

example

// delete columns for table with invoking command
spread.commandManager().execute({cmd: "tableDeleteColumns", sheetName: "Sheet1", tableName: "table1", col: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; count: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableDeleteRows

tableDeleteRows: Object

Represents the command used to delete rows for table.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The table name.

param The index of the starting row to delete, the row index is based on table index.

param The number of rows to delete.

param true if this is an undo operation; otherwise, false.

example

// delete rows for table with invoking command
spread.commandManager().execute({cmd: "tableDeleteRows", sheetName: "Sheet1", tableName: "table1", row: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; row: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableInsertColumns

tableInsertColumns: Object

Represents the command used to insert columns for table.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The table name.

param The index of the starting column to insert, the col index is based on table index.

param The number of columns to insert.

param true if this is an undo operation; otherwise, false.

example

// insert columns for table with invoking command
spread.commandManager().execute({cmd: "tableInsertColumns", sheetName: "Sheet1", tableName: "table1", col: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { col: number ; count: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableInsertRows

tableInsertRows: Object

Represents the command used to insert rows for table.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The table name.

param The index of the starting row to insert, the row index is based on table index.

param The number of rows to insert.

param true if this is an undo operation; otherwise, false.

example

// insert rows for table with invoking command
spread.commandManager().execute({cmd: "tableInsertRows", sheetName: "Sheet1", tableName: "table1", row: 1, count: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { count: number ; row: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableResize

tableResize: Object

Represents the command used to resize table.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The table name.

param The resized table range.

param true if this is an undo operation; otherwise, false.

example

// resize table with invoking command
spread.commandManager().execute({cmd: "tableResize", sheetName: "Sheet1", tableName: "table1", resizeToRange: new GC.Spread.Sheets.Range(1, 1, 5, 3)});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { resizeToRange: Range ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableSubmitChanges

tableSubmitChanges: Object

Represents the command used to submit changes of the tables which bind data manager tables.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name, from active sheet by default.

param The table names, from active table by default.

param true if this is an undo operation; otherwise, false.

example

// submit changes of the tables which bind the data manager tables with invoking command
spread.commandManager().execute({cmd: "tableSubmitChanges", sheetName: "Sheet1", tableNames: ["table1"]});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName?: string ; tableNames?: string[] }, isUndo: boolean) => boolean

undo

undo: Object

Represents the command used to perform an undo of the most recent edit or action.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param true if this is an undo operation; otherwise, false.

example

//This example uses the undo command.
spread.commandManager().execute({cmd: "undo", sheetName: "Sheet1"});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

zoom

zoom: Object

Represents the command used to zoom the sheet.

property canUndo - indicates whether the command supports undo and redo operations.

property execute - performs an execute or undo operation. The arguments of the execute method are as follows.

param The context of the operation.

param The options of the operation.

param The sheet name.

param The zoom factor.

param true if this is an undo operation; otherwise, false.

example

// zoom the sheet with invoking command
spread.commandManager().execute({cmd: "zoom", sheetName: "Sheet1", zoomFactor: 3});

Type declaration

Name Type
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; zoomFactor: number }, isUndo: boolean) => any

Functions

endTransaction

endTransaction(context, options): void

Ends a transaction. During the transaction, the changes of the data model will be saved.

example

//For example, the following code registers the changeBackColor command and then executes the command.
var command = {
  canUndo: true,
  execute: function (context, options, isUndo) {
    var Commands = GC.Spread.Sheets.Commands;
    options.cmd = "changeBackColor";
    if (isUndo) {
      Commands.undoTransaction(context, options);
      return true;
    } else {
      Commands.startTransaction(context, options);
      var sheet = context.getSheetFromName(options.sheetName);
      var cell = sheet.getCell(options.row, options.col);
      cell.backColor(options.backColor);
      Commands.endTransaction(context, options);
      return true;
    }
  }
};
var spread = GC.Spread.Sheets.findControl(document.getElementById("ss"));
var commandManager = spread.commandManager();
commandManager.register("changeBackColor", command);
commandManager.execute({cmd: "changeBackColor", sheetName: spread.getSheet(0).name(), row: 1, col: 2, backColor: "red"});

Parameters

Name Type Description
context Workbook The context of the operation.
options any The options of the operation.

Returns

void


startTransaction

startTransaction(context, options): void

Starts a transaction. During the transaction, the changes of the data model will be saved.

example

//For example, the following code registers the changeBackColor command and then executes the command.
var command = {
  canUndo: true,
  execute: function (context, options, isUndo) {
    var Commands = GC.Spread.Sheets.Commands;
    options.cmd = "changeBackColor";
    if (isUndo) {
      Commands.undoTransaction(context, options);
      return true;
    } else {
      Commands.startTransaction(context, options);
      var sheet = context.getSheetFromName(options.sheetName);
      var cell = sheet.getCell(options.row, options.col);
      cell.backColor(options.backColor);
      Commands.endTransaction(context, options);
      return true;
    }
  }
};
var spread = GC.Spread.Sheets.findControl(document.getElementById("ss"));
var commandManager = spread.commandManager();
commandManager.register("changeBackColor", command);
commandManager.execute({cmd: "changeBackColor", sheetName: spread.getSheet(0).name(), row: 1, col: 2, backColor: "red"});

Parameters

Name Type Description
context Workbook The context of the operation.
options any The options of the operation.

Returns

void


undoTransaction

undoTransaction(context, options): void

Undo the changes made in a transaction.

example

//For example, the following code registers the changeBackColor command and then executes the command.
var command = {
  canUndo: true,
  execute: function (context, options, isUndo) {
    var Commands = GC.Spread.Sheets.Commands;
    options.cmd = "changeBackColor";
    if (isUndo) {
      Commands.undoTransaction(context, options);
      return true;
    } else {
      Commands.startTransaction(context, options);
      var sheet = context.getSheetFromName(options.sheetName);
      var cell = sheet.getCell(options.row, options.col);
      cell.backColor(options.backColor);
      Commands.endTransaction(context, options);
      return true;
    }
  }
};
var spread = GC.Spread.Sheets.findControl(document.getElementById("ss"));
var commandManager = spread.commandManager();
commandManager.register("changeBackColor", command);
commandManager.execute({cmd: "changeBackColor", sheetName: spread.getSheet(0).name(), row: 1, col: 2, backColor: "red"});

Parameters

Name Type Description
context Workbook The context of the operation.
options any The options of the operation.

Returns

void