FSlideTableCell
Facade object for a single slide table cell.
Access
Access through:
Example
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setText('Ready')cell?.setBackgroundColor('#E8F1FF')Setup
Register @univerjs-pro/slides-table or a preset that includes it. In plugin mode, import @univerjs-pro/slides-table/facade. Additional methods below require their listed plugin packages. See Facade setup.
@univerjs-pro/slides-table
FSlideTableCell.clearBackground
Clear this cell's fill.
clearBackground(): booleanReturns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.clearBackground()Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getColumnIndex
Return the zero-based column index.
getColumnIndex(): numberReturns
The column index.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 1)console.log(cell?.getColumnIndex())Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getData
Return the raw cell snapshot.
getData(): ISlideTableCell | nullReturns
The cell snapshot, or null when the cell does not exist.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)console.log(cell?.getData())Types: ISlideTableCell
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getRichText
Returns this cell as a detached rich-text value.
getRichText(): RichTextValue | nullReturns
A detached value suitable for .copy() and setRichText(), or null for an empty cell.
Types: RichTextValue
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getRowIndex
Return the zero-based row index.
getRowIndex(): numberReturns
The row index.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(1, 0)console.log(cell?.getRowIndex())Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getStyle
Return the cell style.
getStyle(): ISlideTableCellStyle | undefinedReturns
The cell style.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)console.log(cell?.getStyle())Types: ISlideTableCellStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getTable
Return the parent table facade.
getTable(): FSlideTableReturns
The parent table.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)console.log(cell?.getTable())Types: FSlideTable
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getText
Return the plain text in this cell.
getText(): stringReturns
The plain cell text.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)console.log(cell?.getText())Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.getTextData
Return the raw Univer document data in this cell.
This is an advanced integration escape hatch. Application and agent code should prefer getRichText().
getTextData(): IDocumentData | undefinedReturns
The cell rich text data.
Examples
// Advanced: export the exact document model for lossless storage or migration.const presentation = univerAPI.getActivePresentation()if (!presentation) throw new Error('No active presentation')const slide = presentation.getSlideByIndex(0)const table = slide.getTableById('status-table')const cell = table?.getCell(0, 0)const textData = cell?.getTextData()if (textData) console.log(JSON.stringify(textData))Types: IDocumentData
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.mergeTo
Merge this cell with a rectangular span starting at this cell.
mergeTo(rowSpan: number, columnSpan: number): booleanParameters
rowSpan— Required. The number of rows to include.columnSpan— Required. The number of columns to include.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.mergeTo(2, 2)Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setBackgroundColor
Set a solid background color for this cell.
setBackgroundColor(color: string): booleanParameters
color— Required. The background color.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setBackgroundColor('#E8F1FF')Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setBorder
Apply borders to this cell.
setBorder(border: ISlideTableBorder): booleanParameters
border— Required. The border style.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setBorder({ color: '#111827', width: 1, dash: univerAPI.Enum.SlideTableBorderDashEnum.Solid,})Types: ISlideTableBorder
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setFill
Set the cell fill.
setFill(fill?: ISlideTableFill): booleanParameters
fill— Optional. The fill, orundefinedto clear it.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setFill({ type: univerAPI.Enum.SlideTableFillTypeEnum.Solid, color: '#E8F1FF', alpha: 1,})Types: ISlideTableFill
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setRichText
Replaces this cell with a detached value returned by univerAPI.newRichText().
setRichText(richText: RichTextValue): booleanParameters
richText— Required. Rich-text value to store in the cell.
Returns
Whether the command succeeded.
Examples
const text = univerAPI .newRichText() .align({ horizontal: univerAPI.Enum.HorizontalAlign.CENTER }) .text('Ready')cell.setRichText(text)Types: RichTextValue
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setStyle
Merge supported style fields into this cell.
setStyle(style: ISlideTableCellStyle): booleanParameters
style— Required. The style patch.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setStyle({ fill: { type: univerAPI.Enum.SlideTableFillTypeEnum.Solid, color: '#E8F1FF', alpha: 1, }, borders: { left: { color: '#111827', width: 1, dash: univerAPI.Enum.SlideTableBorderDashEnum.Dash, }, }, margins: { left: 8, right: 8, }, verticalAlign: univerAPI.Enum.SlideTableVerticalAlignEnum.Middle, textDirection: univerAPI.Enum.SlideTableTextDirectionEnum.Horizontal,})Types: ISlideTableCellStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setText
Replace this cell with plain text.
setText(text: string): booleanParameters
text— Required. The new plain text.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.setText('Ready')Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.setTextData
Replace this cell with raw Univer document data.
This is an advanced integration escape hatch. Application and agent code should prefer setRichText().
setTextData(textData: IDocumentData): booleanParameters
textData— Required. The rich text document data.
Returns
Whether the command succeeded.
Examples
// Advanced: copy exact imported document data without rebuilding its runs and ranges.const presentation = univerAPI.getActivePresentation()if (!presentation) throw new Error('No active presentation')const slide = presentation.getSlideByIndex(0)const table = slide.getTableById('status-table')const importedTextData = table?.getCell(0, 0)?.getTextData()if (!importedTextData) throw new Error('Imported cell data is unavailable')const targetCell = table?.getCell(0, 1)if (!targetCell?.setTextData(importedTextData)) throw new Error('Cannot restore raw cell data')Types: IDocumentData
Package: @univerjs-pro/slides-table · Type definitions
FSlideTableCell.unmerge
Unmerge the merged range containing this cell.
unmerge(): booleanReturns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const cell = table.getCell(0, 0)cell?.unmerge()Package: @univerjs-pro/slides-table · Type definitions
How is this guide?