# FPdfTableCell

- Human documentation: [https://docs.univer.ai/reference/facade/pdf-table-cell](https://docs.univer.ai/reference/facade/pdf-table-cell)

- Agent Markdown: [https://docs.univer.ai/reference/facade/pdf-table-cell.md](https://docs.univer.ai/reference/facade/pdf-table-cell.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/pdf-table-cell.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/pdf-table-cell.mdx)

---

Live Facade for one stable cell owned by an `FPdfTable`.

## Access

Access through:

* [`FPdfTable.getCell()`](https://docs.univer.ai/reference/facade/pdf-table.md#getcell)

## Example

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/pdfs.md) 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](https://docs.univer.ai/guides/pdfs/getting-started/facade.md).

## `@univerjs-pro/pdfs`

### `FPdfTableCell.getStyle`

Return a detached cell-style snapshot.

```typescript
getStyle(): Readonly<IPdfTableCellStyle>
```

**Returns**

The current cell-style snapshot.

**Examples**

```ts
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`](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/types.d.ts) · [`Readonly`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts)

**Package:** [`@univerjs-pro/pdfs`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/pdfs.md) · [Type definitions](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/facade/f-pdf-table.d.ts)

### `FPdfTableCell.getText`

Return the current cell text.

```typescript
getText(): string
```

**Returns**

The current cell text.

**Examples**

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/pdfs.md) · [Type definitions](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/facade/f-pdf-table.d.ts)

### `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**

```ts
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`](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/facade/types.d.ts)

**Package:** [`@univerjs-pro/pdfs`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/pdfs.md) · [Type definitions](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/facade/f-pdf-table.d.ts)

### `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**

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/pdfs.md) · [Type definitions](https://unpkg.com/@univerjs-pro/pdfs@1.0.0-rc.0/lib/types/facade/f-pdf-table.d.ts)
