Référence de l’API

FPdfTableCell

Cette page API est actuellement disponible en anglais. Les signatures et identifiants restent identiques dans toutes les langues.

Live Facade for one stable cell owned by an FPdfTable.

Access

Access through:

Example

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.insertTable({  rowCount: 2,  columnCount: 3,  cellTexts: ['A', 'B', 'C'],})const cell = table.getCell(0, 0)console.log(cell.getText())cell.setText('Ready').setStyle({  fill: { color: '#eef3ff' },  fontColor: '#dc2626',  horizontalAlignment: univerAPI.Enum.HorizontalAlign.CENTER,})

Setup

Register @univerjs-pro/pdfs or a preset that includes it. In plugin mode, import @univerjs-pro/pdfs/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs-pro/pdfs

FPdfTableCell.getStyle

Return a detached cell-style snapshot.

TypeScript
getStyle(): Readonly<IPdfTableCellStyle>

Returns

The current cell-style snapshot.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]const cell = table?.getCell(0, 0)console.log(cell?.getStyle())

Types: IPdfTableCellStyle · Readonly

Package: @univerjs-pro/pdfs · Type definitions

FPdfTableCell.getText

Return the current cell text.

TypeScript
getText(): string

Returns

The current cell text.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]const cell = table?.getCell(0, 0)console.log(cell?.getText())

Package: @univerjs-pro/pdfs · Type definitions

FPdfTableCell.setStyle

Update cell container and whole-cell text styles.

TypeScript
setStyle(style: IPdfTableCellStyleOptions): this

Parameters

  • style — Required. The cell-style patch.

Returns

This cell Facade for chaining.

Throws

If the cell is stale or the durable command is rejected.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]const cell = table?.getCell(0, 0)if (cell) {  cell.setStyle({    fill: { color: '#eef3ff' },    fontColor: '#dc2626',    horizontalAlignment: univerAPI.Enum.HorizontalAlign.CENTER,    verticalAlign: univerAPI.Enum.PdfTableCellVerticalAlign.MIDDLE,  })}

Types: IPdfTableCellStyleOptions

Package: @univerjs-pro/pdfs · Type definitions

FPdfTableCell.setText

Replace the text in a generated single-run table cell.

TypeScript
setText(text: string): this

Parameters

  • text — Required. The replacement cell text.

Returns

This cell Facade for chaining.

Throws

If the cell is stale, unsupported, or the durable command is rejected.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]const cell = table?.getCell(0, 0)if (cell) {  cell.setText('Ready')}

Package: @univerjs-pro/pdfs · Type definitions

Que pensez-vous de ce guide ?

© 2026 DreamNum Co., Ltd.