API 参考

FPdfTable

本 API 页面目前提供英文正文。代码签名与标识符不随界面语言变化。

Facade for one editable structured PDF table.

Access

Access through:

Inheritance

Extends FPdfPageElement. Its inherited members are available on this object.

Example

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.insertTable({  rowCount: 2,  columnCount: 3,  cellTexts: ['A', 'B', 'C'],})console.log(table.getRowCount()) // 2console.log(table.getColumnCount()) // 3table.resize(3, 4)

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

FPdfTable.getCell

Return a live table-cell Facade by zero-based coordinates.

TypeScript
getCell(row: number, column: number): FPdfTableCell

Parameters

  • row — Required. The zero-based row index.
  • column — Required. The zero-based column index.

Returns

The live cell Facade.

Throws

If either coordinate is outside the current table.

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())

Types: FPdfTableCell

Package: @univerjs-pro/pdfs · Type definitions

FPdfTable.getColumnCount

Return the current table column count.

TypeScript
getColumnCount(): number

Returns

The column count.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]console.log(table?.getColumnCount())

Package: @univerjs-pro/pdfs · Type definitions

FPdfTable.getRowCount

Return the current table row count.

TypeScript
getRowCount(): number

Returns

The row count.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]console.log(table?.getRowCount())

Package: @univerjs-pro/pdfs · Type definitions

FPdfTable.getTheme

Return a detached table-theme descriptor.

TypeScript
getTheme(): Readonly<IPdfTableTheme>

Returns

The current theme snapshot.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]console.log(table?.getTheme())

Types: IPdfTableTheme · Readonly

Package: @univerjs-pro/pdfs · Type definitions

FPdfTable.resize

Resize the table grid while preserving overlapping cells by position.

TypeScript
resize(rowCount: number, columnCount: number): this

Parameters

  • rowCount — Required. The positive new row count.
  • columnCount — Required. The positive new column count.

Returns

This table Facade for chaining.

Throws

If either count is invalid or the table would exceed 10,000 cells.

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

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]if (table) {  table.resize(3, 4)}

Package: @univerjs-pro/pdfs · Type definitions

FPdfTable.setTheme

Replace the table theme and conditional style regions.

TypeScript
setTheme(theme: IPdfTableTheme): this

Parameters

  • theme — Required. The new table theme.

Returns

This table Facade for chaining.

Throws

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

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const table = page.getTables()[0]if (table) {  const preset = univerAPI.getPdfTableThemePresets()[3]  table.setTheme({    styleId: preset.id,    options: {      firstRow: true,    },  })}

Types: IPdfTableTheme

Package: @univerjs-pro/pdfs · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.