# Tables

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

- Human documentation: [https://docs.univer.ai/guides/pdfs/features/core/tables](https://docs.univer.ai/guides/pdfs/features/core/tables)

- Agent Markdown: [https://docs.univer.ai/guides/pdfs/features/core/tables.md](https://docs.univer.ai/guides/pdfs/features/core/tables.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [pdfs/features/core/tables.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/pdfs/features/core/tables.mdx)

---

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

## Insert and edit a table

```ts
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

```ts
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

```ts
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()`.
