Tables

Insert, resize, style, and edit structured PDF tables through the Facade API.

FPdfTable keeps a structured grid with stable cell wrappers and one editable text story per cell.

Insert and edit a table

TypeScript
const table = page.insertTable({  rowCount: 2,  columnCount: 2,  cellTexts: ['Owner', 'Status', 'Docs', 'Ready'],  left: 36,  top: 36,  width: 360,  height: 108,})table.resize(3, 2)table.getCell(2, 0).setText('Legal')table.getCell(2, 1).setText('Review')

Rows and columns must be positive safe integers, and a table cannot exceed 10,000 cells. Resizing preserves overlapping cells by position.

Apply a table theme

TypeScript
const [preset] = univerAPI.getPdfTableThemePresets()if (preset) {  table.setTheme({    styleId: preset.id,    options: { firstRow: true },  })}

getPdfTableThemePresets() returns detached { id, group } descriptors. Use a preset's id as styleId; do not pass the descriptor directly to setTheme().

Cell styles

TypeScript
table.getCell(0, 0).setStyle({  fill: { color: '#eef3ff' },  fontColor: '#1d4ed8',  horizontalAlignment: univerAPI.Enum.HorizontalAlign.CENTER,  verticalAlign: univerAPI.Enum.PdfTableCellVerticalAlign.MIDDLE,})

FPdfTableCell.setStyle() accepts container fields plus whole-cell fontColor and horizontalAlignment. Use PdfTableCellVerticalAlign through univerAPI.Enum.

Table methods include getRowCount(), getColumnCount(), getCell(), resize(), getTheme(), and setTheme(). Cell methods include getText(), setText(), getStyle(), and setStyle().

How is this guide?

© 2026 DreamNum Co., Ltd.