FBoardTable
Facade for one Board table element and its table resource.
Instances are returned by FBoard table mixin methods. Do not construct this class directly because it needs the
active Board model, table resource service, and command service.
Access
Access through:
Setup
Register @univerjs-pro/boards-table or a preset that includes it. In plugin mode, import @univerjs-pro/boards-table/facade. Additional methods below require their listed plugin packages. See Facade setup.
@univerjs-pro/boards-table
FBoardTable.deleteColumns
Deletes an inclusive column range.
deleteColumns(startColumn: number, endColumn: number): booleanParameters
startColumn— Required. First zero-based column to delete.endColumn— Required. Last zero-based column to delete.
Returns
true when the command succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 4 })if (!table || !table.deleteColumns(1, 2)) throw new Error('Cannot delete columns')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.deleteRows
Deletes an inclusive row range.
deleteRows(startRow: number, endRow: number): booleanParameters
startRow— Required. First zero-based row to delete.endRow— Required. Last zero-based row to delete.
Returns
true when the command succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 4, columns: 3 })if (!table || !table.deleteRows(1, 2)) throw new Error('Cannot delete rows')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getCellInfo
Gets plain text, rich text, style, and merge information for one cell.
getCellInfo(row: number, column: number): IBoardTableFacadeCellInfo | nullParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.
Returns
Detached cell information, or null when the coordinates or table resource are invalid.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getCellInfo(0, 0))Types: IBoardTableFacadeCellInfo
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getCellRichText
Gets one cell as a detached rich-text value.
The returned value can be copied or transformed safely before calling setCellRichText(). It never exposes the
mutable table resource snapshot.
getCellRichText(row: number, column: number): RichTextValue | nullParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.
Returns
Detached rich-text value, or null when the table or cell does not exist.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getCellRichText(0, 0)?.getData())Types: RichTextValue
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getCellStyle
Gets a detached style snapshot for one cell.
getCellStyle(row: number, column: number): ISlideTableCellStyle | nullParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.
Returns
A cloned style object, or null when the cell has no explicit style or does not exist.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getCellStyle(0, 0))Types: ISlideTableCellStyle
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getData
Gets a clone of the raw table resource snapshot.
Agent scripts normally prefer getValues() and explicit mutation methods rather than depending on table internals.
getData(): ISlideTableSnapshot | nullReturns
Table resource data, or null when it is unavailable.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getData())Types: ISlideTableSnapshot
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getId
Gets the generated Board element id.
Prefer getId() for agent references; this id is only useful for integration event payloads.
getId(): stringReturns
Generated table host element id.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getId())Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getRichTextValues
Gets a rectangular matrix of detached rich-text cell values.
Omit range to read the complete table. The returned values are independent of the resource snapshot and can be
transformed before being written with setRichTextValues().
getRichTextValues(range?: ISlideTableCellRange): RichTextValue[][]Parameters
range— Optional. Optional inclusive zero-based range.
Returns
A rectangular rich-text matrix, or an empty array when the table or range is invalid.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getRichTextValues({ startRow: 0, endRow: 1, startColumn: 0, endColumn: 1 }))Types: RichTextValue · ISlideTableCellRange
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getStructure
Gets a detached structural summary of this table.
getStructure(): IBoardTableFacadeStructure | nullReturns
Row/column counts, sizes, and merged ranges, or null when the table resource is unavailable.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getStructure())Types: IBoardTableFacadeStructure
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getTableId
Gets the table resource id.
getTableId(): string | nullReturns
Generated table resource id, or null when the host table no longer exists.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getTableId())Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.getValues
Gets the current plain-text values in row and column order.
getValues(): string[][]Returns
A rectangular matrix. Empty cells are returned as empty strings.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table) throw new Error('Cannot insert table')console.log(table.getValues())Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.insertColumns
Inserts columns and grows the Board host element in the same undoable command.
insertColumns(columnIndex: number, count?: number, width?: number): booleanParameters
columnIndex— Required. Zero-based insertion index.count— Optional. Default:1. Number of columns to insert. Defaults to1.width— Optional. Optional width in board units for each new column.
Returns
true when the command succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.insertColumns(1, 2)) throw new Error('Cannot insert columns')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.insertRows
Inserts rows and grows the Board host element in the same undoable command.
insertRows(rowIndex: number, count?: number, height?: number): booleanParameters
rowIndex— Required. Zero-based insertion index.count— Optional. Default:1. Number of rows to insert. Defaults to1.height— Optional. Optional height in board units for each new row.
Returns
true when the command succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.insertRows(1, 2)) throw new Error('Cannot insert rows')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.mergeCells
Merges a supplied inclusive cell range.
mergeCells(range: ISlideTableCellRange): booleanParameters
range— Required. Inclusive zero-based range to merge.
Returns
true when the command succeeds or the range is already merged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.mergeCells({ startRow: 0, endRow: 0, startColumn: 0, endColumn: 1 })) { throw new Error('Cannot merge cells')}Types: ISlideTableCellRange
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.moveColumns
Moves an inclusive column range before or after a target column.
Cell content, rich text, style, merges, and column width move together through the shared table command.
moveColumns(startColumn: number, endColumn: number, targetColumn: number, position: SlideTableMovePosition): booleanParameters
startColumn— Required. First zero-based column to move.endColumn— Required. Last zero-based column to move.targetColumn— Required. Zero-based reference column.position— Required. Insert the moved columnsbeforeorafterthe reference column.
Returns
true when the move succeeds or is already in the requested position.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 4 })if (!table || !table.moveColumns(0, 0, 2, 'after')) throw new Error('Cannot move column')Types: SlideTableMovePosition
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.moveRows
Moves an inclusive row range before or after a target row.
Cell content, rich text, style, merges, and row height move together. Invalid overlaps are rejected by the shared
table layout command, while an equivalent update returns true without creating history.
moveRows(startRow: number, endRow: number, targetRow: number, position: SlideTableMovePosition): booleanParameters
startRow— Required. First zero-based row to move.endRow— Required. Last zero-based row to move.targetRow— Required. Zero-based reference row.position— Required. Insert the moved rowsbeforeorafterthe reference row.
Returns
true when the move succeeds or is already in the requested position.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 4, columns: 3 })if (!table || !table.moveRows(0, 0, 2, 'after')) throw new Error('Cannot move row')Types: SlideTableMovePosition
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.remove
Removes the Board table host element and its table resource.
remove(): booleanReturns
true when the removal command succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.remove()) throw new Error('Cannot remove table')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.resizeColumns
Resizes an inclusive column range.
resizeColumns(startColumn: number, endColumn: number, width: number): booleanParameters
startColumn— Required. First zero-based column to resize.endColumn— Required. Last zero-based column to resize.width— Required. New column width in board units.
Returns
true when the command succeeds or the columns already have this width.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.resizeColumns(0, 1, 160)) throw new Error('Cannot resize columns')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.resizeRows
Resizes an inclusive row range.
resizeRows(startRow: number, endRow: number, height: number): booleanParameters
startRow— Required. First zero-based row to resize.endRow— Required. Last zero-based row to resize.height— Required. New row height in board units.
Returns
true when the command succeeds or the rows already have this height.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.resizeRows(0, 1, 48)) throw new Error('Cannot resize rows')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setBorderPreset
Applies a border preset to a cell range.
setBorderPreset(range: ISlideTableCellRange, preset: SlideTableBorderPresetEnum, border?: ISlideTableBorder): booleanParameters
range— Required. Inclusive zero-based target range.preset— Required. Border preset enum value.border— Optional. Optional border appearance.
Returns
true when the command succeeds or the border is unchanged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if ( !table || !table.setBorderPreset( { startRow: 0, endRow: 2, startColumn: 0, endColumn: 2 }, univerAPI.Enum.BoardTableBorderPresetEnum.All, { color: '#64748b', width: 1 }, )) throw new Error('Cannot set borders')Types: ISlideTableCellRange · SlideTableBorderPresetEnum · ISlideTableBorder
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setCellRichText
Replaces one cell with rich text built by univerAPI.newRichText().
The builder data is cloned before dispatch, so later changes to the builder do not mutate the table snapshot.
Use setCellText() for plain strings. Raw document data is reserved for advanced integrations.
setCellRichText(row: number, column: number, richText: RichTextValue): booleanParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.richText— Required. Rich text value returned byuniverAPI.newRichText().
Returns
true when the command succeeds or the requested rich text is unchanged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })const value = univerAPI.newRichText().bold('Approved')if (!table || !table.setCellRichText(0, 0, value)) throw new Error('Cannot set rich text')Types: RichTextValue
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setCellStyle
Merges a style patch into a cell range.
setCellStyle(range: ISlideTableCellRange, style: ISlideTableCellStyle): booleanParameters
range— Required. Inclusive zero-based target range.style— Required. Cell style patch.
Returns
true when the command succeeds or the style is unchanged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if ( !table || !table.setCellStyle( { startRow: 0, endRow: 0, startColumn: 0, endColumn: 2 }, { fill: { type: univerAPI.Enum.BoardTableFillTypeEnum.Solid, color: '#e0e7ff', alpha: 1 } }, )) throw new Error('Cannot style cells')Types: ISlideTableCellRange · ISlideTableCellStyle
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setCellText
Replaces one cell with plain text.
setCellText(row: number, column: number, text: string): booleanParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.text— Required. New plain text.
Returns
true when the command succeeds or the text is unchanged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if (!table || !table.setCellText(0, 0, 'Approved')) throw new Error('Cannot set cell text')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setCellTextData
Replaces one cell with raw Univer document data.
This is an advanced integration escape hatch. Application and agent code should prefer setCellRichText().
setCellTextData(row: number, column: number, textData: IDocumentData | null): booleanParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.textData— Required. Document data, ornullto clear the cell.
Returns
true when the command succeeds or the requested data is unchanged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 2, columns: 2 })if (!table || !table.setCellRichText(0, 0, univerAPI.newRichText().bold('Risk'))) { throw new Error('Cannot prepare source cell')}const importedTextData = table.getCellRichText(0, 0)?.getData()if (!importedTextData) throw new Error('Source cell is empty')if (!table.setCellTextData(1, 0, importedTextData)) throw new Error('Cannot restore raw cell data')Types: IDocumentData
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setRichTextValues
Replaces a rectangular range with rich text in one table update command.
The matrix must be rectangular and fit inside the current table. Every builder is cloned before dispatch, and an unchanged matrix succeeds without creating undo or collaboration traffic.
setRichTextValues(values: RichTextValue[][], startRow?: number, startColumn?: number): booleanParameters
values— Required. Rich-text matrix built withuniverAPI.newRichText().startRow— Optional. Default:0. Zero-based start row. Defaults to0.startColumn— Optional. Default:0. Zero-based start column. Defaults to0.
Returns
true when the batch succeeds or all requested cells are already current.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 2, columns: 2 })const title = univerAPI.newRichText().bold('Status')const value = univerAPI.newRichText().text('Approved')if (!table || !table.setRichTextValues([[title, value]])) throw new Error('Cannot set rich text')Types: RichTextValue
Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.setValues
Replaces a rectangular range of cells with plain text in one table update command.
Unchanged cells do not generate a mutation. The values matrix must fit inside the current table bounds; use row or column insertion methods first when an agent needs to grow the table.
setValues(values: string[][], startRow?: number, startColumn?: number): booleanParameters
values— Required. Plain-text matrix to write.startRow— Optional. Default:0. Zero-based start row. Defaults to0.startColumn— Optional. Default:0. Zero-based start column. Defaults to0.
Returns
true when the update succeeds or the requested values are already present.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if ( !table || !table.setValues([ ['Task', 'Owner'], ['Review', 'Alex'], ])) throw new Error('Cannot set values')Package: @univerjs-pro/boards-table · Type definitions
FBoardTable.unmergeCell
Unmerges the merged range containing one cell.
unmergeCell(row: number, column: number): booleanParameters
row— Required. Zero-based row inside the merged range.column— Required. Zero-based column inside the merged range.
Returns
true when the command succeeds or the cell is already unmerged.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const table = board.insertTable({ left: 80, top: 80, rows: 3, columns: 3 })if ( !table || !table.mergeCells({ startRow: 0, endRow: 0, startColumn: 0, endColumn: 1 }) || !table.unmergeCell(0, 0)) throw new Error('Cannot unmerge cells')Package: @univerjs-pro/boards-table · Type definitions
How is this guide?