Tables

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

FPdfTable maintains a structured grid with stable cell wrappers, and each cell holds one editable text story.

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 the positions of cells in the overlapping region.

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 itself 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 fontColor and horizontalAlignment, which apply to the entire cell. Use PdfTableCellVerticalAlign through univerAPI.Enum.

Table actions

Select a cell to expose Table actions. On desktop they live in the properties panel for the selected table, which the contextual Table tab can open. On mobile, the Table actions button in the selection toolbar opens the same section. The actions select cells, merge or split cells, and insert rows or columns on either side. They also delete rows, columns, and the whole table, and set Row Height or Column Width. Merging requires a rectangular selection of multiple cells.

Table edits are durable and participate in undo and redo.

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.