[]
• new Events()
Defines the events supported in SpreadJS.
• Static ActiveSheetChanged: string
Occurs when the user has changed the active sheet.
name GC.Spread.Sheets.Workbook#ActiveSheetChanged
param GC.Spread.Sheets.Worksheet oldSheet The old sheet.
param GC.Spread.Sheets.Worksheet newSheet The new sheet.
example
//This example creates log text for the ActiveSheetChanged event.
// Use web browser to see the console log text
spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanged, function (sender, args) {
console.log("Active sheet has been switched.");
});
• Static ActiveSheetChanging: string
Occurs when the user is changing the active sheet.
name GC.Spread.Sheets.Workbook#ActiveSheetChanging
param GC.Spread.Sheets.Worksheet oldSheet The old sheet.
param GC.Spread.Sheets.Worksheet newSheet The new sheet.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example stops the active sheet from changing.
spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanging, function (sender, args) {
//Cancel sheet switching.
args.cancel = true;
});
• Static BeforePrint: string
Occurs before the print
name GC.Spread.Sheets.WorkBook.BeforePrint
param Object iframe The print Dom
param boolean cancel Whether cancel print
example
//This example uses the BeforePrint.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
spread.bind(GC.Spread.Sheets.Events.BeforePrint, function (e, data) {
alert(data.iframe + '\n' + 'cancel: ' + data.cancel);
});
}
• Static ButtonClicked: string
Occurs when the user clicks a button, check box, or hyperlink in a cell.
name GC.Spread.Sheets.Workbook#ButtonClicked
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell.
param number col The column index of the cell.
param GC.Spread.Sheets.SheetArea sheetArea The sheet area that contains the cell.
example
//This example creates a button cell.
var cellType = new GC.Spread.Sheets.CellTypes.Button();
cellType.buttonBackColor("#FFFF00");
cellType.text("this is a button");
activeSheet.setCellType(1,1,cellType);
//bind
spread.bind(GC.Spread.Sheets.Events.ButtonClicked, function (e, args) {
var sheet = args.sheet, row = args.row, col = args.col;
var cellType = activeSheet.getCellType(row, col);
if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
alert("Button Clicked");
}
});
• Static CalculationProgress: string
Occurs when the calculate with incrementalCalculation.
name GC.Spread.Sheets.Workbook#CalculationProgress
param number totalCells The count of total calculate cells.
param number pendingCells The count of cells needed to be calculated.
param number iterate The count of iterative calculation has done, only available when the iterative calculation.
example
//This example uses the CalculationProgress event, to log the calculation progress.
spread.options.incrementalCalculation = true;
spread.bind(GC.Spread.Sheets.Events.CalculationProgress, function (e, info) {
var msg = "Calculate ";
if (info.pendingCells === 0) {
msg += "finished";
} else if (info.iterate >= 0) {
msg += info.pendingCells + " cells in iterative calculation round " + info.iterate;
} else {
msg += (info.totalCells - info.pendingCells) + "/" + info.totalCells + "cells";
}
console.log(msg)
});
• Static CellChanged: string
Occurs when a change is made to a cell in this sheet that may require the cell to be repainted.
name GC.Spread.Sheets.Worksheet#CellChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell.
param number col The column index of the cell.
param GC.Spread.Sheets.SheetArea sheetArea The sheetArea of the cell.
param string propertyName The name of the cell's property that has changed.
param boolean isUndo Whether this event is from a undo operation.
example
//This example uses the CellChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.CellChanged, function (e, info) {
if(info.sheetArea === GC.Spread.Sheets.SheetArea.viewport){
alert("Cell index (" + info.row + "," + info.col + ")");
}
});
• Static CellClick: string
Occurs when the user presses down the left mouse button in a cell.
name GC.Spread.Sheets.Worksheet#CellClick
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.SheetArea sheetArea The sheet area the clicked cell is in.
param number row The row index of the clicked cell.
param number col The column index of the clicked cell.
example
//This example uses the CellClick event.
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
if(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader){
console.log("The column header was clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader){
console.log("The row header was clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.corner){
console.log("The corner header was clicked.");
}
console.log("Clicked column index: " + args.col);
console.log("Clicked row index: " + args.row);
});
//bind
activeSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
if(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader){
console.log("The column header was double clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader){
console.log("The row header was double clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.corner){
console.log("The corner header was double clicked.");
}
console.log("Double clicked column index: " + args.col);
console.log("Double clicked row index: " + args.row);
})
• Static CellDoubleClick: string
Occurs when the user presses down the left mouse button twice (double-clicks) in a cell.
name GC.Spread.Sheets.Worksheet#CellDoubleClick
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.SheetArea sheetArea The sheet area the clicked cell is in.
param number row The row index of the clicked cell.
param number col The column index of the clicked cell.
example
//This example uses the CellDoubleClick event.
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
if(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader){
console.log("The column header was clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader){
console.log("The row header was clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.corner){
console.log("The corner header was clicked.");
}
console.log("Clicked column index: " + args.col);
console.log("Clicked row index: " + args.row);
});
//bind
activeSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
if(args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader){
console.log("The column header was double clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader){
console.log("The row header was double clicked.");
}
if(args.sheetArea === GC.Spread.Sheets.SheetArea.corner){
console.log("The corner header was double clicked.");
}
console.log("Double clicked column index: " + args.col);
console.log("Double clicked row index: " + args.row);
});
• Static ClipboardChanged: string
Occurs when a Clipboard change occurs that affects Spread.Sheets.
name GC.Spread.Sheets.Worksheet#ClipboardChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Object copyData The data from Spread.Sheets that has been set into the clipboard.
param string copyData.text The text string of the clipboard.
param string copyData.html The html string of the clipboard.
param Array objects The copied floating objects, it contains picture, custom floating object, slicer, chart and shape.
example
//This example uses the ClipboardChanged event.
spread.bind(GC.Spread.Sheets.Events.ClipboardChanged, function (sender, args) {
console.log("ClipboardChanged.", args);
});
• Static ClipboardChanging: string
Occurs when the Clipboard is changing due to a Spread.Sheets action.
name GC.Spread.Sheets.Worksheet#ClipboardChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Object copyData The data from Spread.Sheets that is set into the clipboard.
param string copyData.text The text string of the clipboard.
param string copyData.html The html string of the clipboard.
param {@link GC.Spread.Sheets.Range[]} ranges The source ranges of the source sheet for current cut or copy operation.
param GC.Spread.Sheets.ClipboardActionType action Indicates the type of the current action.
param Array objects The coping floating objects, it contains picture, custom floating object, slicer, chart and shape.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the ClipboardChanging event.
spread.bind(GC.Spread.Sheets.Events.ClipboardChanging, function (sender, args) {
console.log("ClipboardChanging", args);
});
• Static ClipboardPasted: string
Occurs when the user pastes from the Clipboard.
name GC.Spread.Sheets.Worksheet#ClipboardPasted
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range cellRange The range that was pasted.
param GC.Spread.Sheets.ClipboardPasteOptions pasteOption The paste option that indicates what data is pasted from the clipboard: values, formatting, or formulas.
param Object pasteData The data from the clipboard that will be pasted into Spread.Sheets.
param string pasteData.text The text string of the clipboard.
param string pasteData.html The html string of the clipboard.
param string pasteData.image The image src string of the clipboard.
param GC.Spread.Sheets.Worksheet fromSheet the source sheet of data range.
param GC.Spread.Sheets.Range [fromRange] The source range of paste when copy or cut range.
param GC.Spread.Sheets.ClipboardActionType action Indicates the type of the current action.
param Array objects The pasted floating objects, it contains picture, custom floating object, slicer, chart and shape.
param GC.Spread.Sheets.InsertShiftCell [shiftCells] The shift cells option, if not shift cell, will be undefined.
example
//This example uses the ClipboardPasted event.
spread.bind(GC.Spread.Sheets.Events.ClipboardPasted, function (sender, args) {
console.log("ClipboardPasted", args);
});
• Static ClipboardPasting: string
Occurs when the user is pasting from the Clipboard.
name GC.Spread.Sheets.Worksheet#ClipboardPasting
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range cellRange The range to paste.
param GC.Spread.Sheets.ClipboardPasteOptions pasteOption The paste option that indicates what data is pasted from the clipboard: values, formatting, or formulas.
param Object pasteData The data from the clipboard that will be pasted into Spread.Sheets.
param string pasteData.text The text string of the clipboard.
param string pasteData.html The html string of the clipboard.
param string pasteData.image The image src string of the clipboard.
param GC.Spread.Sheets.Worksheet fromSheet the source sheet of data range.
param GC.Spread.Sheets.Range [fromRange] The source range of paste when copy or cut range.
param GC.Spread.Sheets.ClipboardActionType action Indicates the type of the current action.
param Array objects The pasting floating objects, it contains picture, custom floating object, slicer, chart and shape.
param boolean cancel A value that indicates whether the operation should be canceled.
param GC.Spread.Sheets.InsertShiftCell [shiftCells] The shift cells option, if not shift cell, will be undefined.
example
//This example uses the ClipboardPasting event.
spread.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (sender, args) {
console.log("ClipboardPasting", args);
});
• Static CollaborationEndRedo: string
After the redo in collaboration.
name GC.Spread.Sheets.Worksheet#CollaborationEndRedo
param object changeSet The redo operation object.
example
//This example.
workbook.bind(GC.Spread.Sheets.Events.CollaborationEndRedo, (sender, args) => {
const changeSet = args.changeSet;
console.log('redo changeSet is:' changeSet);
});
• Static CollaborationEndUndo: string
After the undo in collaboration.
name GC.Spread.Sheets.Worksheet#CollaborationEndUndo
param object changeSet The undo operation object.
example
//This example.
workbook.bind(GC.Spread.Sheets.Events.CollaborationEndUndo, (sender, args) => {
const changeSet = args.changeSet;
console.log('undo changeSet is:' changeSet);
});
• Static CollaborationStartRedo: string
Before the redo in collaboration.
name GC.Spread.Sheets.Worksheet#CollaborationStartRedo
param object changeSet The redo operation object.
example
//This example.
workbook.bind(GC.Spread.Sheets.Events.CollaborationStartRedo, (sender, args) => {
const changeSet = args.changeSet;
console.log('redo changeSet is:' changeSet);
});
• Static CollaborationStartUndo: string
Before the undo in collaboration.
name GC.Spread.Sheets.Worksheet#CollaborationStartUndo
param object changeSet The undo operation object.
example
//This example.
workbook.bind(GC.Spread.Sheets.Events.CollaborationStartUndo, (sender, args) => {
const changeSet = args.changeSet;
console.log('undo changeSet is:' changeSet);
});
• Static ColumnChanged: string
Occurs when a change is made to a column or range of columns in this sheet that may require the column or range of columns to be repainted.
name GC.Spread.Sheets.Worksheet#ColumnChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The column index.
param GC.Spread.Sheets.SheetArea sheetArea The sheetArea of the column.
param string propertyName The name of the column's property that has changed.
param boolean isUndo Whether this event is from a undo operation.
example
//This example uses the ColumnChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.ColumnChanged, function (e, info) {
if(info.sheetArea === GC.Spread.Sheets.SheetArea.viewport){
alert("Index (" + info.col + ")");
}
});
• Static ColumnChanging: string
Occurs when before a change is made to a column or range of columns in this sheet that may require the column or range of columns to be repainted.
name GC.Spread.Sheets.Worksheet#ColumnChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The column index.
param GC.Spread.Sheets.SheetArea sheetArea The sheetArea of the column.
param string propertyName The name of the column's property that has changed.
example
//This example uses the ColumnChanging event.
activeSheet.bind(GC.Spread.Sheets.Events.ColumnChanging, function (e, info) {
if(info.sheetArea === GC.Spread.Sheets.SheetArea.viewport){
alert("Index (" + info.col + ")");
}
});
• Static ColumnWidthChanged: string
Occurs when the column width has changed.
name GC.Spread.Sheets.Worksheet#ColumnWidthChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Array colList The list of columns whose widths have changed.
param boolean header Whether the columns are row header columns.
example
//This example uses the ColumnWidthChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, function (e, info) {
alert("Column (" + info.colList + ")");
});
• Static ColumnWidthChanging: string
Occurs when the column width is changing.
name GC.Spread.Sheets.Worksheet#ColumnWidthChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Array colList The list of columns whose widths are changing.
param boolean header Whether the columns are row header columns.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the ColumnWidthChanging event.
activeSheet.bind(GC.Spread.Sheets.Events.ColumnWidthChanging, function (e, info) {
alert("Column (" + info.colList + ")");
});
• Static CommentChanged: string
Occurs when any comment has changed.
name GC.Spread.Sheets.Worksheet#CommentChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Comments.Comment comment The comment that triggered the event.
param string propertyName The name of the comment's property that has changed.
example
//This example uses the CommentChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.CommentChanged, function (e, info) {
alert("changed");
});
• Static CommentRemoved: string
Occurs when the user has removed the comment.
name GC.Spread.Sheets.Worksheet#CommentRemoved
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Comments.Comment comment The comment has been removed.
example
//This example uses the CommentRemoved event.
var comment = new GC.Spread.Sheets.Comments.Comment();
comment.text("new comment!");
comment.backColor("orange");
comment.displayMode(GC.Spread.Sheets.Comments.DisplayMode.alwaysShown);
activeSheet.getCell(5,5).comment(comment);
activeSheet.bind(GC.Spread.Sheets.Events.CommentRemoved, function (e, info) {
console.log("sheet name: " + info.sheetName);
});
• Static CommentRemoving: string
Occurs when the user is removing any comment.
name GC.Spread.Sheets.Worksheet#CommentRemoving
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Comments.Comment comment The comment is being removed.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example prevents the comment from being removed.
var comment = new GC.Spread.Sheets.Comments.Comment();
comment.text("new comment!");
comment.backColor("orange");
comment.displayMode(GC.Spread.Sheets.Comments.DisplayMode.alwaysShown);
activeSheet.getCell(5,5).comment(comment);
activeSheet.bind(GC.Spread.Sheets.Events.CommentRemoving, function (e, info) {
info.cancel = true;
});
• Static DataFetchCompleted: string
Occurs when all tables from data manager fetched completely through the workbook opening or importing the sjs/json format file.
name GC.Spread.Sheets.Worksheet#DataFetchCompleted
param GC.Spread.Sheets.Workbook spread The workbook that triggered the event.
example
//This example uses the DataFetchCompleted event.
//In general, the DataFetchCompleted event is triggered after the successCallback of the workbook open method invoked.
//If doesn\u2019t use any table of data manager, and the Workbook contains a lot of Worksheet, the DataFetchCompleted event could be triggered before the successCallback of the workbook open method invoked.
let isOpenFinished = false, isDataFetchCompleted = false;
spread.bind(GC.Spread.Sheets.Events.DataFetchCompleted, function () {
isDataFetchCompleted = true;
if (isOpenFinished) {
// do something with data fetched
}
});
spread.open(file, function () {
isOpenFinished = true;
if (isDataFetchCompleted) {
// do something with file opened
}
}, function () { }, {});
• Static DragDropBlock: string
Occurs when the user is dragging and dropping a range of cells.
name GC.Spread.Sheets.Worksheet#DragDropBlock
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number fromRow The row index of the top left cell of the source range (range being dragged).
param number fromCol The column index of the top left cell of the source range (range being dragged).
param number toRow The row index of the top left cell of the destination range (where selection is dropped).
param number toCol The column index of the bottom right cell of the destination range (where selection is dropped).
param number rowCount The row count of the cell range being dragged.
param number colCount The column count of the cell range being dragged.
param boolean copy Whether the source range is copied.
param boolean insert Whether the source range is inserted.
param GC.Spread.Sheets.CopyToOptions copyOption The CopyOption value for the drag and drop operation.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example creates log text for the DragDropBlock event.
// Use web browser to see the console log text
var activeSheet = spread.getActiveSheet();
activeSheet.bind(GC.Spread.Sheets.Events.DragDropBlock, function (e, args) {
console.log("From Column:" + args.fromCol);
console.log("From Row:" + args.fromRow);
console.log("To Column:" + args.toCol);
console.log("To Row:" + args.toRow);
});
• Static DragDropBlockCompleted: string
Occurs when the user completes dragging and dropping a range of cells.
name GC.Spread.Sheets.Worksheet#DragDropBlockCompleted
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number fromRow The row index of the top left cell of the source range (range being dragged).
param number fromCol The column index of the top left cell of the source range (range being dragged).
param number toRow The row index of the top left cell of the destination range (where selection is dropped).
param number toCol The column index of the bottom right cell of the destination range (where selection is dropped).
param number rowCount The row count of the cell range being dragged.
param number colCount The column count of the cell range being dragged.
param boolean copy Whether the source range is copied.
param boolean insert Whether the source range is inserted.
param GC.Spread.Sheets.CopyToOptions copyOption The CopyOption value for the drag and drop operation.
example
//This example uses the DragDropBlockCompleted event.
activeSheet.bind(GC.Spread.Sheets.Events.DragDropBlockCompleted, function (e, args) {
alert("From Column (" + args.fromCol + ")");
});
• Static DragFillBlock: string
Occurs when the user is dragging to fill a range of cells.
name GC.Spread.Sheets.Worksheet#DragFillBlock
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range fillRange The range used for the fill operation.
param GC.Spread.Sheets.Fill.AutoFillType autoFillType AutoFillType value used for the fill operation.
param GC.Spread.Sheets.Fill.FillDirection fillDirection The direction of the fill.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the DragFillBlock event.
activeSheet.bind(GC.Spread.Sheets.Events.DragFillBlock, function (e, info) {
alert("Direction (" + info.fillDirection + ")");
});
• Static DragFillBlockCompleted: string
Occurs when the user completes dragging to fill a range of cells.
name GC.Spread.Sheets.Worksheet#DragFillBlockCompleted
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range fillRange The range used for the fill operation.
param GC.Spread.Sheets.Fill.AutoFillType autoFillType AutoFillType value used for the fill operation.
param GC.Spread.Sheets.Fill.FillDirection fillDirection The direction of the fill.
example
//This example uses the DragFillBlockCompleted event.
activeSheet.bind(GC.Spread.Sheets.Events.DragFillBlockCompleted, function (e, info) {
alert("Type (" + info.autoFillType + ")");
});
• Static DragMerged: string
Occurs after user drag merge cells.
name GC.Spread.Sheets.Worksheet#DragMerged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range mergeRange The range that will be merged.
example
//This example returns the row index.
// Press Ctrl key to merge
$(document).keydown(function (e) {
if (e.keyCode === 17) {
spread.options.allowUserDragMerge = true;
}
});
$(document).keyup(function (e) {
if (e.keyCode === 17) {
spread.options.allowUserDragMerge = false;
}
});
activeSheet.bind(GC.Spread.Sheets.Events.DragMerging, function (e, data) {
var mergeRange = data.mergeRange;
alert(mergeRange.row);
});
activeSheet.bind(GC.Spread.Sheets.Events.DragMerged, function (e, data) {
var mergeRange = data.mergeRange;
alert(mergeRange.row);
});
• Static DragMerging: string
Occurs before user drag merge cells.
name GC.Spread.Sheets.Worksheet#DragMerging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Range mergeRange The range that will be merged.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example returns the row index.
// Press Ctrl key to merge
$(document).keydown(function (e) {
if (e.keyCode === 17) {
spread.options.allowUserDragMerge = true;
}
});
$(document).keyup(function (e) {
if (e.keyCode === 17) {
spread.options.allowUserDragMerge = false;
}
});
activeSheet.bind(GC.Spread.Sheets.Events.DragMerging, function (e, data) {
var mergeRange = data.mergeRange;
alert(mergeRange.row);
});
activeSheet.bind(GC.Spread.Sheets.Events.DragMerged, function (e, data) {
var mergeRange = data.mergeRange;
alert(mergeRange.row);
});
• Static EditChange: string
Occurs when a cell is in edit mode and the text is changed.
name GC.Spread.Sheets.Worksheet#EditChange
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of cell.
param number col The column index of cell.
param Object editingText The value from the current editor.
example
//This example creates log text for the EditChange event.
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.EditChange, function (sender, args) {
console.log("Cell (" + args.row + ", " + args.col + ") data has been changed.")
});
• Static EditEnded: string
Occurs when a cell leaves edit mode.
name GC.Spread.Sheets.Worksheet#EditEnded
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of cell.
param number col The column index of cell.
param Object editingText The value from the current editor.
param boolean committed Whether the value change was committed
example
//This example creates log text for the EditStarting and EditEnded events.
// Use web browser to see the console log text
var activeSheet = spread.getActiveSheet();
activeSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
console.log("Start cell editing.");
});
activeSheet.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
console.log("Finish cell editing.");
});
• Static EditEnding: string
Occurs when a cell is leaving edit mode.
name GC.Spread.Sheets.Worksheet#EditEnding
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of cell.
param number col The column index of cell.
param Object editor The current editor.
param Object editingText The value from the current editor.
param boolean cancel A value that indicates whether the operation should be canceled.
param boolean committed Whether the value change was committed
example
//This example uses the EditEnding event.
activeSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
console.log("Start cell editing.");
});
activeSheet.bind(GC.Spread.Sheets.Events.EditEnding, function (sender, args) {
console.log("EditEnding event.");
});
activeSheet.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
console.log("EditEnded event.");
});
• Static EditStarting: string
Occurs when a cell is entering edit mode.
name GC.Spread.Sheets.Worksheet#EditStarting
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of cell.
param number col The column index of cell.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example creates log text for the EditStarting and EditEnded events.
// Use web browser to see the console log text
var activeSheet = spread.getActiveSheet();
activeSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
console.log("Start cell editing.");
});
activeSheet.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
console.log("Finish cell editing.");
});
• Static EditorStatusChanged: string
Occurs when the editor's status has changed.
name GC.Spread.Sheets.Worksheet#EditorStatusChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.EditorStatus oldStatus The old status of the editor.
param GC.Spread.Sheets.EditorStatus newStatus The new status of the editor.
example
//This example uses the EditorStatusChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.EditorStatusChanged, function (e, info) {
alert("Column (" + info.newStatus + ")");
});
• Static EnterCell: string
Occurs when the focus enters a cell.
name GC.Spread.Sheets.Worksheet#EnterCell
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell being entered.
param number col The column index of the cell being entered.
example
//This example uses the EnterCell event.
activeSheet.bind(GC.Spread.Sheets.Events.EnterCell, function (e, info) {
alert("Cell (" + info.row + ", " + info.col +")");
});
• Static FloatingObjectChanged: string
Occurs when any floating object has changed.
name GC.Spread.Sheets.Worksheet#FloatingObjectsChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.FloatingObject floatingObject The floating object that triggered the event.
param string propertyName The name of the floating object's property that has changed.
example
//This example uses the FloatingObjectChanged event.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
activeSheet.bind(GC.Spread.Sheets.Events.FloatingObjectChanged, function (e, info) {
alert("changed");
});
• Static FloatingObjectLoaded: string
Occurs when the custom floating object content is loaded.
name GC.Spread.Sheets.Worksheet#FloatingObjectLoaded
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.FloatingObject floatingObject The custom floating object that triggered the event.
param HTMLElement element The HTMLElement of the custom floating object.
• Static FloatingObjectRemoved: string
Occurs when the user has removed the floating object.
name GC.Spread.Sheets.Worksheet#FloatingObjectRemoved
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.FloatingObject floatingObject The floating object has been removed.
example
//This example uses the FloatingObjectRemoved event.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
activeSheet.bind(GC.Spread.Sheets.Events.FloatingObjectRemoved, function (e, info) {
alert(info.sheetName);
});
• Static FloatingObjectRemoving: string
Occurs when the user is removing any floating object.
name GC.Spread.Sheets.Worksheet#FloatingObjectRemoving
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.FloatingObject floatingObject The floating object is being removed.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the FloatingObjectRemoving event.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
activeSheet.bind(GC.Spread.Sheets.Events.FloatingObjectRemoving, function (e, info) {
info.cancel = true;
});
• Static FloatingObjectSelectionChanged: string
Occurs when the selections of the floating object have changed.
name GC.Spread.Sheets.Worksheet#FloatingObjectsSelectionChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.FloatingObject floatingObject The floating object that triggered the event.
example
//This example uses the FloatingObjectSelectionChanged event.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.FloatingObjectSelectionChanged, function (e, info) {
console.log("sheet name: " + info.sheetName);
});
• Static FormControlButtonClicked: string
Occurs when the button form control is clicked.
name GC.Spread.Sheets.Worksheet#FormControlButtonClicked
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape that triggered the event.
example
//This example uses the FormControlButtonClicked event.
var shape = sheet.shapes.addFormControl("button", GC.Spread.Sheets.Shapes.FormControlType.button, 50, 50, 150, 100);
activeSheet.bind(GC.Spread.Sheets.Events.FormControlButtonClicked, function (e, info) {
console.log("event info: " + info);
});
• Static FormControlValueChanged: string
Occurs when the value of the form control have changed.
name GC.Spread.Sheets.Worksheet#FormControlValueChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape that triggered the event.
param any newValue the new value of the form control.
param any oldValue the old value of the form control.
example
//This example uses the FormControlValueChanged event.
var shape = sheet.shapes.addFormControl('spin', GC.Spread.Sheets.Shapes.FormControlType.spinButton, 50, 50, 150, 100);
activeSheet.bind(GC.Spread.Sheets.Events.FormControlValueChanged, function (e, info) {
console.log("event info: " + info);
});
• Static InvalidOperation: string
Occurs when an invalid operation is performed.
name GC.Spread.Sheets.Worksheet#InvalidOperation
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.InvalidOperationType invalidType Indicates which operation was invalid.
param string message The description of the invalid operation.
param GC.Spread.Sheets.Range [fillRange] When invalidType is dragFill, The range used for the fill operation.
example
//This example uses the InvalidOperation event.
activeSheet.bind(GC.Spread.Sheets.Events.InvalidOperation, function (e, info) {
alert("Message (" + info.message + ")");
});
• Static LeaveCell: string
Occurs when the focus leaves a cell.
name GC.Spread.Sheets.Worksheet#LeaveCell
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell being left.
param number col The column index of the cell being left.
param boolean cancel Whether the operation should be canceled.
example
//This example creates log text for the LeaveCell event.
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.LeaveCell, function (sender, args) {
console.log("The column index before moving: " + args.col);
console.log("The row index before moving: " + args.row);
});
• Static LeftColumnChanged: string
Occurs when the left column changes.
name GC.Spread.Sheets.Worksheet#LeftColumnChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number oldLeftCol The old left column index.
param number newLeftCol The new left column index.
param number oldOffset The old left column offset.
param number newOffset The new left column offset.
example
//This example synchronizes vertical and horizontal scrolling for sheet 1 and sheet 2.
var sheet1 = spread.getSheet(0),
sheet2 = spread.getSheet(1);
sheet1.bind(GC.Spread.Sheets.Events.TopRowChanged, function (sender, args) {
//Set the displayed top row of sheet1 to sheet2 (vertical scroll synchronization).
sheet2.showRow(args.newTopRow, GC.Spread.Sheets.VerticalPosition.top);
});
sheet1.bind(GC.Spread.Sheets.Events.LeftColumnChanged, function (sender, args) {
//Set the displayed left column of sheet1 to sheet2 (Horizontal scroll synchronization).
sheet2.showColumn(args.newLeftCol, GC.Spread.Sheets.HorizontalPosition.left);
});
• Static OutlineColumnCheckStatusChanged: string
Occurs when the outline column check status has changed.
name GC.Spread.Sheets.Worksheet#OutlineColumnCheckStatusChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The outline column's change row index.
param number col The outline column's change col index.
param boolean status The outline column's change status
example
//Removing the sparkline causes a change.
activeSheet.bind(GC.Spread.Sheets.Events.OutlineColumnCheckStatusChanged, function (e, info) {
console.log("status: " + info.status);
});
• Static PictureChanged: string
Occurs when any picture has changed.
name GC.Spread.Sheets.Worksheet#PictureChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.Picture picture The picture that triggered the event.
param string propertyName The name of the picture's property that has changed.
example
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();
activeSheet.pictures.add("f2","Event.png",2,2,6,6);
activeSheet.pictures.add("f1","tsoutline.png",3,0,6,6);
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.PictureChanged, function (e, info) {
console.log("Sheet: " + info.sheetName);
console.log("Property: " + info.propertyName);
});
• Static PictureSelectionChanged: string
Occurs when the selections of the picture have changed.
name GC.Spread.Sheets.Worksheet#PictureSelectionChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.FloatingObjects.Picture picture The picture that triggered the event.
example
//This example uses the PictureSelectionChanged event.
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();
activeSheet.pictures.add("f2","Event.png",2,2,6,6);
activeSheet.pictures.add("f1","tsoutline.png",3,0,6,6);
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.PictureSelectionChanged, function (e, info) {
console.log("Sheet: " + info.sheetName);
});
• Static PivotTableChanged: string
After PivotTable filter/sort/collapse/fieldChanged/grandTotal/showNoData/group.
name GC.Spread.Sheets.Worksheet#PivotTableChanged
param string pivotTableName The PivotTable's name.
param string type The specific operation name("filter" | "sort" | "collapse" | "fieldChanged" | "summarizedValueBy" | "showValueAs" | "dataPositionChanged" | "viewChanged" | "grandTotal" | "showNoData" | "group").
param string [fieldName] Changed fieldName.
param string [sourceName] Changed field sourceName.
param boolean [oldValue] PivotTable changes the value of the previous attribute(collapse, summarizedValueBy, showValueAs).
param boolean [newValue] PivotTable changes the value of the previous attribute(collapse, summarizedValueBy, showValueAs).
param number [sortType] PivotTable sort changes the value of the attribute(sort).
param Object [filterInfo] PivotTable filter changes the value of the attribute(filter).
param number [clearType] PivotTable clear filter changes the value of the attribute(filter).
param number [oldArea] Old PivotTable Field Type(fieldChanged).
param number [oldIndex] Old PivotTable Field index(fieldChanged).
param number [newArea] New PivotTable Field Type(fieldChanged).
param number [newIndex] New PivotTable Field index(fieldChanged).
param string [viewName] Apply PivotTable Views Name(viewChanged).
example
//This example.
sheet.bind(GC.Spread.Sheets.Events.PivotTableChanged, function (sender, args) {
alert("pivotTableName: " + args.pivotTableName + "changeType: " + args.type);
});
• Static RangeChanged: string
Occurs when the cell range has changed.
name GC.Spread.Sheets.Worksheet#RangeChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The range's row index.
param number col The range's column index.
param number rowCount The range's row count.
param number colCount The range's column count.
param string[] tableNames A collection of table names.
param Object[] changedCells The positions of the cells whose data has changed, each position has row and col.
param GC.Spread.Sheets.RangeChangedAction action The type of action that raises the RangeChanged event.
param boolean isUndo Whether this event is from a undo operation.
example
//This example returns the sheet name and action when changing the cell range in Microsoft Internet Explorer.
activeSheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
console.log(args.sheetName, args.action);
});
• Static RangeFilterCleared: string
Occurs when a range column has just been clear filtered.
name GC.Spread.Sheets.Worksheet#RangeFilterCleared
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the sheet column has just been clear filtered.
example
//This example uses the RangeFilterCleared event.
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
var cellRange =new GC.Spread.Sheets.Range(0, 0, 5, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellRange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeFilterCleared, function (e, info) {
alert("Col (" + info.col + ")");
});
• Static RangeFilterClearing: string
Occurs when a range column is about to be automatically clear filter.
name GC.Spread.Sheets.Worksheet#RangeFilterClearing
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the sheet column to be automatically clear filter.
example
//This example uses the RangeFilterClearing event.
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
var cellRange =new GC.Spread.Sheets.Range(0, 0, 5, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellRange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeFilterClearing, function (e, info) {
alert("Col (" + info.col + ")");
});
• Static RangeFiltered: string
Occurs when a column has just been automatically filtered.
name GC.Spread.Sheets.Worksheet#RangeFiltered
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the column that was automatically filtered.
param Array filterValues The values by which the column was filtered.
param Array conditionInfo The condition rule info that which the column was filtered.
example
//This example uses the RangeFiltered event.
var cellrange =new GC.Spread.Sheets.Range(0, 2, 5, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellrange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeFiltered, function (e, info) {
alert("Col (" + info.col + ")");
});
• Static RangeFiltering: string
Occurs when a column is about to be automatically filtered.
name GC.Spread.Sheets.Worksheet#RangeFiltering
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the column to be automatically filtered.
param Array filterValues The values by which to filter the column.
param Object conditionInfo The condition rule info by which to filter the column.
example
//This example uses the RangeFiltering event.
var cellrange =new GC.Spread.Sheets.Range(0, 2, 5, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellrange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeFiltering, function (e, info) {
alert("Col (" + info.col + ")");
});
• Static RangeGroupStateChanged: string
Occurs when the user has changed the outline state (range group) for rows or columns.
name GC.Spread.Sheets.Worksheet#RangeGroupStateChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param boolean isRowGroup Whether the outline (range group) is a group of rows.
param number index The index of the RangeGroupInfo object whose state has changed.
param number level The level of the RangeGroupInfo object whose state has changed.
example
//This example uses the RangeGroupStateChanged event.
activeSheet.suspendPaint();
activeSheet.setRowCount(34);
activeSheet.setValue(0,0,"Western");
activeSheet.setValue(0,1,"Western");
activeSheet.setValue(0,2,"Western");
activeSheet.setValue(1,0,"A");
activeSheet.setValue(1,1,"B");
activeSheet.setValue(1,2,"C");
activeSheet.setValue(2,0,"A");
activeSheet.setValue(2,1,"B");
activeSheet.setValue(2,2,"C");
activeSheet.rowOutlines.group(0,2);
activeSheet.columnOutlines.group(0,1);
activeSheet.resumePaint();
activeSheet.bind(GC.Spread.Sheets.Events.RangeGroupStateChanged, function (e, info) {
alert("Level (" + info.level + ")");
});
• Static RangeGroupStateChanging: string
Occurs before the user changes the outline state (range group) for rows or columns.
name GC.Spread.Sheets.Worksheet#RangeGroupStateChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param boolean isRowGroup Whether the outline (range group) is a group of rows.
param number index The index of the RangeGroupInfo object whose state is changing.
param number level The level of the RangeGroupInfo object whose state is changing.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the RangeGroupStateChanging event.
activeSheet.suspendPaint();
activeSheet.setRowCount(34);
activeSheet.setValue(0,0,"Western");
activeSheet.setValue(0,1,"Western");
activeSheet.setValue(0,2,"Western");
activeSheet.setValue(1,0,"A");
activeSheet.setValue(1,1,"B");
activeSheet.setValue(1,2,"C");
activeSheet.setValue(2,0,"A");
activeSheet.setValue(2,1,"B");
activeSheet.setValue(2,2,"C");
activeSheet.rowOutlines.group(0,2);
activeSheet.columnOutlines.group(0,1);
activeSheet.resumePaint();
activeSheet.bind(GC.Spread.Sheets.Events.RangeGroupStateChanging, function (e, info) {
alert("Level (" + info.level + ")");
});
• Static RangeSorted: string
Occurs when a column has just been automatically sorted.
name GC.Spread.Sheets.Worksheet#RangeSorted
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the column that was automatically sorted.
param boolean ascending Whether the automatic sort is ascending.
example
//This example uses the RangeSorted event.
activeSheet.setValue(0, 0, 10);
activeSheet.setValue(1, 0, 100);
activeSheet.setValue(2, 0, 50);
activeSheet.setValue(3, 0, 40);
activeSheet.setValue(4, 0, 80);
activeSheet.setValue(5, 0, 1);
activeSheet.setValue(6, 0, 65);
activeSheet.setValue(7, 0, 20);
activeSheet.setValue(8, 0, 30);
activeSheet.setValue(9, 0, 35);
var cellrange =new GC.Spread.Sheets.Range(0, 0, 5, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellrange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeSorted, function (e, info) {
alert("Col (" + info.col + ", " + info.ascending +")");
});
• Static RangeSorting: string
Occurs when a column is about to be automatically sorted.
name GC.Spread.Sheets.Worksheet#RangeSorting
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number col The index of the column to be automatically sorted.
param boolean ascending Whether the automatic sort is ascending.
param boolean cancel Whether the operation should be canceled.
param GC.Spread.Sheets.Range range The range of automatic sort.
param GC.Spread.Sheets.GroupSort groupSort The groupSort level to use when sorting, default will use group level if contains group and use flat level if not contains group.
param boolean ignoreHidden Whether to ignore the hidden values and only sort visible values.
param Function compareFunction The customize function to use when sorting, used when value sort. function (value1, value2) {return 0;}
example
//This example uses the RangeSorting event.
activeSheet.setValue(0, 0, 10);
activeSheet.setValue(1, 0, 100);
activeSheet.setValue(2, 0, 50);
activeSheet.setValue(3, 0, 40);
activeSheet.setValue(4, 0, 80);
activeSheet.setValue(5, 0, 1);
activeSheet.setValue(6, 0, 65);
activeSheet.setValue(7, 0, 20);
activeSheet.setValue(8, 0, 30);
activeSheet.setValue(9, 0, 35);
var cellrange =new GC.Spread.Sheets.Range(0, 0, 10, 1);
var hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(cellrange);
activeSheet.rowFilter(hideRowFilter);
activeSheet.bind(GC.Spread.Sheets.Events.RangeSorting, function (e, info) {
alert("Col (" + info.col + ", " + info.ascending +")");
info.groupSort = GC.Spread.Sheets.GroupSort.full; //use full level sort.
info.ignoreHidden = false; // sort with the hidden values.
info.compareFunction = (obj1, obj2)=>{return obj1.toString().localeCompare(obj2.toString())};
});
• Static ReportSheetDataChanged: string
Occurs when the report sheet data has changed by update, insert or delete. Allows submitting data changes to the server.
name GC.Spread.Report.ReportSheet#ReportSheetDataChanged
param GC.Spread.Report.ReportSheet sheet The report sheet that triggered the event.
param string sheetName The report sheet's name.
param string type The report sheet change type. insert, update or delete.
param number row The changed row index.
param number col The changed column index.
example
//This example uses the ReportSheetDataChanged event.
const report = spread.addSheetTab(0, "Report", GC.Spread.Sheets.SheetType.reportSheet);
report.renderMode("Design");
const templateSheet = report.getTemplate();
templateSheet.setTemplateCell(0, 0, {
binding: "Orders[orderId]",
type: "Group",
});
templateSheet.setTemplateCell(0, 1, {
binding: "Orders[customerId]",
type: "Group",
});
templateSheet.setDataEntrySetting([ {
name: "Write Back Rule 1",
tableName: "Orders",
fields: [
{ dbColumnName: "orderId", formula: "A1", isPrimary: true },
{ dbColumnName: "customerId", formula: "B1" },
],
includeUnmodified: false,
skipRecordWithEmptyValue: false
} ]);
report.renderMode("Preview");
report.bind(GC.Spread.Sheets.Events.ReportSheetDataChanged, (event, args) => {
let reportsheet = args.sheet, changes = reportsheet.getChanges();
if (allowSubmit(changes)) { // users can submit or drop this changing.
reportsheet.submit(); // submit changes.
} else {
reportsheet.refresh(); // drop changes.
}
});
// after reportsheet edit / update / delete records in UI will trigger ReportSheetDataChanged event.
// users can submit into server or drop this changing in this moment.
• Static ReportSheetDataChanging: string
Occurs when the report sheet is changing by update, insert or delete. Allows validating or cancellation of the data operation.
name GC.Spread.Report.ReportSheet#ReportSheetDataChanging
param GC.Spread.Report.ReportSheet sheet The report sheet that triggered the event.
param string sheetName The report sheet's name.
param string type The report sheet change type. insert, update or delete.
param number row The changing row index.
param number col The changing column index.
param any oldValue The update changing old value.
param any newValue The update changing new value.
param boolean cancel Whether the report sheet changing operation should be canceled.
example
//This example uses the ReportSheetDataChanging event.
const report = spread.addSheetTab(0, "Report", GC.Spread.Sheets.SheetType.reportSheet);
report.renderMode("Design");
const templateSheet = report.getTemplate();
templateSheet.setTemplateCell(0, 0, {
binding: "Orders[orderId]",
type: "Group",
});
templateSheet.setTemplateCell(0, 1, {
binding: "Orders[customerId]",
type: "Group",
});
templateSheet.setDataEntrySetting([ {
name: "Write Back Rule 1",
tableName: "Orders",
fields: [
{ dbColumnName: "orderId", formula: "A1", isPrimary: true },
{ dbColumnName: "customerId", formula: "B1" },
],
includeUnmodified: false,
skipRecordWithEmptyValue: false
} ]);
report.renderMode("Preview");
report.bind(GC.Spread.Sheets.Events.ReportSheetDataChanging, (event, args) => {
let { type, row, col, oldValue, newValue } = args;
if (allowChange(type, row, col, oldValue, newValue)) { // user validate this changing operation here.
console.log(`${type} row: ${row}, col: ${col} from ${oldValue} to ${newValue}`);
} else {
args.cancel = true;
}
});
// reportsheet edit / update / delete records in UI will trigger ReportSheetDataChanging event.
// users can also cancel the operation here if the changing is invalid.
• Static ReportSheetRecordsSubmitted: string
Occurs after the report sheet submitted the changes to server. Allow user to provide UI feedback of the submit results from the server.
name GC.Spread.Report.ReportSheet#ReportSheetRecordsSubmitted
param GC.Spread.Report.ReportSheet sheet The report sheet that triggered the event.
param string sheetName The report sheet's name.
param {@link GC.Spread.Report.IRecord[]} updateSuccessRecords Successful update or insert records.
param {@link GC.Spread.Report.IFailedRecord[]} updateFailedRecords Failing update or insert records.
param {@link GC.Spread.Report.IRecord[]} deleteSuccessRecords Successful delete records.
param {@link GC.Spread.Report.IFailedRecord[]} deleteFailedRecords Failing delete records.
example
//This example uses the ReportSheetDataChanged event.
const report = spread.addSheetTab(0, "Report", GC.Spread.Sheets.SheetType.reportSheet);
report.renderMode("Design");
const templateSheet = report.getTemplate();
templateSheet.setTemplateCell(0, 0, {
binding: "Orders[orderId]",
type: "Group",
});
templateSheet.setTemplateCell(0, 1, {
binding: "Orders[customerId]",
type: "Group",
});
templateSheet.setDataEntrySetting([ {
name: "Write Back Rule 1",
tableName: "Orders",
fields: [
{ dbColumnName: "orderId", formula: "A1", isPrimary: true },
{ dbColumnName: "customerId", formula: "B1" },
],
includeUnmodified: false,
skipRecordWithEmptyValue: false
} ]);
report.renderMode("Preview");
report.bind(GC.Spread.Sheets.Events.ReportSheetRecordsSubmitted, (event, args) => {
let { updateSuccessRecords, deleteSuccessRecords, updateFailedRecords, deleteFailedRecords } = args;
for (let record of updateFailedRecords) {
for (let fieldKey in record.info) {
if (record.info.hasOwnproperty(fieldKey)) {
let recordDetail = record.info[fieldKey];
if (recordDetail.state === "updated") {
// user console the failed detail info.
console.log(`Updated failed in row: ${recordDetail.row} col: ${recordDetail.col}, oldValue: ${recordDetail.oldValue}, reason is ${record.reason}`);
}
}
}
}
});
// after submitting into the server, users can get the all success and failed records result.
• Static ReportSheetRecordsSubmitting: string
Occurs before the report sheet submitting changes to server. Allows final validation of all data changes or cancellign the operation.
name GC.Spread.Report.ReportSheet#ReportSheetRecordsSubmitting
param GC.Spread.Report.ReportSheet sheet The report sheet that triggered the event.
param string sheetName The report sheet's name.
param boolean cancel Whether the report sheet submit operation should be canceled.
example
//This example uses the ReportSheetDataChanged event.
const report = spread.addSheetTab(0, "Report", GC.Spread.Sheets.SheetType.reportSheet);
report.renderMode("Design");
const templateSheet = report.getTemplate();
templateSheet.setTemplateCell(0, 0, {
binding: "Orders[orderId]",
type: "Group",
});
templateSheet.setTemplateCell(0, 1, {
binding: "Orders[customerId]",
type: "Group",
});
templateSheet.setDataEntrySetting([ {
name: "Write Back Rule 1",
tableName: "Orders",
fields: [
{ dbColumnName: "orderId", formula: "A1", isPrimary: true },
{ dbColumnName: "customerId", formula: "B1" },
],
includeUnmodified: false,
skipRecordWithEmptyValue: false
} ]);
report.renderMode("Preview");
report.bind(GC.Spread.Sheets.Events.ReportSheetRecordsSubmitting, (event, args) => {
let reportsheet = args.sheet, changes = reportsheet.getChanges();
if (isInvalidate(changes)) {
args.cancel = true;
}
});
// after submitting the report chages, users can validate the changes and cancel this submit.
• Static RowChanged: string
Occurs when a change is made to a row or range of rows in this sheet that may require the row or range of rows to be repainted.
name GC.Spread.Sheets.Worksheet#RowChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index.
param GC.Spread.Sheets.SheetArea sheetArea The sheetArea of the row.
param string propertyName The name of the row's property that has changed.
param boolean isUndo Whether this event is from a undo operation.
example
//This example uses the RowChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.RowChanged, function (e, info) {
alert("Row (" + info.row + ")");
});
• Static RowChanging: string
Occurs when before a change is made to a row or range of rows in this sheet that may require the row or range of rows to be repainted.
name GC.Spread.Sheets.Worksheet#RowChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index.
param GC.Spread.Sheets.SheetArea sheetArea The sheetArea of the row.
param string propertyName The name of the row's property that has changed.
example
//This example uses the RowChanging event.
activeSheet.bind(GC.Spread.Sheets.Events.RowChanging, function (e, info) {
alert("Row (" + info.row + ")");
});
• Static RowHeightChanged: string
Occurs when the row height has changed.
name GC.Spread.Sheets.Worksheet#RowHeightChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Array rowList The list of rows whose heights have changed.
param boolean header Whether the columns are column header columns.
example
//This example uses the RowHeightChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.RowHeightChanged, function (e, info) {
alert("Row List (" + info.rowList + ")");
});
• Static RowHeightChanging: string
Occurs when the row height is changing.
name GC.Spread.Sheets.Worksheet#RowHeightChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param Array rowList The list of rows whose heights are changing.
param boolean header Whether the columns are column header columns.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the RowHeightChanging event.
activeSheet.bind(GC.Spread.Sheets.Events.RowHeightChanging, function (e, info) {
alert("Row List (" + info.rowList + ")");
});
• Static RowOperation: string
Occurs when the applied row action is operated.
name GC.Spread.Sheets.TableSheet.TableSheet#RowOperation
param GC.Spread.Sheets.TableSheet.TableSheet sheet The table sheet that triggered the event.
param string sheetName The table sheet's name.
param GC.Spread.Sheets.TableSheet.ActionType actionType The row action type.
param number row The row index.
example
//This example uses the RowOperation event.
workbook.bind(GC.Spread.Sheets.Events.RowOperation, function (e, info) {
console.log(info.sheetName, info.actionType, info.row);
});
• Static SelectionChanged: string
Occurs when the selection of cells on the sheet has changed.
name GC.Spread.Sheets.Worksheet#SelectionChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param {@link GC.Spread.Sheets.Range[]} oldSelections The old selection ranges.
param {@link GC.Spread.Sheets.Range[]} newSelections The new selection ranges.
example
//This example uses the SelectionChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e, info) {
alert("Name (" + info.sheetName + ")");
});
• Static SelectionChanging: string
Occurs when the selection of cells on the sheet is changing.
name GC.Spread.Sheets.Worksheet#SelectionChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param {@link GC.Spread.Sheets.Range[]} oldSelections The old selection ranges.
param {@link GC.Spread.Sheets.Range[]} newSelections The new selection ranges.
example
//This example uses the SelectionChanging event.
activeSheet.bind(GC.Spread.Sheets.Events.SelectionChanging, function (e, info) {
//Use IE to see console
console.log("Name (" + info.sheetName + ")");
});
• Static ShapeChanged: string
Occurs when any shape has changed.
name GC.Spread.Sheets.Worksheet#ShapeChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape that triggered the event.
param string propertyName The name of the shape's property that has changed.
example
//This example uses the ShapeChanged event.
var shape1 = activeSheet.shapes.add("shape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 20, 20, 200, 200);
activeSheet.bind(GC.Spread.Sheets.Events.ShapeChanged, function (e, info) {
alert("changed");
});
• Static ShapeRemoved: string
Occurs when the user has removed the shape.
name GC.Spread.Sheets.Worksheet#ShapeRemoved
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape has been removed.
example
//This example uses the ShapeRemoved event.
var shape = activeSheet.shapes.add("myShape", GC.Spread.Sheets.Shapes.AutoShapeType.diamond, 0, 90, 200, 200);
activeSheet.bind(GC.Spread.Sheets.Events.ShapeRemoved, function (e, info) {
alert(info.shape.name());
});
• Static ShapeRemoving: string
Occurs when the user is removing any shape.
name GC.Spread.Sheets.Worksheet#ShapeRemoving
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape is being removed.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the ShapeRemoving event.
var shape = sheet.shapes.add("myShape", GC.Spread.Sheets.Shapes.AutoShapeType.diamond, 0, 90, 200, 200);
activeSheet.bind(GC.Spread.Sheets.Events.ShapeRemoving, function (e, info) {
info.cancel = true;// the shape will not remove
});
• Static ShapeSelectionChanged: string
Occurs when the selections of the shape have changed.
name GC.Spread.Sheets.Worksheet#ShapeSelectionChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Shapes.Shape shape The shape that triggered the event.
example
//This example uses the ShapeSelectionChanged event.
var shape = sheet.shapes.add("myShape", GC.Spread.Sheets.Shapes.AutoShapeType.diamond, 0, 90, 200, 200);
activeSheet.bind(GC.Spread.Sheets.Events.ShapeSelectionChanged, function (e, info) {
console.log("event info: " + info);
});
• Static SheetChanged: string
After sheet changed.
name GC.Spread.Sheets.Worksheet#SheetChanged
param string sheetName The sheet's name.
param string propertyName The specific operation name.
param number sheetIndex The sheet index, related to the Worksheet collection or SheetTab collection.
param number sheetPosition The sheet position, related to the combined collection which contains all Worksheet and SheetTab.
param boolean oldValue Sheet changes the value of the previous attribute(isVisible, isSelected...).
param boolean newValue Sheet changes the value of the attribute(isVisible, isSelected...).
example
//This example.
spread.bind(GC.Spread.Sheets.Events.SheetChanged, function (sender, args) {
var sheet = args.sheet;
});
• Static SheetChanging: string
Before sheet changed.
name GC.Spread.Sheets.Worksheet#SheetChanging
param string sheetName The sheet's name.
param string propertyName The specific operation name .
param number sheetIndex The sheet index, related to the Worksheet collection or SheetTab collection.
param number sheetPosition The sheet position, related to the combined collection which contains all Worksheet and SheetTab.
param boolean oldValue Sheet changes the value of the previous attribute(isVisible, isSelected...).
param boolean newValue Sheet changes the value of the attribute(isVisible, isSelected...).
param boolean cancel Cancel the current operation.
example
//This example.
spread.bind(GC.Spread.Sheets.Events.SheetChanging, function (sender, args) {
var sheetIndex = args.sheetIndex;
args.cancel = true;
});
• Static SheetMoved: string
Occurs after the user drags and moves the sheet.
name GC.Spread.Sheets.Worksheet#SheetMoved
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number oldIndex The previous sheet index.
param number newIndex The new sheet index.
example
//This example uses the SheetMoved event.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();
spread.bind(GC.Spread.Sheets.Events.SheetMoving, function (e, data) {
alert(data.sheetName + '\n' + 'oldIndex: ' + data.oldIndex + '\n' + 'newIndex: ' + data.newIndex + '\n' + 'cancel: ' + data.cancel);
});
spread.bind(GC.Spread.Sheets.Events.SheetMoved, function (e, data) {
alert(data.sheetName + '\n' + 'oldIndex: ' + data.oldIndex + '\n' + 'newIndex: ' + data.newIndex);
});
}
• Static SheetMoving: string
Occurs before the user drags and moves the sheet.
name GC.Spread.Sheets.Worksheet#SheetMoving
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number oldIndex The old sheet index.
param number newIndex A value that indicates the index will be moved to.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the SheetMoving event.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();
spread.bind(GC.Spread.Sheets.Events.SheetMoving, function (e, data) {
alert(data.sheetName + '\n' + 'oldIndex: ' + data.oldIndex + '\n' + 'newIndex: ' + data.newIndex + '\n' + 'cancel: ' + data.cancel);
});
spread.bind(GC.Spread.Sheets.Events.SheetMoved, function (e, data) {
alert(data.sheetName + '\n' + 'oldIndex: ' + data.oldIndex + '\n' + 'newIndex: ' + data.newIndex);
});
}
• Static SheetNameChanged: string
Occurs when the user has changed the sheet name.
name GC.Spread.Sheets.Worksheet#SheetNameChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string oldValue The sheet's old name.
param string newValue The sheet's new name.
example
//This example uses the SheetNameChanged event.
// Use web browser to see the console log text
spread.bind(GC.Spread.Sheets.Events.SheetNameChanging, function (sender, args) {
console.log(args.oldValue);
});
spread.bind(GC.Spread.Sheets.Events.SheetNameChanged, function (sender, args) {
console.log(args.newValue);
});
• Static SheetNameChanging: string
Occurs when the user is changing the sheet name.
name GC.Spread.Sheets.Worksheet#SheetNameChanging
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string oldValue The sheet's old name.
param string newValue The sheet's new name.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the SheetNameChanging event.
// Use web browser to see the console log text
spread.bind(GC.Spread.Sheets.Events.SheetNameChanging, function (sender, args) {
console.log(args.oldValue);
});
spread.bind(GC.Spread.Sheets.Events.SheetNameChanged, function (sender, args) {
console.log(args.newValue);
});
• Static SheetTabClick: string
Occurs when the user clicks the sheet tab.
name GC.Spread.Sheets.Worksheet#SheetTabClick
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number sheetTabIndex The index of the sheet tab that the user clicked.
example
//This example uses the SheetTabClick event.
spread.bind(GC.Spread.Sheets.Events.SheetTabClick, function (e, info) {
alert("Index (" + info.sheetTabIndex + ")");
});
• Static SheetTabDoubleClick: string
Occurs when the user double-clicks the sheet tab.
name GC.Spread.Sheets.Worksheet#SheetTabDoubleClick
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number sheetTabIndex The index of the sheet tab that the user double-clicked.
example
//This example uses the SheetTabDoubleClick event.
spread.bind(GC.Spread.Sheets.Events.SheetTabDoubleClick, function (e, info) {
alert("Index (" + info.sheetTabIndex + ")");
});
• Static SlicerChanged: string
Occurs when any slicer has changed.
name GC.Spread.Sheets.Worksheet#SlicerChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Slicers.ISlicer slicer The slicer that triggered the event.
param string propertyName The name of the slicer's property that has changed.
example
//This example uses the SlicerChanged event.
//create a table
datas = [
["1", "NewYork", "1968/6/8", "80", "180"],
["4", "NewYork", "1972/7/3", "72", "168"],
["4", "NewYork", "1964/3/2", "71", "179"],
["5", "Washington", "1972/8/8","80", "171"],
["6", "Washington", "1986/2/2", "89", "161"],
["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
//add a slicer to the sheet and return the slicer instance.
var slicer = activeSheet.slicers.add("slicer1",table.name(),"Name");
//change the slicer properties.
slicer.width(200);
slicer.height(200);
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.style(GC.Spread.Sheets.Slicers.SlicerStyles.dark4());
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.SlicerChanged, function (e, info) {
console.log("name: " + info.propertyName);
});
• Static SparklineChanged: string
Occurs when the sparkline has changed.
name GC.Spread.Sheets.Worksheet#SparklineChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Sparklines.Sparkline sparkline The sparkline whose property has changed.
example
//Removing the sparkline causes a change.
var data = new GC.Spread.Sheets.Range(1, 0, 8, 1);
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
setting.options.lineWeight = 3;
setting.options.displayXAxis = true;
setting.options.showFirst = true;
setting.options.showLast = true;
setting.options.showLow = true;
setting.options.showHigh = true;
setting.options.showNegative = true;
setting.options.seriesColor = "Text 2 1";
setting.options.firstMarkerColor = "Text 2 3";
setting.options.negativeColor = "Accent 2 1";
setting.options.markersColor = "Accent 3 1";
setting.options.lowMarkerColor = "Accent 4 1";
setting.options.highMarkerColor = "Accent 6 1";
setting.options.lastMarkerColor = "Accent 6 6";
setting.options.axisColor = "Text 1 1";
activeSheet.addSpan(13, 0, 4, 3, null);
activeSheet.setSparkline(13, 0, data, GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting);
activeSheet.setValue(1, 0, 1);
activeSheet.setValue(2, 0, -2);
activeSheet.setValue(3, 0, -1);
activeSheet.setValue(4, 0, 6);
activeSheet.setValue(5, 0, 4);
activeSheet.setValue(6, 0, -4);
activeSheet.setValue(7, 0, 3);
activeSheet.setValue(8, 0, 8);
// Use web browser to see the console log text
activeSheet.bind(GC.Spread.Sheets.Events.SparklineChanged, function (e, info) {
console.log("name: " + info.sheetName);
});
$("#button1").click(function () {
activeSheet.removeSparkline(13, 0);
});
• Static TableColumnsChanged: string
Occurs when the user insert/delete columns in table.
name GC.Spread.Sheets.Worksheet#TableColumnsChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param GC.Spread.Sheets.Tables.Table table The table which is insert/delete rows.
param string propertyName The operation name which trigger event.
param number col The index of the starting column to insert/delete based on table index.
param number count The number of columns to insert/delete.
param boolean isAfter Whether insert columns before the specified column index or after. By default is false, insert before.
example
//This example uses the TableColumnsChanged event.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var activeSheet = spread.getActiveSheet();
spread.bind(GC.Spread.Sheets.Events.TableColumnsChanged, function (e, data) {});
}
• Static TableFilterCleared: string
Occurs when a table column has just been clear filter.
name GC.Spread.Sheets.Worksheet#TableFilterCleared
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Tables.Table table The table column to be automatically filtered.
param number tableCol The index of the table column has just been clear filter.
example
//This example uses the TableFilterCleared event.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
activeSheet.bind(GC.Spread.Sheets.Events.TableFilterCleared, function (e, info) {
alert("Sheet (" + info.sheetName + ")");
});
• Static TableFilterClearing: string
Occurs when a table column is about to be automatically clear filter.
name GC.Spread.Sheets.Worksheet#TableFilterCleared
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Tables.Table table The table column to be automatically filtered.
param number tableCol The index of the table column to be automatically clear filter.
example
//This example uses the TableFilterClearing event.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
activeSheet.bind(GC.Spread.Sheets.Events.TableFilterClearing, function (e, info) {
alert("Sheet (" + info.sheetName + ")");
});
• Static TableFiltered: string
Occurs when a table column has just been automatically filtered.
name GC.Spread.Sheets.Worksheet#TableFiltered
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Tables.Table table The table column to be automatically filtered.
param number col The index of the table column to be automatically filtered.
param Array filterValues The values by which to filter the column.
param Object conditionInfo The condition rule info by which to filter the column.
example
//This example uses the TableFiltered event.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
activeSheet.bind(GC.Spread.Sheets.Events.TableFiltered, function (e, info) {
alert("Sheet (" + info.sheetName + ")");
});
• Static TableFiltering: string
Occurs when a table column is about to be automatically filtered.
name GC.Spread.Sheets.Worksheet#TableFiltering
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param GC.Spread.Sheets.Tables.Table table The table column to be automatically filtered.
param number col The index of the table column to be automatically filtered.
param Array filterValues The values by which to filter the column.
param Object conditionInfo The condition rule info by which to filter the column.
example
//This example uses the TableFiltering event.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
activeSheet.bind(GC.Spread.Sheets.Events.TableFiltering, function (e, info) {
alert("Sheet (" + info.sheetName + ")");
});
• Static TableResized: string
Occurs after the user resized table.
name GC.Spread.Sheets.Worksheet#TableResized
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param GC.Spread.Sheets.Tables.Table table The table which is resized.
param GC.Spread.Sheets.Range oldRange The table range before resize.
param GC.Spread.Sheets.Range newRange The table range after resize.
• Static TableResizing: string
Occurs when the user resizing table by resize handler.
name GC.Spread.Sheets.Worksheet#TableResizing
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param GC.Spread.Sheets.Tables.Table table The table which is resizing.
param GC.Spread.Sheets.Range oldRange The table range before resize.
param GC.Spread.Sheets.Range newRange The table range after resize.
param boolean cancel Whether to cancel the current resize behavior. The default value is false.
example
//This example uses the TableResizing and TableResized event.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var activeSheet = spread.getActiveSheet();
spread.bind(GC.Spread.Sheets.Events.TableResizing, function (e, data) {
if (data.newRange.rowCount > 10) {
args.cancel = true;
}
});
spread.bind(GC.Spread.Sheets.Events.TableResizing, function (e, data) {});
spread.bind(GC.Spread.Sheets.Events.TableResized, function (e, data) {});
}
• Static TableRowsChanged: string
Occurs when the user insert/delete rows in table.
name GC.Spread.Sheets.Worksheet#TableRowsChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param GC.Spread.Sheets.Tables.Table table The table which is insert/delete rows.
param string propertyName The operation name which trigger event.
param number row The index of the starting row to insert/delete based on table index.
param number count The number of rows to insert/delete.
param boolean isAfter Whether insert rows before the specified row index or after. By default is false, insert before.
param Object[] deletedItem The deleted rows collection in binding. The every item in array specifies deleted data item.
example
//This example uses the TableRowsChanged event.
window.onload = function(){
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var activeSheet = spread.getActiveSheet();
spread.bind(GC.Spread.Sheets.Events.TableRowsChanged, function (e, data) {});
}
• Static TopRowChanged: string
Occurs when the top row changes.
name GC.Spread.Sheets.Worksheet#TopRowChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number oldTopRow The old top row index.
param number newTopRow The new top row index.
param number oldOffset The old top row offset.
param number newOffset The new top row offset.
example
//This example synchronizes vertical and horizontal scrolling for sheet 1 and sheet 2.
var sheet1 = spread.getSheet(0),
sheet2 = spread.getSheet(1);
sheet1.bind(GC.Spread.Sheets.Events.TopRowChanged, function (sender, args) {
//Set the displayed top row of sheet1 to sheet2 (vertical scroll synchronization).
sheet2.showRow(args.newTopRow, GC.Spread.Sheets.VerticalPosition.top);
});
sheet1.bind(GC.Spread.Sheets.Events.LeftColumnChanged, function (sender, args) {
//Set the displayed left column of sheet1 to sheet2 (Horizontal scroll synchronization).
sheet2.showColumn(args.newLeftCol, GC.Spread.Sheets.HorizontalPosition.left);
});
• Static TouchToolStripOpening: string
Occurs before the touch toolbar pops up.
name GC.Spread.Sheets.Worksheet#TouchToolStripOpening
param number x The x-coordinate of the horizontal position.
param number y The y-coordinate of the vertical position.
param boolean handled If true, the touch toolbar is prevented from popping up; otherwise, the toolbar is displayed at the default position.
example
//This example uses the TouchToolStripOpening event.
activeSheet.bind(GC.Spread.Sheets.Events.TouchToolStripOpening, function (e, info) {
alert(info.x);
});
• Static UserFormulaEntered: string
Occurs when the user types a formula.
name GC.Spread.Sheets.Worksheet#UserFormulaEntered
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell in which the user entered a formula.
param number col The column index of the cell in which the user entered a formula.
param string formula The formula that the user entered.
param boolean isCircularReference The entered formula is circular reference.
example
//This example uses the UserFormulaEntered event.
activeSheet.bind(GC.Spread.Sheets.Events.UserFormulaEntered, function (e, info) {
alert("Formula (" + info.formula + ")");
});
• Static ValidationError: string
Occurs when the applied cell value is invalid.
name GC.Spread.Sheets.Worksheet#ValidationError
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The cell's row index.
param number col The cell's column index.
param Object editingValue The cell's editing value.
param GC.Spread.Sheets.DataValidation.DefaultDataValidator validator The data validator that caused the error.
param GC.Spread.Sheets.DataValidation.DataValidationResult validationResult The policy that the user can set to determine how to process the error.
example
//This example uses the ValidationError event.
var nCondition = new GC.Spread.Sheets.ConditionalFormatting.Condition(GC.Spread.Sheets.ConditionalFormatting.ConditionType.cellValueCondition);
nCondition.compareType(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.equalsTo);
nCondition.expected(0);
//When the option is false, the validation fails and the red alert is displayed.
//When the option is true, the blank cell is treated as zero and the validation is successful.
nCondition.treatNullValueAsZero(false);
var validator = new GC.Spread.Sheets.DataValidation.DefaultDataValidator(nCondition)
validator.ignoreBlank(false);
validator.type(GC.Spread.Sheets.DataValidation.CriteriaType.wholeNumber)
activeSheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport).validator(validator);
spread.options.highlightInvalidData = true;
activeSheet.setValue(0, 0, null);
//Type different values in cell (0,0). This event fires if the user types an invalid value.
activeSheet.bind("ValidationError", vError);
function vError(sender, args) {
alert("error");
}
• Static ValueChanged: string
Occurs when the value in the subeditor changes.
name GC.Spread.Sheets.Worksheet#ValueChanged
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number row The row index of the cell.
param number col The column index of the cell.
param Object oldValue The old value of the cell.
param Object newValue The new value of the cell.
example
//This example uses the ValueChanged event.
activeSheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
alert("Value (" + info.newValue + ")");
});
• Static ViewZoomed: string
Occurs after the user zooms.
name GC.Spread.Sheets.Worksheet#ViewZoomed
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number newZoomFactor The new zoom factor.
param number oldZoomFactor The old zoom factor.
example
//This example uses the ViewZoomed event.
spread.options.allowUserZoom = true;
activeSheet.bind(GC.Spread.Sheets.Events.ViewZoomed, function (e, info) {
alert("Zoom (" + info.newZoomFactor + ")");
});
• Static ViewZooming: string
Occurs when the user zooms.
name GC.Spread.Sheets.Worksheet#ViewZooming
param GC.Spread.Sheets.Worksheet sheet The sheet that triggered the event.
param string sheetName The sheet's name.
param number newZoomFactor The new zoom factor, user could make some change to intervene the real zoom action.
param number oldZoomFactor The old zoom factor.
param boolean cancel A value that indicates whether the operation should be canceled.
example
//This example uses the ViewZooming event, to limit zooming max factor.
spread.options.allowUserZoom = true;
activeSheet.bind(GC.Spread.Sheets.Events.ViewZooming, function (e, info) {
if (info.newZoomFactor >= 2) {
info.newZoomFactor = 2;
}
});