API
CyExcelCore
The spreadsheet core provides rendering, interaction, and data APIs, with changes managed through Command, Mutation, and History.
Data
| Name | Type | Description |
|---|---|---|
| getCell(row, column) | unknown | Read the underlying value of a cell. |
| getUsedRowCount() | number | The occupied row extent, excluding trailing blank rows. |
| getRowCount() | number | The coordinate-space row count, including trailing blank rows. |
| getColumnCount() | number | The coordinate-space column count, including trailing blank columns. |
| setCell(row, column, value) | void | Write an undoable cell value. null / undefined clears the value. |
| undo() | void | Undo the most recent undoable change. |
| redo() | void | Redo the most recently undone change. |
Structure and geometry
| Name | Type | Description |
|---|---|---|
| insertRows(start, count) | void | Insert blank rows. |
| deleteRows(start, count) | void | Delete consecutive rows. |
| moveRows(start, count, target) | void | Move a block of rows to an insertion position. |
| insertColumns(start, columns) | void | Insert column definitions. |
| deleteColumns(start, count) | void | Delete consecutive columns. |
| moveColumns(start, count, target) | void | Move columns. |
| setRowHeight(row, height) | void | Set an explicit row height. |
| setColumnWidth(column, width) | void | Set an explicit column width. |
Styles
| Name | Type | Description |
|---|---|---|
| setCellStyle(row, column, patch) | void | Apply a style patch to one cell. |
| setRangeStyle(range, patch) | void | Apply a style patch to a range, replacing only the specified keys. |
| getCellStyle(row, column) | CellStyle | undefined | Read the merged column defaults and cell styles. |
| clearRangeStyle(range) | void | Clear explicit style keys within a range. |
Search, sorting, and clipboard
| Name | Type | Description |
|---|---|---|
| find(query, options) | Promise<SearchMatch[] | null> | Search displayed text and return matching cells. |
| findNext() / findPrevious() | SearchMatch | null | Navigate through matches and select the corresponding cell. |
| replace(match, value, query?, options?) | void | Replace matched text. Without query, the method retains the legacy whole-cell write behavior. |
| replaceAll(query, value, options?) | Promise<number | null> | Replace all matches and return the number of replacements. |
| sortByColumn(column, direction) | boolean | Sort rows by a column, committing the order and row geometry in one transaction. |
| filterByColumn(column, predicate) | void | Filter rows using a predicate. Filtered-out rows have zero height. |
| copy(options?) / paste(options?) | Promise | Copy and paste programmatically. |
Data validation
Validation rules are stored by range in snapshots. Changes are undoable, and ranges update with row and column insertion, deletion, and movement. See Examples > Data validation.
| Name | Type | Description |
|---|---|---|
| setDataValidation(range | ranges, rule) | string | Set a rule on one or more ranges and return its ID. Each cell belongs to at most one rule; new coverage is removed from older rules. Existing values are not checked. |
| clearDataValidation(range | ranges) | void | Clear rule coverage in these ranges and remove rules with no remaining coverage. Undoable. |
| getDataValidations() | readonly DataValidationRule[] | All current rules. |
| getDataValidationAt(row, column) | DataValidationRule | undefined | Return the rule covering the specified cell. |
| validateCell(row, column) | DataValidationResult | Check the specified cell against its rule. Cells without a rule are valid. |
| findInvalidCells(range?) | { row, column }[] | Return coordinates of invalid cells. Without a range, check the entire coordinate space. |
| registerDataValidator(name, fn) | Disposer | Register a synchronous pure validator returning true, false, or an error message. Validators are instance-specific and are not serialized. |