Skip to Content
ClassesFEventName

Class: FEventName

Extends

  • IFSheetEventMixin.IFSheetFilterEventMixin.ICommentEventMixin.IDataValidationEvent.IFSheetLinkEvent.IFSheetSortEventMixin.IPivotTableEventMixin.IFSheetSparklineEventMixin.IFSheetsUIEventNameMixin.IFDrawingEventNameMixin.IFSheetCrosshairHighlightEventMixin.IFSheetPrintEventName

Properties

PropertyModifierTypeDescription

BeforeClipboardChange

readonly

"BeforeClipboardChange"

Trigger this event before the clipboard content changes. Type of the event parameter is IBeforeClipboardChangeParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeClipboardChange, (param) => { const {text, html} = param; console.log('debugger', text, html); // {text: '...', html: '...'} // if want to cancel the clipboard change param.cancel = true; })

BeforeClipboardPaste

readonly

"BeforeClipboardPaste"

Trigger this event before pasting. Type of the event parameter is IBeforeClipboardPasteParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeClipboardPaste, (param) => { const {text, html} = param; console.log('debugger', text, html); // if want to cancel the clipboard paste param.cancel = true; })

BeforeCommentAdd

readonly

"BeforeCommentAdd"

Event fired before comment added

See

IBeforeSheetCommentAddEvent

Example

univerAPI.addEventListener(CommentEvent.BeforeCommentAdd, (event) => { const { comment, workbook, worksheet, row, col } = event; console.log(event); });

BeforeCommentDeleted

readonly

"BeforeCommentDeleted"

Event fired before comment delete

See

IBeforeSheetCommentDeleteEvent

Example

univerAPI.addEventListener(CommentEvent.BeforeCommentDeleted, (event) => { const { commentId, workbook, worksheet } = event; console.log(event); });

BeforeCommentResolve

readonly

"BeforeCommentResolve"

Event fired before comment resolve

See

ISheetCommentResolveEvent

Example

univerAPI.addEventListener(CommentEvent.BeforeCommentResolve, (event) => { const { comment, row, col, resolved, workbook, worksheet } = event; console.log(event); });

BeforeCommentUpdate

readonly

"BeforeCommentUpdate"

Event fired before comment update

See

IBeforeSheetCommentUpdateEvent

Example

univerAPI.addEventListener(CommentEvent.BeforeCommentUpdate, (event) => { const { comment, workbook, worksheet, row, col, newContent } = event; console.log(event); });

BeforeOverGridImageChange

readonly

"BeforeOverGridImageChange"

Triggered before floating image change. Type of the event parameter is IBeforeOverGridImageChangeParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageChange, (param) => { const { workbook, images } = param; // do something console.log(workbook, images); // Cancel the image change param.cancel = true; })

BeforeOverGridImageInsert

readonly

"BeforeOverGridImageInsert"

Triggered before floating image insertion. Type of the event parameter is IBeforeOverGridImageInsertParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageInsert, (param) => { const { workbook, insertImageParams } = param; // do something console.log(workbook, insertImageParams); // Cancel the insertion operation param.cancel = true; })

BeforeOverGridImageRemove

readonly

"BeforeOverGridImageRemove"

Triggered before floating image removal. Type of the event parameter is IBeforeOverGridImageRemoveParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageRemove, (param) => { const { workbook, images } = param; // do something console.log(workbook, images); // Cancel the removal operation param.cancel = true; })

BeforeOverGridImageSelect

readonly

"BeforeOverGridImageSelect"

Triggered before floating image selection. Type of the event parameter is IBeforeOverGridImageSelectParam

Example

univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageSelect, (param) => { const { workbook, selectedImages, oldSelectedImages } = param; // do something console.log(workbook, selectedImages, oldSelectedImages); // cancel the event param.cancel = true; })

BeforePivotTableAdd

readonly

"BeforePivotTableAdd"

The before pivot table add event.The event parameter is IPivotTableAddedEventParams

Example

univerAPI.addEvent(univerAPI.Event.BeforePivotTableAdd, (params) => { const { positionType, targetCellInfo } = params; if (positionType === univerAPI.Enum.PositionTypeEnum.Existing && targetCellInfo.sheetName === 'Sheet 1') { params.cancel = true; console.log(`The pivot table can't be added to the sheet ${targetCellInfo.sheetName}`); } });

BeforePivotTableMove

readonly

"BeforePivotTableMove"

The before pivot table moved event.The event parameter is IPivotTableMovedEventParams

Example

univerAPI.addEvent(univerAPI.Event.BeforePivotTableMove, (params) => { const { pivotTableId, targetCellInfo } = params; if (pivotTableId === 'pivotTable1' && targetCellInfo.sheetName === 'Sheet 1') { params.cancel = true; console.log(`The pivot table can't be moved to the sheet ${targetCellInfo.sheetName}`); } });

BeforeSheetDataValidationAdd

readonly

"BeforeSheetDataValidationAdd"

Event fired before a rule is added

See

IBeforeSheetDataValidationAddEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationAdd, (event) => { const { worksheet, workbook, rule } = event; console.log(event); });

BeforeSheetDataValidationCriteriaUpdate

readonly

"BeforeSheetDataValidationCriteriaUpdate"

Event fired before the criteria of a rule are updated

See

IBeforeSheetDataValidationCriteriaUpdateEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationCriteriaUpdate, (event) => { const { worksheet, workbook, rule, newCriteria } = event; console.log(event); });

BeforeSheetDataValidationDelete

readonly

"BeforeSheetDataValidationDelete"

Event fired before a rule is deleted

See

IBeforeSheetDataValidationDeleteEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationDelete, (event) => { const { worksheet, workbook, rule } = event; console.log(event); });

BeforeSheetDataValidationDeleteAll

readonly

"BeforeSheetDataValidationDeleteAll"

Event fired before all rules are deleted

See

IBeforeSheetDataValidationDeleteAllEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationDeleteAll, (event) => { const { worksheet, workbook, rules } = event; console.log(event); });

BeforeSheetDataValidationOptionsUpdate

readonly

"BeforeSheetDataValidationOptionsUpdate"

Event fired before the options of a rule are updated

See

IBeforeSheetDataValidationOptionsUpdateEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationOptionsUpdate, (event) => { const { worksheet, workbook, rule, newOptions } = event; console.log(event); });

BeforeSheetDataValidationRangeUpdate

readonly

"BeforeSheetDataValidationRangeUpdate"

Event fired before the range of a rule is updated

See

IBeforeSheetDataValidationRangeUpdateEvent

Example

univerAPI.on(univerAPI.Event.BeforeSheetDataValidationRangeUpdate, (event) => { const { worksheet, workbook, rule, newRanges } = event; console.log(event); });

BeforeSheetEditEnd

readonly

"BeforeSheetEditEnd"

Event fired before a cell edit ends

See

IBeforeSheetEditEndEventParams

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => { const { worksheet, workbook, row, column, value, eventType, keycode, isZenEditor } = params; });

BeforeSheetEditStart

readonly

"BeforeSheetEditStart"

Event fired before a cell is edited

See

IBeforeSheetEditStartEventParams

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; });

BeforeSheetLinkAdd

readonly

"BeforeSheetLinkAdd"

Event triggered before adding a link

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkAdd, (params) => { const { workbook, worksheet, row, col, link } = params; console.log('before sheet link add', params); });

BeforeSheetLinkCancel

readonly

"BeforeSheetLinkCancel"

Event triggered before canceling a link

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkCancel, (params) => { const { workbook, worksheet, row, column, id } = params; console.log('before sheet link cancel', params); });

BeforeSheetLinkUpdate

readonly

"BeforeSheetLinkUpdate"

Event triggered before updating a link

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkUpdate, (params) => { const { workbook, worksheet, row, column, id, payload } = params; console.log('before sheet link update', params); });

BeforeSheetPrintCanceled

readonly

"BeforeSheetPrintCanceled"

Event triggered before print operation is canceled

Example

univerAPI.addEvent(univerAPI.event.BeforeSheetPrintCanceled, (params) => { const { renderConfig, layoutConfig } = params; console.log('params', params); });

BeforeSheetPrintConfirm

readonly

"BeforeSheetPrintConfirm"

Event triggered before print settings are confirmed

Example

univerAPI.addEvent(univerAPI.event.BeforeSheetPrintConfirm, (params) => { const { renderConfig, layoutConfig } = params; console.log('params', params); });

BeforeSheetPrintOpen

readonly

"BeforeSheetPrintOpen"

Event triggered before print dialog opens

Example

univerAPI.addEvent(univerAPI.event.BeforeSheetPrintOpen, (params) => { const { workbook, worksheet } = params; console.log('params', params); });

BeforeSheetZoomChange

readonly

"BeforeSheetZoomChange"

Event fired before zoom changed

See

ISheetZoomEvent

Example

univerAPI.addEvent(univerAPI.Event.BeforeSheetZoomChange, (p)=> { const { worksheet, workbook, zoom } = p; });

CellClicked

readonly

"CellClicked"

Event fired when a cell is clicked

See

ICellEventParam

Example

univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { const { worksheet, workbook, row, column, value, isZenEditor } = params; });

CellHover

readonly

"CellHover"

Event fired when a cell is hovered

See

ICellEventParam

Example

univerAPI.addEvent(univerAPI.Event.CellHover, (params) => { const { worksheet, workbook, row, column } = params; });

CellPointerDown

readonly

"CellPointerDown"

Event fired when a cell is pointer down

See

ICellEventParam

Example

univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params) => { const { worksheet, workbook, row, column } = params; });

CellPointerMove

readonly

"CellPointerMove"

Event fired when move on spreadsheet cells

See

ICellEventParam

Example

univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => { const { worksheet, workbook, row, column } = params; });

CellPointerUp

readonly

"CellPointerUp"

Event fired when a cell is pointer up

See

ICellEventParam

Example

univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params) => { const { worksheet, workbook, row, column } = params; });

ClipboardChanged

readonly

"ClipboardChanged"

Trigger this event after the clipboard content changes. Type of the event parameter is IClipboardChangedParam

Example

univerAPI.addEvent(univerAPI.Event.ClipboardChanged, (param) => { const {text, html} = param; console.log('debugger', text, html); // {text: '...', html: '...'} })

ClipboardPasted

readonly

"ClipboardPasted"

Trigger this event after pasting. Type of the event parameter is IClipboardPastedParam

Example

univerAPI.addEvent(univerAPI.Event.ClipboardPasted, (param) => { const {text, html} = param; console.log('debugger', text, html); // {text: '...', html: '...'} })

ColumnHeaderClick

readonly

"ColumnHeaderClick"

Triggered when a column header is clicked

Param

Event parameters containing unitId, subUnitId, and column index

Example

univerAPI.onSheetEvent(Event.ColumnHeaderClick, (params) => { console.log(`Column ${params.column} header clicked in sheet ${params.worksheet.getSheetId()}`); });

ColumnHeaderHover

readonly

"ColumnHeaderHover"

Triggered when pointer hovers over a column header

Param

Event parameters containing unitId, subUnitId, and column index

Example

univerAPI.onSheetEvent(Event.ColumnHeaderHover, (params) => { console.log(`Hovering over column ${params.column} header in sheet ${params.worksheet.getSheetId()}`); });

ColumnHeaderPointerDown

readonly

"ColumnHeaderPointerDown"

Triggered when pointer is pressed down on a column header

Param

Event parameters containing unitId, subUnitId, and column index

Example

univerAPI.onSheetEvent(Event.ColumnHeaderPointerDown, (params) => { console.log(`Pointer down on column ${params.column} header in sheet ${params.worksheet.getSheetId()}`); });

ColumnHeaderPointerUp

readonly

"ColumnHeaderPointerUp"

Triggered when pointer is released on a column header

Param

Event parameters containing unitId, subUnitId, and column index

Example

univerAPI.onSheetEvent(Event.ColumnHeaderPointerUp, (params) => { console.log(`Pointer up on column ${params.column} header in sheet ${params.worksheet.getSheetId()}`); });

CommentAdded

readonly

"CommentAdded"

Event fired after comment added

See

ISheetCommentAddEvent

Example

univerAPI.addEventListener(CommentEvent.CommentAdded, (event) => { const { comment, workbook, worksheet, row, col } = event; console.log(event); });

CommentDeleted

readonly

"CommentDeleted"

Event fired after comment deleted

See

ISheetCommentDeleteEvent

Example

univerAPI.addEventListener(CommentEvent.CommentDeleted, (event) => { const { commentId, workbook, worksheet } = event; console.log(event); });

CommentResolved

readonly

"CommentResolved"

Event fired after comment resolve

See

ISheetCommentResolveEvent

Example

univerAPI.addEventListener(CommentEvent.CommentResolved, (event) => { const { comment, row, col, resolved, workbook, worksheet } = event; console.log(event); });

CommentUpdated

readonly

"CommentUpdated"

Event fired after comment updated

See

ISheetCommentUpdateEvent

Example

univerAPI.addEventListener(CommentEvent.CommentUpdated, (event) => { const { comment, workbook, worksheet, row, col } = event; console.log(event); });

CrosshairHighlightColorChanged

readonly

"CrosshairHighlightColorChanged"

Triggered when the crosshair highlight color is changed.

Example

univerAPI.addEvent(univerAPI.Event.CrosshairHighlightColorChanged, (event) => { const color = event.color; const workbook = event.workbook; const worksheet = event.worksheet; });

CrosshairHighlightEnabledChanged

readonly

"CrosshairHighlightEnabledChanged"

Triggered when the crosshair highlight is enabled or disabled.

Example

univerAPI.addEvent(univerAPI.Event.CrosshairHighlightEnabledChanged, (event) => { const enabled = event.enabled; const workbook = event.workbook; const worksheet = event.worksheet; });

DragOver

readonly

"DragOver"

Event fired when drag over spreadsheet cells

See

ICellEventParam

Example

univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.DragOver, (params) => { const { worksheet, workbook, row, column } = params; });

Drop

readonly

"Drop"

Event fired when drop on spreadsheet cells

See

ICellEventParam

Example

univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.Drop, (params) => { const { worksheet, workbook, row, column } = params; });

OverGridImageChanged

readonly

"OverGridImageChanged"

Triggered after floating image change. Type of the event parameter is IOverGridImageChangedParam

Example

univerAPI.addEvent(univerAPI.Event.OverGridImageChanged, (param) => { const { workbook, images } = param; // do something console.log(workbook, images); })

OverGridImageInserted

readonly

"OverGridImageInserted"

Triggered after floating image insertion. Type of the event parameter is IOverGridImageInsertedParam

Example

univerAPI.addEvent(univerAPI.Event.OverGridImageInserted, (param) => { const { workbook, images } = param; // do something console.log(workbook, images); })

OverGridImageRemoved

readonly

"OverGridImageRemoved"

Triggered after floating image removal. Type of the event parameter is IOverGridImageRemovedParam

Example

univerAPI.addEvent(univerAPI.Event.OverGridImageRemoved, (param) => { const { workbook, removeImageParams } = param; // do something console.log(workbook, removeImageParams); })

OverGridImageSelected

readonly

"OverGridImageSelected"

Triggered after floating image selection. Type of the event parameter is IOverGridImageSelectedParam

Example

univerAPI.addEvent(univerAPI.Event.OverGridImageSelected, (param) => { const { workbook, selectedImages } = param; // do something console.log(workbook, selectedImages); })

PivotTableAdded

readonly

"PivotTableAdded"

The pivot table added event.The event parameter is IPivotTableAddedEventParams

Example

univerAPI.addEvent(univerAPI.Event.PivotTableAdded, (params) => { const { positionType, targetCellInfo } = params; if (positionType === univerAPI.Enum.PositionTypeEnum.Existing) { console.log('A pivot table created in an existing sheet'); console.log(` The target sheet name is ${targetCellInfo.sheetName}, the target row is ${targetCellInfo.row}, the target column is ${targetCellInfo.column} `); } else { console.log('A pivot table created in a new sheet'); } });

PivotTableFieldAdded

readonly

"PivotTableFieldAdded"

The pivot table field added event. The event parameter is IAddPivotFieldCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldAdded, (params) => { const { pivotTableId, fieldId, fieldArea, fieldIndex } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting('fieldId'); console.log(fieldSetting);

PivotTableFieldCollapseChanged

readonly

"PivotTableFieldCollapseChanged"

The pivot table field collapse changed event. The event parameter is ISetPivotCollapseCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldCollapseChanged, (params) => { const { pivotTableId, fieldId, isCollapsed } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(`The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`); });

PivotTableFieldFilterChanged

readonly

"PivotTableFieldFilterChanged"

The pivot table field filter changed event. The event parameter is ISetPivotFilterCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldFilterChanged, (params) => { const { pivotTableId, fieldId, filter } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(`The Checklist filter value is ${fieldSetting.filterInfo.checklist}`); });

PivotTableFieldMoved

readonly

"PivotTableFieldMoved"

The pivot table field moved event. The event parameter is IMovePivotFieldCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldMoved, (params) => { const { pivotTableId, fieldId, fieldArea, fieldIndex } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(`The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`); });

PivotTableFieldRemoved

readonly

"PivotTableFieldRemoved"

The pivot table field removed event. The event parameter is IRemovePivotFieldCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldRemoved, (params) => { const { pivotTableId, fieldId } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(fieldSetting); });

PivotTableFieldSettingChanged

readonly

"PivotTableFieldSettingChanged"

The pivot table field setting changed event. The event parameter is IUpdatePivotFieldSettingCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldSettingChanged, (params) => { const { pivotTableId, fieldId, setting } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(`The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`); });

PivotTableFieldSortChanged

readonly

"PivotTableFieldSortChanged"

The pivot table field sort changed event. The event parameter is ISetPivotSortCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableFieldSortChanged, (params) => { const { pivotTableId, fieldId, sort } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const fieldSetting = pivotTable.getFieldSetting(fieldId); console.log(`The sort info is ${fieldSetting.sortInfo}`); });

PivotTableMoved

readonly

"PivotTableMoved"

The pivot table moved event. The event parameter is IPivotTableMovedEventParams

Example

univerAPI.addEvent(univerAPI.Event.PivotTableMoved, (params) => { const { pivotTableId, targetCellInfo, originTargetInfo } = params; if (pivotTableId === 'pivotTable1') { console.log(` The pivot table moved from row: ${originTargetInfo.row} & column: ${originTargetInfo.column} to the sheet ${targetCellInfo.sheetName} row: ${targetCellInfo.row} & column: ${targetCellInfo.column} `); } });

PivotTableRemoved

readonly

"PivotTableRemoved"

The pivot table removed event. The event parameter is IPivotTableRemovedEventParams

Example

univerAPI.addEvent(univerAPI.Event.PivotTableRemoved, (params) => { const { pivotTableId } = params; console.log(`The pivot table ${pivotTableId} has been removed`); }); </td> </tr> <tr> <td> <a id="pivottablerendered"></a> `PivotTableRendered` </td> <td> `readonly` </td> <td> `"PivotTableRendered"` </td> <td> The pivot table calculated done and fill the value to worksheet, the event parameter is IPivotTableRenderedEventParams **Example** ```typescript // import { unionPivotViewRange } from '@univerjs-pro/sheets-pivot'; univerAPI.addEvent(univerAPI.Event.PivotTableRendered, (params) => { const { pivotTableId, rangeInfo } = params; console.log(`The pivot table ${pivotTableId} has been rendered`); if (rangeInfo) { console.log(unionPivotViewRange(rangeInfo)); } });

PivotTableValuePositionChanged

readonly

"PivotTableValuePositionChanged"

The pivot table value position changed event. The event parameter is IUpdatePivotValuePositionCommandParams

Example

const fWorkbook = univerAPI.getActiveWorkbook(); univerAPI.addEvent(univerAPI.Event.PivotTableValuePositionChanged, (params) => { const { pivotTableId, valueId, position } = params; const pivotTable = fWorkbook.getPivotTableById(pivotTableId); const valueSetting = pivotTable.getValueSetting(valueId); console.log(`The source name ${valueSetting.sourceName} the display name ${valueSetting.displayName}`); });

RowHeaderClick

readonly

"RowHeaderClick"

Triggered when a row header is clicked

Param

Event parameters containing unitId, subUnitId, and row index

Example

univerAPI.onSheetEvent(Event.RowHeaderClick, (params) => { console.log(`Row ${params.row} header clicked in sheet ${params.worksheet.getSheetId()}`); });

RowHeaderHover

readonly

"RowHeaderHover"

Triggered when pointer hovers over a row header

Param

Event parameters containing unitId, subUnitId, and row index

Example

univerAPI.onSheetEvent(Event.RowHeaderHover, (params) => { console.log(`Hovering over row ${params.row} header in sheet ${params.worksheet.getSheetId()}`); });

RowHeaderPointerDown

readonly

"RowHeaderPointerDown"

Triggered when pointer is pressed down on a row header

Param

Event parameters containing unitId, subUnitId, and row index

Example

univerAPI.onSheetEvent(Event.RowHeaderPointerDown, (params) => { console.log(`Pointer down on row ${params.row} header in sheet ${params.worksheet.getSheetId()}`); });

RowHeaderPointerUp

readonly

"RowHeaderPointerUp"

Triggered when pointer is released on a row header

Param

Event parameters containing unitId, subUnitId, and row index

Example

univerAPI.onSheetEvent(Event.RowHeaderPointerUp, (params) => { console.log(`Pointer up on row ${params.row} header in sheet ${params.worksheet.getSheetId()}`); });

Scroll

readonly

"Scroll"

Event fired when scroll spreadsheet.

See

IScrollEventParam

Example

univerAPI.addEvent(univerAPI.Event.Scroll, (params) => { const { worksheet, workbook, scrollX, scrollY } = params; });

SelectionChanged

readonly

"SelectionChanged"

Event fired when selection changed.

See

ISelectionEventParam

Example

univerAPI.addEvent(univerAPI.Event.SelectionChanged, (p)=> { const { worksheet, workbook, selections } = p; });

SelectionMoveEnd

readonly

"SelectionMoveEnd"

Event fired when selection move end

See

ISelectionEventParam

Example

univerAPI.addEvent(univerAPI.Event.SelectionMoveEnd, (p)=> { const { worksheet, workbook, selections } = p; });

SelectionMoveStart

readonly

"SelectionMoveStart"

Event fired when selection move start

See

ISelectionEventParam

Example

univerAPI.addEvent(univerAPI.Event.SelectionMoveStart, (p)=> { const { worksheet, workbook, selections } = p; });

SelectionMoving

readonly

"SelectionMoving"

Event fired when selection move end

See

ISelectionEventParam

Example

univerAPI.addEvent(univerAPI.Event.SelectionMoving, (p)=> { const { worksheet, workbook, selections } = p; });

SheetBeforeRangeFilter

readonly

"SheetBeforeRangeFilter"

This event will be emitted before the filter criteria on a column is changed. Type of the event is ISheetRangeFilteredParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeFilter, (params) => { const { workbook, worksheet, col, criteria } = params; // your custom logic });

SheetBeforeRangeFilterClear

readonly

"SheetBeforeRangeFilterClear"

This event will be emitted after the filter on a worksheet is cleared. Type of the event is ISheetRangeFilterClearedEventParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeFilterClear, (params) => { const { workbook, worksheet } = params; // your custom logic });

SheetBeforeRangeSort

public

"SheetBeforeRangeSort"

This event will be emitted before sorting a range on a worksheet. Type of the event is ISheetRangeSortParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeSort, (params) => { const { workbook, worksheet, sortColumn } = params; sortColumn.forEach((col) => { console.log(col.column, col.ascending); }); });

SheetDataValidationChanged

readonly

"SheetDataValidationChanged"

Event fired when a rule is added, deleted, or modified

See

ISheetDataValidationChangedEvent

Example

univerAPI.on(univerAPI.Event.SheetDataValidationChanged, (event) => { const { worksheet, workbook, changeType, oldRule, rule } = event; console.log(event); });

SheetDataValidatorStatusChanged

readonly

"SheetDataValidatorStatusChanged"

Event fired when a cell validator status is changed

See

ISheetDataValidatorStatusChangedEvent

Example

univerAPI.on(univerAPI.Event.SheetDataValidatorStatusChanged, (event) => { const { worksheet, workbook, row, column, status, rule } = event; console.log(event); });

SheetEditChanging

readonly

"SheetEditChanging"

Event fired when a cell is being edited

See

ISheetEditChangingEventParams

Example

univerAPI.addEvent(univerAPI.Event.SheetEditChanging, (params) => { const { worksheet, workbook, row, column, value, isZenEditor } = params; });

SheetEditEnded

readonly

"SheetEditEnded"

Event fired after a cell edit ends

See

ISheetEditEndedEventParams

Example

univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => { const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; });

SheetEditStarted

readonly

"SheetEditStarted"

Event fired after a cell is edited

See

ISheetEditEndedEventParams

Example

univerAPI.addEvent(univerAPI.Event.SheetEditStarted, (params) => { const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; });

SheetPrintCanceled

readonly

"SheetPrintCanceled"

Event triggered when print operation is canceled

Example

univerAPI.addEvent(univerAPI.event.SheetPrintCanceled, (params) => { const { renderConfig, layoutConfig } = params; console.log('params', params); });

SheetPrintConfirmed

readonly

"SheetPrintConfirmed"

Event triggered when print settings are confirmed

Example

univerAPI.addEvent(univerAPI.event.SheetPrintConfirmed, (params) => { const { renderConfig, layoutConfig } = params; console.log('params', params); });

SheetPrintOpen

readonly

"SheetPrintOpen"

Event triggered when print dialog opens

Example

univerAPI.addEvent(univerAPI.event.SheetPrintOpen, (params) => { const { workbook, worksheet } = params; console.log('params', params); });

SheetRangeFilterCleared

readonly

"SheetRangeFilterCleared"

This event will be emitted when the filter on a worksheet is cleared. Type of the event is ISheetRangeFilterClearedEventParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFilterCleared, (params) => { const { workbook, worksheet } = params; // your custom logic });

SheetRangeFiltered

readonly

"SheetRangeFiltered"

This event will be emitted when the filter criteria on a column is changed. Type of the event is ISheetRangeFilteredParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFiltered, (params) => { const { workbook, worksheet, col, criteria } = params; // your custom logic });

SheetRangeSorted

public

"SheetRangeSorted"

This event will be emitted when a range on a worksheet is sorted. Type of the event is ISheetRangeSortedParams.

Example

const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeSorted, (params) => { const { workbook, worksheet, sortColumn } = params; sortColumn.forEach((col) => { console.log(col.column, col.ascending); }); });

SheetSkeletonChanged

readonly

"SheetSkeletonChanged"

Event fired when sheet skeleton changed

See

ISheetSkeletonChangedEvent

Example

univerAPI.addEvent(univerAPI.Event.SheetSkeletonChanged, (p)=> { const { worksheet, workbook } = p; });

SheetSparklineChanged

readonly

"SheetSparklineChanged"

Trigger this event after the sparkline changes. Type of the event parameter is IFSheetSparklineChangedEventParams

Example

univerAPI.addEvent(univerAPI.Event.SheetSparklineChanged, (params) => { console.log('SheetSparklineChanged', params); })

SheetValueChanged

readonly

"SheetValueChanged"

Event fired when sheet value changed

Example

univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (p)=> { const { workbook, effectedRanges, payload } = p; });

SheetZoomChanged

readonly

"SheetZoomChanged"

Event fired when zoom changed

See

ISheetZoomEvent

Example

univerAPI.addEvent(univerAPI.Event.SheetZoomChanged, (p)=> { const { worksheet, workbook, zoom } = p; });

Accessors

ActiveSheetChanged

Get Signature

get ActiveSheetChanged(): "ActiveSheetChanged"

Event fired after the active sheet changes

See

IActiveSheetChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.ActiveSheetChanged, (params) => { const { workbook, activeSheet } = params; console.log('after active sheet changed', params); });
Returns

"ActiveSheetChanged"


BeforeActiveSheetChange

Get Signature

get BeforeActiveSheetChange(): "BeforeActiveSheetChange"

Event fired before the active sheet changes

See

IActiveSheetChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.ActiveSheetChanged, (params) => { const { workbook, activeSheet, oldActiveSheet } = params; console.log('before active sheet changed', params); });
Returns

"BeforeActiveSheetChange"


BeforeCommandExecute

Get Signature

get BeforeCommandExecute(): "BeforeCommandExecute"

Event fired before a command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"BeforeCommandExecute"


BeforeGridlineColorChange

Get Signature

get BeforeGridlineColorChange(): "BeforeGridlineColorChange"

Event fired before gridline color changed

See

IBeforeGridlineColorChanged

Example
univerAPI.addEvent(univerAPI.Event.BeforeGridlineColorChange, (params) => { const { workbook, worksheet, color } = params; console.log('gridline changed', params); });
Returns

"BeforeGridlineColorChange"


BeforeGridlineEnableChange

Get Signature

get BeforeGridlineEnableChange(): "BeforeGridlineEnableChange"

Event fired before gridline enable changed

See

IBeforeGridlineEnableChange

Example
univerAPI.addEvent(univerAPI.Event.BeforeGridlineEnableChange, (params) => { const { workbook, worksheet, enabled } = params; console.log('gridline changed', params); });
Returns

"BeforeGridlineEnableChange"


BeforeRedo

Get Signature

get BeforeRedo(): "BeforeRedo"

Event fired before a redo command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"BeforeRedo"


BeforeSheetCreate

Get Signature

get BeforeSheetCreate(): "BeforeSheetCreate"

Event fired before a sheet is created

See

IBeforeSheetCreateEventParams

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetCreate, (params) => { const { workbook, index, sheet } = params; console.log('before sheet create', params); });
Returns

"BeforeSheetCreate"


BeforeSheetDelete

Get Signature

get BeforeSheetDelete(): "BeforeSheetDelete"

Event fired before a sheet is deleted

See

IBeforeSheetDeleteEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetDelete, (params) => { const { workbook, worksheet } = params; console.log('before sheet delete', params); });
Returns

"BeforeSheetDelete"


BeforeSheetHideChange

Get Signature

get BeforeSheetHideChange(): "BeforeSheetHideChange"

Event fired before a sheet is hidden

See

IBeforeSheetHideChangeEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetHideChange, (params) => { const { workbook, worksheet, hide } = params; console.log('before sheet hide changed', params); });
Returns

"BeforeSheetHideChange"


BeforeSheetMove

Get Signature

get BeforeSheetMove(): "BeforeSheetMove"

Event fired before a sheet is moved

See

IBeforeSheetMoveEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetMove, (params) => { const { workbook, worksheet, newIndex, oldIndex } = params; console.log('before sheet move', params); });
Returns

"BeforeSheetMove"


BeforeSheetNameChange

Get Signature

get BeforeSheetNameChange(): "BeforeSheetNameChange"

Event fired before a sheet name is changed

See

IBeforeSheetNameChangeEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetNameChange, (params) => { const { workbook, worksheet, newName, oldName } = params; console.log('before sheet name changed', params); });
Returns

"BeforeSheetNameChange"


BeforeSheetTabColorChange

Get Signature

get BeforeSheetTabColorChange(): "BeforeSheetTabColorChange"

Event fired before a sheet tab color is changed

See

IBeforeSheetTabColorChangeEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetTabColorChange, (params) => { const { workbook, worksheet, color, oldColor } = params; console.log('before sheet tab color changed', params); });
Returns

"BeforeSheetTabColorChange"


BeforeUndo

Get Signature

get BeforeUndo(): "BeforeUndo"

Event fired before an undo command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"BeforeUndo"


CommandExecuted

Get Signature

get CommandExecuted(): "CommandExecuted"

Event fired when a command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"CommandExecuted"


DocCreated

Get Signature

get DocCreated(): "DocCreated"

Event fired when a document is created

See

IDocCreatedParam

Example
univerAPI.addEvent(univerAPI.event.DocCreated, (params) => { const { unitId, type, doc, unit } = params; console.log('doc created', params); });
Returns

"DocCreated"


DocDisposed

Get Signature

get DocDisposed(): "DocDisposed"

Event fired when a document is disposed

See

IDocDisposedEvent

Example
univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => { const { unitId, unitType, snapshot } = params; console.log('doc disposed', params); });
Returns

"DocDisposed"


GridlineChanged

Get Signature

get GridlineChanged(): "GridlineChanged"

Event fired when gridline changed

See

IGridlineChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.GridlineChanged, (params) => { const { workbook, worksheet, enabled, color } = params; console.log('gridline changed', params); });
Returns

"GridlineChanged"


LifeCycleChanged

Get Signature

get LifeCycleChanged(): "LifeCycleChanged"

Event fired when life cycle is changed

See

ILifeCycleChangedEvent

Example
univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => { const { stage } = params; console.log('life cycle changed', params); });
Returns

"LifeCycleChanged"


Redo

Get Signature

get Redo(): "Redo"

Event fired when a redo command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.Redo, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"Redo"


SheetCreated

Get Signature

get SheetCreated(): "SheetCreated"

Event fired after a sheet is created

See

ISheetCreatedEventParams

Example
univerAPI.addEvent(univerAPI.Event.SheetCreated, (params) => { const { workbook, worksheet } = params; console.log('sheet created', params); });
Returns

"SheetCreated"


SheetDeleted

Get Signature

get SheetDeleted(): "SheetDeleted"

Event fired before a sheet is deleted

See

IBeforeSheetDeleteEvent

Example
univerAPI.addEvent(univerAPI.Event.BeforeSheetDelete, (params) => { const { workbook, worksheetId } = params; console.log('before sheet delete', params); });
Returns

"SheetDeleted"


SheetHideChanged

Get Signature

get SheetHideChanged(): "SheetHideChanged"

Event fired after a sheet is hidden

See

ISheetHideChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.SheetHideChanged, (params) => { const { workbook, worksheet } = params; console.log('sheet hide changed', params); });
Returns

"SheetHideChanged"


SheetMoved

Get Signature

get SheetMoved(): "SheetMoved"

Event fired after a sheet is moved

See

ISheetMovedEvent

Example
univerAPI.addEvent(univerAPI.Event.SheetMoved, (params) => { const { workbook, worksheet, newIndex } = params; console.log('sheet moved', params); });
Returns

"SheetMoved"


SheetNameChanged

Get Signature

get SheetNameChanged(): "SheetNameChanged"

Event fired after a sheet name is changed

See

ISheetNameChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.SheetNameChanged, (params) => { const { workbook, worksheet, newName } = params; console.log('sheet name changed', params); });
Returns

"SheetNameChanged"


SheetTabColorChanged

Get Signature

get SheetTabColorChanged(): "SheetTabColorChanged"

Event fired after a sheet tab color is changed

See

ISheetTabColorChangedEvent

Example
univerAPI.addEvent(univerAPI.Event.SheetTabColorChanged, (params) => { const { workbook, worksheet, color } = params; console.log('sheet tab color changed', params); });
Returns

"SheetTabColorChanged"


Undo

Get Signature

get Undo(): "Undo"

Event fired when an undo command is executed

See

ICommandEvent

Example
univerAPI.addEvent(univerAPI.event.Undo, (event) => { const { params, id, type } = event; console.log('command executed', event); });
Returns

"Undo"


WorkbookCreated

Get Signature

get WorkbookCreated(): "WorkbookCreated"

Event fired after a workbook is created

See

IWorkbookCreateParam

Example
univerAPI.addEvent(univerAPI.Event.WorkbookCreated, (params) => { const { unitId, type, workbook, unit } = params; console.log('workbook created', params); });
Returns

"WorkbookCreated"


WorkbookDisposed

Get Signature

get WorkbookDisposed(): "WorkbookDisposed"

Event fired after a workbook is disposed

See

IWorkbookDisposedEvent

Example
univerAPI.addEvent(univerAPI.Event.WorkbookDisposed, (params) => { const { unitId, unitType, snapshot } = params; console.log('unit disposed', params); });
Returns

"WorkbookDisposed"

Methods

get()

static get(): FEventName

Returns

FEventName