[]
        
(Showing Draft Content)

GC.Spread.Sheets.Commands

命名空间: Commands

Spread.Sheets.Commands

Table of contents

变量

函数

Variables

autoFitColumn

autoFitColumn: Object

表示用于自动调整列大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整列的大小;每个项目都是一个列对象

param 调整大小的列是否位于行标头区域

param 自适应操作是否包括表头文本

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { autoFitType: AutoFitType ; columns: Object[] ; rowHeader: boolean ; sheetName: string }, isUndo: boolean) => any

autoFitRow

autoFitRow: Object

表示用于自动调整表格大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整大小;每个项目都是具有行的对象

**param**调整大小是否在列标题区域

param 自适应操作是否包括表头文本

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { autoFitType: AutoFitType ; columnHeader: boolean ; rows: Object[] ; sheetName: string }, isUndo: boolean) => any

cancelInput

cancelInput: Object

表示用于停止单元编辑和取消输入的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

changeFormulaReference

changeFormulaReference: Object

代表用于在编辑公式时相对,绝对和混合之间切换公式参考的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false //This example uses the changeFormulaReference action to switch the formula reference. spread.commandManager().execute({cmd: "changeFormulaReference", sheetName: "Sheet1"});

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clear

clear: Object

表示用于清除单元格值的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clearAndEditing

clearAndEditing: Object

表示用于清除活动单元格值并输入编辑模式的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

clearValues

clearValues: Object

表示用于在工作表上清除单元格值的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 清除单元格值范围,其项目类型为GC.Spread.Sheets.Range

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { ranges: Range[] ; sheetName: string }, isUndo: boolean) => any

clipboardPaste

clipboardPaste: Object

表示工作表上的剪贴板粘贴的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 源工作表

param 源范围数组,其项目类型为GC.Spread.Sheets.Range

param 目标范围数组,其项目类型为GC.Spread.Sheets.Range

param 该操作是剪切还是复制

param 剪贴板的文本

param 指示要粘贴的内容的剪贴板粘贴选项

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
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

表示用于提交单元格编辑并将数组公式设置为活动范围的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

commitInputNavigationDown

commitInputNavigationDown: Object

代表用于停止单元格编辑并将活动单元格移至下一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

commitInputNavigationUp

commitInputNavigationUp: Object

代表用于停止单元格编辑并将活动单元格移至上一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

copy

copy: Object

表示用于将所选项目文本复制到剪贴板的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

copySheet

copySheet: Object

表示用于复制表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 源数据表名称

param 目标索引

param 新工作表名称

param 是否包含绑定数据源

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { includeBindingSource: boolean ; newName: string ; sheetName: string ; targetIndex: number }) => void

cut

cut: Object

表示用于切割剪贴板的选定项目文本的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

deleteFloatingObjects

deleteFloatingObjects: Object

表示删除浮动对象的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => boolean

dragCopyFloatingObjects

dragCopyFloatingObjects: Object

表示用于拖动和复制工作表上的浮动对象的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 浮动对象的名称数组

param 水平位移

param 垂直位移

param true表示这是一个撤销操作;否则为false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

dragDrop

dragDrop: Object

表示在工作表上拖动一个范围并将其放置到另一个范围上的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文 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;否则返回false

代码示例

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

属性名 类型
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

表示在工作表上编辑单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 单元格行索引

param 单元格列索引

param 新值

param 是否对新值自动格式化

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { autoFormat: boolean ; col: number ; newValue: any ; row: number ; sheetName: string }, isUndo: boolean) => any

expandColumnOutline

expandColumnOutline: Object

表示扩展或折叠列范围组的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 大纲摘要索引

param 大纲级别

param 是指将大纲收起还是展开

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { collapsed: boolean ; index: number ; level: number ; sheetName: string }, isUndo: boolean) => boolean

expandColumnOutlineForLevel

expandColumnOutlineForLevel: Object

表示用于在同一级别上扩展或折叠列范围组的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 大纲级别

param 如果这是一个撤销操作,则为 true;否则为 false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { level: number ; sheetName: string }, isUndo: boolean) => boolean

expandRowOutline

expandRowOutline: Object

表示展开或折叠行范围组的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 大纲摘要索引

param 大纲级别

param 是否将大纲折叠或展开

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { collapsed: boolean ; index: number ; level: number ; sheetName: string }, isUndo: boolean) => boolean

expandRowOutlineForLevel

expandRowOutlineForLevel: Object

表示用于在同一级别上展开或折叠行范围组的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 大纲级别

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { level: number ; sheetName: string }, isUndo: boolean) => boolean

fill

fill: Object

表示用于拖动和填充表上范围的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 开始区域

param 填充区域

param 自动填充类型

param 填充方向

param 如果是撤销操作,则为 true;否则为 false

代码示例

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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { autoFillType: AutoFillType ; fillDirection: FillDirection ; fillRange: Range ; sheetName: string ; startRange: Range }, isUndo: boolean) => boolean

moveFloatingObjects

moveFloatingObjects: Object

表示移动浮动对象的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 浮动对象的名称数组

param 水平位移

param 垂直位移

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

moveSheet

moveSheet: Object

表示用于移动工作表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 目标工作表索引

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; targetIndex: number }) => boolean

moveToNextCell

moveToNextCell: Object

表示用于将活动单元移至下一个单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToNextCellThenControl

moveToNextCellThenControl: Object

表示当活动单元格为最后一个可见单元格时,用于选择下一个控件的命令;否则,将活动单元格移动到下一个单元格

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToPreviousCell

moveToPreviousCell: Object

表示将活动单元格移动到上一个单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

moveToPreviousCellThenControl

moveToPreviousCellThenControl: Object

表示当活动单元格为第一个可见单元格时,用于选择上一个控件的命令;否则,将活动单元格移动到上一个单元格

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationBottom: Object

表示将活动单元格移动到最后一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationDown: Object

表示将活动单元格移动到下一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationEnd: Object

表示用于将活动单元格移至最后一列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationEnd2: Object

表示将活动单元格移动到最后一列的命令,不考虑冻结的尾随列

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationFirst: Object

表示将活动单元格移动到工作表中的第一个单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationHome: Object

表示将活动单元格移动到第一列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationHome2: Object

表示将活动单元格移动到第一列而不考虑冻结列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationLast: Object

表示将活动单元格移动到工作表中的最后一个单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationLeft: Object

表示将活动单元格移动到上一列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationNextSheet: Object

表示将活动工作表移动到下一张工作表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPageDown: Object

表示将活动单元格向下移动一页行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPageUp: Object

表示将活动单元格向上移动一页行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationPreviousSheet: Object

表示将活动工作表移动到上一个工作表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => any

navigationRight: Object

表示将活动单元格移动到下一列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationTop: Object

表示将活动单元格移动到第一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

navigationUp: Object

表示将活动单元格移动到上一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

openCalculator

openCalculator: Object

表示用于在指定单元格中打开计算器选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openColorPicker

openColorPicker: Object

表示用于在指定单元格中打开颜色选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
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.

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openList

openList: Object

表示用于在指定单元格中打开列表选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openMonthPicker

openMonthPicker: Object

表示用于在指定单元格中打开月份选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openMultiColumn

openMultiColumn: Object

表示用于在指定单元格中打开多列列表选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openPasteSpecialDialog

openPasteSpecialDialog: Object

表示用于打开粘贴特殊对话框的命令

param 操作的上下文

代码示例

//This example copy a sheet.
spread.commandManager().execute({cmd: "openPasteSpecialDialog"});

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook) => void

openSlider

openSlider: Object

表示用于在指定单元格中打开滑块选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openTimePicker

openTimePicker: Object

表示用于在指定单元格中打开时间选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

openUrl

openUrl: Object

表示用于打开超链接单元格的网址的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param URL

param 目标类型,默认为空

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; target?: HyperlinkTargetType ; url: string }, isUndo: boolean) => any

openWorkflowList

openWorkflowList: Object

表示用于在指定单元格中打开工作流列表选择器的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 工作表区域

param 行索引

param 列索引

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; row: number ; sheetArea: SheetArea ; sheetName: string }, isUndo: boolean) => any

outlineColumn

outlineColumn: Object

表示将列在表上分组(范围组)的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 开始索引

param 大纲中的行或分组的行数或列的数量

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

outlineRow

outlineRow: Object

表示将表上的行轮廓(范围组)分组的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 开始索引

param 大纲中的行或分组的行数或列的数量

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

paste

paste: Object

表示用于从剪贴板粘贴到当前表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 需要移动的被插入数据

param 粘贴选项

param 粘贴板文本

param 粘贴板 HTML

param

param 粘贴操作选项

param 是否要在复制的范围中跳过空单元格,而不替换相应的单元格

param 是否将复制数据的列更改为行,反之亦然

param 是否要粘贴单元格引用

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { pasteOption: ClipboardPasteOptions ; pasteSpecialOptions: Object ; sheetName: string ; shiftCells?: InsertShiftCell }) => any

pasteFloatingObjects

pasteFloatingObjects: Object

代表在工作表上粘贴浮动对象的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => boolean

redo

redo: Object

代表执行最近撤消的编辑或操作的重做命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

removeColumnOutline

removeColumnOutline: Object

代表在工作表上取消分组列大纲(范围组)的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 开始索引

param 大纲中的行或分组的行数或列的数量

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

removeRowOutline

removeRowOutline: Object

代表在工作表上取消分组行大纲(范围组)的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 开始索引

param 大纲中的行或分组的行数或列的数量

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; index: number ; sheetName: string }, isUndo: boolean) => boolean

renameSheet

renameSheet: Object

代表用于重命名工作表的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 新工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { name: string ; sheetName: string }, isUndo: boolean) => any

resizeColumn

resizeColumn: Object

代表用于调整工作表上列宽的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整列宽;每个项目都是一个对象,其中包含 firstCol 和 lastCol

param 正在调整的列的大小

param 被调整大小的列是否在行标头区域

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { columns: Object[] ; rowHeader: boolean ; sheetName: string ; size: number }, isUndo: boolean) => any

resizeFloatingObjects

resizeFloatingObjects: Object

表示调整浮动对象大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 浮动对象的名称数组

param 左偏移

param 上偏移

param 偏移宽度

param 偏移高度

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { floatingObjects: string[] ; offsetHeight: number ; offsetWidth: number ; offsetX: number ; offsetY: number ; sheetName: string }, isUndo: boolean) => boolean

resizeRow

resizeRow: Object

表示在工作表上调整行大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整行大小;每个项目都是一个包含 firstRow 和 lastRow 属性的对象

param 表示用于调整工作表上行大小的命令

param 确定被调整大小的行是否位于列标题区域

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { columnHeader: boolean ; rows: Object[] ; sheetName: string ; size: number }, isUndo: boolean) => any

selectNextControl

selectNextControl: Object

表示选择下一个控件所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectPreviousControl

selectPreviousControl: Object

表示选择前一个控件所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

//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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionBottom

selectionBottom: Object

表示将选择扩展到最后一行所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionDown

selectionDown: Object

表示将选择向下扩展一行所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionEnd

selectionEnd: Object

表示将选择扩展到最后一列所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionFirst

selectionFirst: Object

表示将选择扩展到第一个单元格所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionHome

selectionHome: Object

表示将选择扩展到第一列所使用的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionLast

selectionLast: Object

表示将选择扩展到最后一个单元格的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionLeft

selectionLeft: Object

表示将选择向左扩展一个列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }, isUndo: boolean) => any

selectionPageDown

selectionPageDown: Object

表示将选择扩展到包括一页行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionPageUp

selectionPageUp: Object

表示将选择向上扩展一个页面的行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionRight

selectionRight: Object

代表了将选择向右扩展一个列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionTop

selectionTop: Object

代表了将选择扩展到第一行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

selectionUp

selectionUp: Object

代表了将选择向上扩展一个行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

splitResizeColumn

splitResizeColumn: Object

表示用于在工作表上拆分调整列宽的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整列宽;每个项目都是一个对象,其中具有 firstCol 和 lastCol

param 正在调整大小的列的尺寸

param 正在调整大小的列是否在行标题区域内

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { columns: Object[] ; rowHeader: boolean ; sheetName: string ; size: number }, isUndo: boolean) => any

splitResizeRow

splitResizeRow: Object

表示用于在工作表上拆分调整行大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 调整行大小;每个项目都是一个包含 firstRow 和 lastRow 属性的对象

param 表示用于调整工作表上行大小的命令

param 确定被调整大小的行是否位于列标题区域

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { columnHeader: boolean ; rows: Object[] ; sheetName: string ; size: number }, isUndo: boolean) => any

tableDeleteColumns

tableDeleteColumns: Object

表示用于在表格中删除列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 表格名称

param 表示要删除的起始列的索引,列索引基于表格索引

param 表示要删除的列数

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; count: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableDeleteRows

tableDeleteRows: Object

表示用于删除表中行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 表格名

param 要删除的起始行的索引,行索引是基于表索引的

param 要删除的行数

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; row: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableInsertColumns

tableInsertColumns: Object

表示用于向表中插入列的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 表格名

param 要插入的起始列的索引,列索引是基于表索引的

param 要插入的列数

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { col: number ; count: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableInsertRows

tableInsertRows: Object

表示用于向表中插入行的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 表格名

param 要插入的起始行索引,行索引基于表索引

param 要插入的行数

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { count: number ; row: number ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

tableResize

tableResize: Object

代表用于调整表大小的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 表格名

param 调整大小后的表范围

param 如果这是撤销操作,则返回true;否则返回false

代码示例

// 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

属性名 类型
canUndo boolean
execute (context: Workbook, options: { resizeToRange: Range ; sheetName: string ; tableName: string }, isUndo: boolean) => boolean

undo

undo: Object

表示用于执行撤销最近的编辑或操作的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string }) => any

zoom

zoom: Object

表示用于缩放表单的命令

属性 canUndo - 指示该命令是否支持撤消和重做操作

属性 execute - 执行或撤消操作 execute方法的参数如下

param 操作的上下文

param 操作的选项

param 工作表名称

param 缩放系数

param 如果这是撤销操作,则返回true;否则返回false

代码示例

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

Type declaration

属性名 类型
canUndo boolean
execute (context: Workbook, options: { sheetName: string ; zoomFactor: number }, isUndo: boolean) => any

Functions

endTransaction

endTransaction(context, options): void

表示结束一个事务的命令。在事务期间,数据模型的更改将被保存

代码示例

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

参数

属性名 类型 说明
context Workbook 操作的执行上下文
options any 选项

返回值

void


startTransaction

startTransaction(context, options): void

表示开始一个事务的命令。在事务期间,数据模型的更改将被保存

代码示例

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

参数

属性名 类型 说明
context Workbook 操作的执行上下文
options any 选项

返回值

void


undoTransaction

undoTransaction(context, options): void

撤消在事务中所做的更改

代码示例

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

参数

属性名 类型 说明
context Workbook 操作的执行上下文
options any 选项

返回值

void