FSlideTable
Facade object for a slide table element and its table resource.
Access
Access through:
FSlideTableCell.getTable()FSlide.insertTable()FSlide.insertTableFromData()FSlide.getTables()FSlide.getTableById()FSlide.getTableAt()FSlide.updateTable()
Inheritance
Extends FPageElement. Its inherited members are available on this object.
Example
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tableInfo = fSlide .newTable() .setValues([ ['Quarter', 'Owner', 'Status'], ['Q1', 'Sales', 'Done'], ]) .setRows(3) .setColumns(4) .setColumnWidth(105) .setRowHeight(60) .setAbsolutePosition(80, 100) .setSize(420, 180) .build()const table = fSlide.insertTable(tableInfo)table?.setCellText(0, 0, 'Name')table?.setCellText(0, 1, 'Status')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
FSlideTable.appendColumns
Append columns to the table.
appendColumns(count?: number, width?: number): booleanParameters
count— Optional. Default:1. The number of columns to append.width— Optional. Optional width for new columns.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.appendColumns(2)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.appendRows
Append rows to the table.
appendRows(count?: number, height?: number): booleanParameters
count— Optional. Default:1. The number of rows to append.height— Optional. Optional height for new rows.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.appendRows(2)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.clearCellBackground
Clear cell background for a range.
clearCellBackground(range: ISlideTableCellRange): booleanParameters
range— Required. The target range.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.clearCellBackground(table.getTableRange())Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.deleteColumns
Delete columns from the table.
deleteColumns(startColumn: number, count?: number): booleanParameters
startColumn— Required. The first column to delete.count— Optional. Default:1. The number of columns to delete.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.deleteColumns(1, 2)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.deleteRows
Delete rows from the table.
deleteRows(startRow: number, count?: number): booleanParameters
startRow— Required. The first row to delete.count— Optional. Default:1. The number of rows to delete.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.deleteRows(1, 2)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.describe
Return a human-readable table description with sample rows.
describe(): ISlideTableDescriptionReturns
The table description.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.describe())Types: ISlideTableDescription
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.distributeColumns
Distribute column widths evenly.
distributeColumns(startColumn?: number, count?: number): booleanParameters
startColumn— Optional. Default:0. The first column.count— Optional. Default:this.getColumnCount(). The number of columns.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.distributeColumns()Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.distributeRows
Distribute row heights evenly.
distributeRows(startRow?: number, count?: number): booleanParameters
startRow— Optional. Default:0. The first row.count— Optional. Default:this.getRowCount(). The number of rows.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.distributeRows()Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCell
Return a cell facade by row and column.
getCell(row: number, column: number): FSlideTableCell | nullParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The cell facade, or null when it does not exist.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTables()[0]if (table) { const cell = table.getCell(0, 0) console.log(cell)}Types: FSlideTableCell
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellData
Return raw cell data by row and column.
getCellData(row: number, column: number): ISlideTableCell | nullParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The cell data, or null when it does not exist.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTables()[0]if (table) { const cellData = table.getCellData(0, 0) console.log(cellData)}Types: ISlideTableCell
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellRange
Return a one-cell range.
getCellRange(row: number, column: number): ISlideTableCellRangeParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The cell range.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTables()[0]if (table) { const cellRange = table.getCellRange(0, 0) console.log(cellRange)}Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellRichText
Returns one cell as a detached rich-text value.
getCellRichText(row: number, column: number): RichTextValue | nullParameters
row— Required. Zero-based row index.column— Required. Zero-based column index.
Returns
A detached rich-text value, or null when the cell is empty.
Types: RichTextValue
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellStyle
Return cell style by row and column.
getCellStyle(row: number, column: number): ISlideTableCellStyle | undefinedParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The cell style.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTables()[0]if (table) { const cellStyle = table.getCellStyle(0, 0) console.log(cellStyle)}Types: ISlideTableCellStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellText
Return plain text in a cell.
getCellText(row: number, column: number): stringParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The cell plain text.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTables()[0]if (table) { const cellText = table.getCellText(0, 0) console.log(cellText)}Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getCellTextData
Return the raw Univer document data in a cell.
This is an advanced integration escape hatch. Application and agent code should prefer getCellRichText().
getCellTextData(row: number, column: number): IDocumentData | undefinedParameters
row— Required. The zero-based row index.column— Required. The zero-based column index.
Returns
The rich text document 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 textData = table?.getCellTextData(0, 0)if (textData) console.log(JSON.stringify(textData))Types: IDocumentData
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getColumnCount
Return the number of columns.
getColumnCount(): numberReturns
The column count.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getColumnCount())Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getColumnsRange
Return a column range.
getColumnsRange(startColumn: number, count?: number): ISlideTableCellRangeParameters
startColumn— Required. The first column.count— Optional. Default:1. The number of columns.
Returns
The column range.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getColumnsRange())Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getRowCount
Return the number of rows.
getRowCount(): numberReturns
The row count.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getRowCount())Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getRowsRange
Return a row range.
getRowsRange(startRow: number, count?: number): ISlideTableCellRangeParameters
startRow— Required. The first row.count— Optional. Default:1. The number of rows.
Returns
The row range.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getRowsRange())Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getTableData
Return the raw table resource snapshot.
getTableData(): ISlideTableSnapshotReturns
The table resource snapshot.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getTableData())Types: ISlideTableSnapshot
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getTableId
Return the table resource id.
getTableId(): stringReturns
The table resource id.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getTableId())Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.getTableRange
Return a range covering the whole table.
getTableRange(): ISlideTableCellRangeReturns
The table range.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const tables = fSlide.getTables()console.log(tables[0]?.getTableRange())Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.insertColumnsAfter
Insert columns after a column.
insertColumnsAfter(column: number, count?: number, width?: number): booleanParameters
column— Required. The column index to insert after.count— Optional. Default:1. The number of columns to insert.width— Optional. Optional width for new columns.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.insertColumnsAfter(0, 1)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.insertColumnsBefore
Insert columns before a column.
insertColumnsBefore(column: number, count?: number, width?: number): booleanParameters
column— Required. The column index to insert before.count— Optional. Default:1. The number of columns to insert.width— Optional. Optional width for new columns.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.insertColumnsBefore(1, 2, 96)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.insertRowsAfter
Insert rows after a row.
insertRowsAfter(row: number, count?: number, height?: number): booleanParameters
row— Required. The row index to insert after.count— Optional. Default:1. The number of rows to insert.height— Optional. Optional height for new rows.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.insertRowsAfter(0, 1)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.insertRowsBefore
Insert rows before a row.
insertRowsBefore(row: number, count?: number, height?: number): booleanParameters
row— Required. The row index to insert before.count— Optional. Default:1. The number of rows to insert.height— Optional. Optional height for new rows.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.insertRowsBefore(1, 2, 32)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.mergeCells
Merge a rectangular cell range.
mergeCells(range: ISlideTableCellRange): booleanParameters
range— Required. The range to merge.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.mergeCells({ startRow: 0, endRow: 1, startColumn: 0, endColumn: 1,})Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.remove
Remove this table element and resource.
remove(): booleanReturns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.remove()Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.resize
Resize the table grid.
resize(rows: number, columns: number): booleanParameters
rows— Required. The target row count.columns— Required. The target column count.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.resize(5, 4)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setBorder
Apply borders to a range.
setBorder(range: ISlideTableCellRange, border: ISlideTableBorder, preset?: SlideTableBorderPresetEnum): booleanParameters
range— Required. The target range.border— Required. The border style.preset— Optional. Default:SlideTableBorderPresetEnum.All. Which borders to apply.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setBorder( table.getTableRange(), { color: '#111827', width: 1, dash: univerAPI.Enum.SlideTableBorderDashEnum.Dash, }, univerAPI.Enum.SlideTableBorderPresetEnum.Outer,)Types: ISlideTableCellRange · ISlideTableBorder · SlideTableBorderPresetEnum
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellBackground
Set solid background color for a range.
setCellBackground(range: ISlideTableCellRange, color: string): booleanParameters
range— Required. The target range.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')table.setCellBackground(table.getTableRange(), '#F8FAFC')Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellFill
Set cell fill for a range.
setCellFill(range: ISlideTableCellRange, fill?: ISlideTableFill): booleanParameters
range— Required. The target range.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')table.setCellFill(table.getCellRange(0, 0), { type: univerAPI.Enum.SlideTableFillTypeEnum.Solid, color: '#E8F1FF', alpha: 1,})Types: ISlideTableCellRange · ISlideTableFill
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellHorizontalAlign
Set horizontal text alignment for a range.
setCellHorizontalAlign(range: ISlideTableCellRange, horizontalAlign: HorizontalAlign): booleanParameters
range— Required. The target range.horizontalAlign— Required. The horizontal alignment.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellHorizontalAlign(table.getTableRange(), univerAPI.Enum.HorizontalAlign.CENTER)Types: ISlideTableCellRange · HorizontalAlign
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellRichText
Replaces one cell with a detached value returned by univerAPI.newRichText().
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 to store.
Returns
Whether the command succeeded.
Examples
const text = univerAPI .newRichText() .align({ horizontal: univerAPI.Enum.HorizontalAlign.CENTER, vertical: univerAPI.Enum.VerticalAlign.MIDDLE, }) .text('Ready')table.setCellRichText(0, 0, text)Types: RichTextValue
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellStyle
Merge style fields into a cell range.
setCellStyle(range: ISlideTableCellRange, style: ISlideTableCellStyle): booleanParameters
range— Required. The target range.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')table.setCellStyle(table.getTableRange(), { 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: ISlideTableCellRange · ISlideTableCellStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellText
Replace a cell with plain text.
setCellText(row: number, column: number, text: string): booleanParameters
row— Required. The row index.column— Required. The column index.text— Required. The new text.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellText(0, 0, 'Ready')Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellTextColor
Set text color for a range.
setCellTextColor(range: ISlideTableCellRange, color: string): booleanParameters
range— Required. The target range.color— Required. The text color.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellTextColor(table.getTableRange(), '#111827')Types: ISlideTableCellRange
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellTextData
Replace a 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): booleanParameters
row— Required. The row index.column— Required. The column index.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')if (!table) throw new Error('Cannot find status table')const importedTextData = table.getCellTextData(0, 0)if (!importedTextData) throw new Error('Imported cell data is unavailable')if (!table.setCellTextData(0, 1, importedTextData)) throw new Error('Cannot restore raw cell data')Types: IDocumentData
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellTextDirection
Set text direction for a range.
setCellTextDirection(range: ISlideTableCellRange, textDirection: SlideTableTextDirectionEnum | undefined): booleanParameters
range— Required. The target range.textDirection— Required. The text direction.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellTextDirection( table.getTableRange(), univerAPI.Enum.SlideTableTextDirectionEnum.Horizontal,)Types: ISlideTableCellRange · SlideTableTextDirectionEnum
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellTextFill
Apply rich text fill to a range.
setCellTextFill(range: ISlideTableCellRange, fill?: IDocTextFill): booleanParameters
range— Required. The target range.fill— Optional. The rich text 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')table.setCellTextFill(table.getTableRange(), { type: 'solid', color: '#111827', opacity: 1 })Types: ISlideTableCellRange · IDocTextFill
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellTextStyle
Apply document text style to a range.
setCellTextStyle(range: ISlideTableCellRange, textStyle: ITextStyle): booleanParameters
range— Required. The target range.textStyle— Required. The document text style patch.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellTextStyle(table.getTableRange(), { fs: 14, bl: 1 })Types: ISlideTableCellRange · ITextStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCellVerticalAlign
Set vertical text alignment for a range.
setCellVerticalAlign(range: ISlideTableCellRange, verticalAlign: SlideTableVerticalAlignEnum | undefined): booleanParameters
range— Required. The target range.verticalAlign— Required. The vertical alignment.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCellVerticalAlign(table.getTableRange(), univerAPI.Enum.SlideTableVerticalAlignEnum.Middle)Types: ISlideTableCellRange · SlideTableVerticalAlignEnum
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setColumnWidth
Set one column's width.
setColumnWidth(column: number, width: number): booleanParameters
column— Required. The column index.width— Required. The column width.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setColumnWidth(1, 160)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setCustom
Set custom table metadata.
setCustom(custom: Record<string, unknown> | null): booleanParameters
custom— Required. Custom metadata, ornullto clear it.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setCustom({ source: 'agent' })Types: Record
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setOptions
Set table style options.
setOptions(options: ISlideTableStyleOptions): booleanParameters
options— Required. The table style options.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setOptions({ firstRow: true, bandRow: true })Types: ISlideTableStyleOptions
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setRowHeight
Set one row's height.
setRowHeight(row: number, height: number): booleanParameters
row— Required. The row index.height— Required. The row height.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setRowHeight(0, 40)Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setStyleId
Set the table theme style id. Built-in ids include:
univerPrimaryPlainGrid, univerPrimaryHeader, univerPrimaryHeaderBandedRows,
univerNeutralPlainGrid, univerGreenHeaderBandedRows, univerPurpleStrongHeader;
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}LightPlainGrid,
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}LightHeader,
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}LightHeaderBandedRows;
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}MediumStrongHeader,
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}MediumFirstColumn,
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}MediumHeaderFirstColumn;
univer{Neutral|Primary|Blue|Cyan|Green|Orange|Purple|Pink}HorizontalLines,
univerPrimarySoftGrid, and univerNeutralSoftGrid.
setStyleId(styleId: string | null): booleanParameters
styleId— Required. The style id, ornullto clear it.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setStyleId('univerGreenMediumHeaderFirstColumn')table.setOptions({ firstRow: true, firstCol: true, bandRow: true,})Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setTableBackground
Set table background color.
setTableBackground(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')table.setTableBackground('#F8FAFC')Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setTableBorder
Apply borders to the whole table.
setTableBorder(border: ISlideTableBorder, preset?: SlideTableBorderPresetEnum): booleanParameters
border— Required. The border style.preset— Optional. Default:SlideTableBorderPresetEnum.All. Which borders to apply.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setTableBorder( { color: '#111827', width: 1, dash: univerAPI.Enum.SlideTableBorderDashEnum.Solid, }, univerAPI.Enum.SlideTableBorderPresetEnum.All,)Types: ISlideTableBorder · SlideTableBorderPresetEnum
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setTableDescription
Set the table description.
setTableDescription(description: string | null): booleanParameters
description— Required. The description, ornullto clear it.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setTableDescription('Quarterly status table')Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setTableName
Set the table name.
setTableName(name: string | null): booleanParameters
name— Required. The table name, ornullto clear it.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setTableName('Status table')Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.setTableStyle
Apply table-level style settings.
setTableStyle(style: ISlideTableFacadeStyle): booleanParameters
style— Required. Table style settings.
Returns
Whether every command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.setTableStyle({ fill: { type: univerAPI.Enum.SlideTableFillTypeEnum.Solid, color: '#F8FAFC', alpha: 1, }, border: { color: '#111827', width: 1, dash: univerAPI.Enum.SlideTableBorderDashEnum.Solid, }, options: { firstRow: true, },})Types: ISlideTableFacadeStyle
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.toBuilder
Return a builder initialized from this table.
toBuilder(): FSlideTableBuilderReturns
A table builder.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')const tableInfo = table .toBuilder() .setValues([ ['Quarter', 'Owner', 'Status'], ['Q1', 'Sales', 'Done'], ]) .setRows(3) .setColumns(4) .setColumnWidth(105) .setRowHeight(60) .setAbsolutePosition(80, 120) .setSize(420, 180) .build()fSlide.updateTable(tableInfo)Types: FSlideTableBuilder
Package: @univerjs-pro/slides-table · Type definitions
FSlideTable.unmergeCell
Unmerge the merged range containing a cell.
unmergeCell(row: number, column: number): booleanParameters
row— Required. The row index.column— Required. The column index.
Returns
Whether the command succeeded.
Examples
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const table = fSlide.getTableById('status-table')table.unmergeCell(0, 0)Package: @univerjs-pro/slides-table · Type definitions
你觉得这篇文档如何?