# FDocumentTable

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

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

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

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

---

Facade object for a single enhanced docs table.

All mutating methods execute synchronously through the Univer command service and return
`true` when the underlying document mutation succeeds.

## Access

Access through:

* [`FDocument.getTables()`](https://docs.univer.ai/reference/facade/document.md#gettables)
* [`FDocument.getTable()`](https://docs.univer.ai/reference/facade/document.md#gettable)
* [`FDocument.getTableAt()`](https://docs.univer.ai/reference/facade/document.md#gettableat)
* [`FDocument.getTableAtSelection()`](https://docs.univer.ai/reference/facade/document.md#gettableatselection)
* [`FDocument.findTableByText()`](https://docs.univer.ai/reference/facade/document.md#findtablebytext)
* [`FDocument.findTables()`](https://docs.univer.ai/reference/facade/document.md#findtables)
* [`FDocument.insertTable()`](https://docs.univer.ai/reference/facade/document.md#inserttable)
* [`FDocument.insertTableFromData()`](https://docs.univer.ai/reference/facade/document.md#inserttablefromdata)

## Example

```ts
const fDocument = univerAPI.getActiveDocument()

const table = fDocument?.findTableByText('Status')
console.log(table?.describe())

table?.setCellText(1, 1, 'Done')
table?.setTableBorder({ color: '#3367D6', width: 1 })
```

## Setup

Register [`@univerjs-pro/docs-table`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-table.md) or a preset that includes it. In plugin mode, import `@univerjs-pro/docs-table/facade`. Additional methods below require their listed plugin packages. See [Facade setup](https://docs.univer.ai/guides/docs/getting-started/facade.md).

## `@univerjs-pro/docs-table`

### `FDocumentTable.appendColumn`

Appends a new column at the end of the table.

```typescript
appendColumn(): boolean
```

**Returns**

`true` if the column was successfully appended.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.appendColumn() // Appends a new column at the end of the table
```

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

### `FDocumentTable.appendRow`

Appends a new row at the end of the table.

```typescript
appendRow(): boolean
```

**Returns**

`true` if the row was successfully appended.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.appendRow() // Appends a new row at the end of the table
```

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

### `FDocumentTable.deleteColumn`

Deletes a single column at the specified column index.

```typescript
deleteColumn(column: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to delete.

**Returns**

`true` if the column was successfully deleted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.deleteColumn(1) // Deletes column 1
```

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

### `FDocumentTable.deleteColumns`

Deletes multiple columns starting from the specified column index.

```typescript
deleteColumns(startColumn: number, count?: number): boolean
```

**Parameters**

* `startColumn` — Required. The zero-based starting column index to delete.
* `count` — Optional. Default: `1`. The number of columns to delete.

**Returns**

`true` if the columns were successfully deleted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.deleteColumns(1, 2) // Deletes columns 1 and 2
```

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

### `FDocumentTable.deleteRow`

Deletes a single row at the specified row index.

```typescript
deleteRow(row: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to delete.

**Returns**

`true` if the row was successfully deleted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.deleteRow(1) // Deletes row 1
```

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

### `FDocumentTable.deleteRows`

Deletes multiple rows starting from the specified row index.

```typescript
deleteRows(startRow: number, count?: number): boolean
```

**Parameters**

* `startRow` — Required. The zero-based starting row index to delete.
* `count` — Optional. Default: `1`. The number of rows to delete.

**Returns**

`true` if the rows were successfully deleted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.deleteRows(1, 2) // Deletes rows 1 and 2
```

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

### `FDocumentTable.deleteTable`

Deletes the entire table.

```typescript
deleteTable(): boolean
```

**Returns**

`true` if the table was successfully deleted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.deleteTable() // Deletes the entire table
```

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

### `FDocumentTable.describe`

Returns a human-readable table summary with sample rows.

```typescript
describe(): IDocsTableDescription
```

**Returns**

A compact description suitable for agents or logs.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.describe())
```

**Types:** [`IDocsTableDescription`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.distributeColumns`

Distributes the width of columns evenly across a specified range of columns in the table.

```typescript
distributeColumns(startColumn?: number, count?: number): boolean
```

**Parameters**

* `startColumn` — Optional. Default: `0`. The zero-based starting column index to distribute from.
* `count` — Optional. Default: `this.getColumnCount()`. The number of columns to distribute. If not provided, it will distribute all columns starting from the `startColumn` to the end of the table.

**Returns**

`true` if the column widths were successfully distributed.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.distributeColumns(1, 3) // Distributes the width of columns 1 to 3 evenly
```

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

### `FDocumentTable.distributeRows`

Distributes the height of rows evenly across a specified range of rows in the table.

```typescript
distributeRows(startRow?: number, count?: number): boolean
```

**Parameters**

* `startRow` — Optional. Default: `0`. The zero-based starting row index to distribute from.
* `count` — Optional. Default: `this.getRowCount()`. The number of rows to distribute. If not provided, it will distribute all rows starting from the `startRow` to the end of the table.

**Returns**

`true` if the row heights were successfully distributed.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.distributeRows(1, 3) // Distributes the height of rows 1 to 3 evenly
```

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

### `FDocumentTable.getCell`

Gets a FDocumentTableCell instance for the specified cell coordinates.

```typescript
getCell(row: number, column: number): FDocumentTableCell | null
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The FDocumentTableCell instance, or `null` if the cell does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const cell = table?.getCell(0, 0)
console.log(cell?.getText()) // e.g. 'Status'
```

**Types:** [`FDocumentTableCell`](https://docs.univer.ai/reference/facade/document-table-cell.md)

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

### `FDocumentTable.getCellContentRange`

Returns the editable document range inside a table cell.
The range excludes the table cell tokens and the final section break, so block/list facades
can use it as their `startOffset`/`endOffset` target.

```typescript
getCellContentRange(row: number, column: number): IDocsTableCellContentRange | null
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The cell content range, or `null` if the cell does not exist.

**Examples**

```
const fDocument = univerAPI.getActiveDocument();
const table = fDocument?.findTableByText('Status');
const contentRange = table?.getCellContentRange(1, 1);
console.log(contentRange); // e.g. { startOffset: 123, endOffset: 130, segmentId: 'segment-1' }
```

**Types:** [`IDocsTableCellContentRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.getCellInsertOffset`

Returns the offset before the cell's final paragraph and section break.
Use this offset to insert an empty callout, quote, code block, or paragraph in the cell.

```typescript
getCellInsertOffset(row: number, column: number): number | null
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The insertion offset, or `null` if the cell does not exist.

**Examples**

```
const fDocument = univerAPI.getActiveDocument();
const table = fDocument?.findTableByText('Status');
const insertOffset = table?.getCellInsertOffset(1, 1);
console.log(insertOffset); // e.g. 129
```

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

### `FDocumentTable.getCellMargin`

Returns the effective margin used to lay out a cell.
The cell override takes precedence over the table default and the built-in fallback.

```typescript
getCellMargin(row: number, column: number): ITableCellMargin | null
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The effective margin, or `null` if the cell does not exist.

**Types:** [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getCellMarginOverride`

Returns a cell's explicit margin override.

```typescript
getCellMarginOverride(row: number, column: number): ITableCellMargin | null
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The explicit override, or `null` if the cell inherits its margin.

**Types:** [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getCellRange`

Gets the table cell range for the specified cell coordinates.

```typescript
getCellRange(row: number, column: number): IDocsTableCellRange
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The cell range, or `null` if the cell does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const cellRange = table?.getCellRange(1, 1)
console.log(cellRange) // e.g. { startRow: 1, endRow: 1, startColumn: 1, endColumn: 1 }
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getCellText`

Gets the plain text content of a cell.

```typescript
getCellText(row: number, column: number): string
```

**Parameters**

* `row` — Required. The zero-based row index.
* `column` — Required. The zero-based column index.

**Returns**

The cell text, or an empty string if the cell does not exist or has no text.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const cellText = table?.getCellText(0, 0)
console.log(cellText) // e.g. 'Status'
```

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

### `FDocumentTable.getColumnCount`

Gets the number of columns in the table.

```typescript
getColumnCount(): number
```

**Returns**

The column count, or `0` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getColumnCount())
```

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

### `FDocumentTable.getColumnRange`

Gets the cell range for the specified column index, covering all rows in the column.

```typescript
getColumnRange(column: number): IDocsTableCellRange
```

**Parameters**

* `column` — Required. The zero-based column index.

**Returns**

The cell range for the specified column, or `null` if the column does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const columnRange = table?.getColumnRange(1)
console.log(columnRange) // e.g. { startRow: 0, endRow: 4, startColumn: 1, endColumn: 1 }
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getColumnsRange`

Gets the cell range for the specified column index and column count, covering all rows in the columns.

```typescript
getColumnsRange(startColumn: number, count?: number): IDocsTableCellRange
```

**Parameters**

* `startColumn` — Required. The zero-based starting column index.
* `count` — Optional. Default: `1`. The number of columns to include in the range.

**Returns**

The cell range for the specified columns, or `null` if the starting column does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const columnsRange = table?.getColumnsRange(1, 2)
console.log(columnsRange) // e.g. { startRow: 0, endRow: 4, startColumn: 1, endColumn: 2 }
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getDefaultCellMargin`

Returns the effective table-level default cell margin.

```typescript
getDefaultCellMargin(): ITableCellMargin
```

**Types:** [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getDefaultCellMarginOverride`

Returns the explicit table-level default cell margin, or `null` when the built-in fallback is used.

```typescript
getDefaultCellMarginOverride(): ITableCellMargin | null
```

**Types:** [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getHeaderRowCount`

Gets the number of header rows in the table.

```typescript
getHeaderRowCount(): number
```

**Returns**

The number of header rows in the table.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const headerRowCount = table?.getHeaderRowCount()
```

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

### `FDocumentTable.getId`

Returns the table id.

```typescript
getId(): string
```

**Returns**

The table id stored in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getId()) // e.g. 'table-12345'
```

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

### `FDocumentTable.getInfo`

Returns compact table metadata for agents.

```typescript
getInfo(): IDocsTableInfo
```

**Returns**

The id, row count, column count, metadata, and raw table source.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getInfo())
```

**Types:** [`IDocsTableInfo`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.getMetadata`

Gets the table metadata stored in the document snapshot, including header row count, title row, and column type configs.

```typescript
getMetadata(): IDocsTableMetadata | undefined
```

**Returns**

The table metadata, or `undefined` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getMetadata())
```

**Types:** [`IDocsTableMetadata`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getRange`

Gets the table range with offsets for all cells in the table.

```typescript
getRange(): IDocsTableOffsetRange | null
```

**Returns**

The table range with offsets, or `null` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getRange())
```

**Types:** [`IDocsTableOffsetRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/table-range.d.ts)

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

### `FDocumentTable.getRowCount`

Gets the number of rows in the table.

```typescript
getRowCount(): number
```

**Returns**

The row count, or `0` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getRowCount())
```

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

### `FDocumentTable.getRowHeight`

Returns the row height value and its OOXML height rule.

```typescript
getRowHeight(row: number): ITableRowSize | null
```

**Parameters**

* `row` — Required.

**Types:** [`ITableRowSize`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getRowRange`

Gets the cell range for the specified row index, covering all columns in the row.

```typescript
getRowRange(row: number): IDocsTableCellRange
```

**Parameters**

* `row` — Required. The zero-based row index.

**Returns**

The cell range for the specified row, or `null` if the row does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const rowRange = table?.getRowRange(1)
console.log(rowRange) // e.g. { startRow: 1, endRow: 1, startColumn: 0, endColumn: 4 }
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getRowsRange`

Gets the cell range for the specified row index and row count, covering all columns in the rows.

```typescript
getRowsRange(startRow: number, count?: number): IDocsTableCellRange
```

**Parameters**

* `startRow` — Required. The zero-based starting row index.
* `count` — Optional. Default: `1`. The number of rows to include in the range.

**Returns**

The cell range for the specified rows, or `null` if the starting row does not exist.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const rowsRange = table?.getRowsRange(1, 2)
console.log(rowsRange) // e.g. { startRow: 1, endRow: 2, startColumn: 0, endColumn: 4 }
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.getSegmentId`

Get the segment id of this table.
The main body tables have an empty string segment id.
The header and footer tables have a non-empty string segment id.

```typescript
getSegmentId(): string
```

**Returns**

The segment id.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getSegmentId())
```

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

### `FDocumentTable.getSource`

Gets the raw table source from the document snapshot, including all table rows, cells, and columns.

```typescript
getSource(): ITable | undefined
```

**Returns**

The table source, or `undefined` if the table is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getSource())
```

**Types:** [`ITable`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.getTableRange`

Gets the table cell range covering all cells in the table.

```typescript
getTableRange(): IDocsTableCellRange
```

**Returns**

The table cell range covering all cells in the table, or `null` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
console.log(table?.getTableRange())
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.hasTitleRow`

Checks if the table has a title row.

```typescript
hasTitleRow(): boolean
```

**Returns**

`true` if the table has a title row, otherwise `false`.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
const hasTitle = table?.hasTitleRow()
```

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

### `FDocumentTable.insertColumnAfter`

Inserts a new column after the specified column index.

```typescript
insertColumnAfter(column: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to insert after.

**Returns**

`true` if the column was successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertColumnAfter(1) // Inserts a new column after column 1
```

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

### `FDocumentTable.insertColumnBefore`

Inserts a new column before the specified column index.

```typescript
insertColumnBefore(column: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to insert before.

**Returns**

`true` if the column was successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertColumnBefore(1) // Inserts a new column before column 1
```

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

### `FDocumentTable.insertColumnsAfter`

Inserts multiple columns after the specified column index.

```typescript
insertColumnsAfter(column: number, count: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to insert after.
* `count` — Required. The number of columns to insert.

**Returns**

`true` if the columns were successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertColumnsAfter(1, 2) // Inserts 2 new columns after column 1
```

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

### `FDocumentTable.insertColumnsBefore`

Inserts multiple columns before the specified column index.

```typescript
insertColumnsBefore(column: number, count: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to insert before.
* `count` — Required. The number of columns to insert.

**Returns**

`true` if the columns were successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertColumnsBefore(1, 2) // Inserts 2 new columns before column 1
```

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

### `FDocumentTable.insertRowAfter`

Inserts a new row after the specified row index.

```typescript
insertRowAfter(row: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to insert after.

**Returns**

`true` if the row was successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertRowAfter(1) // Inserts a new row after row 1
```

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

### `FDocumentTable.insertRowBefore`

Inserts a new row before the specified row index.

```typescript
insertRowBefore(row: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to insert before.

**Returns**

`true` if the row was successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertRowBefore(1) // Inserts a new row before row 1
```

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

### `FDocumentTable.insertRowsAfter`

Inserts multiple rows after the specified row index.

```typescript
insertRowsAfter(row: number, count: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to insert after.
* `count` — Required. The number of rows to insert.

**Returns**

`true` if the rows were successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertRowsAfter(1, 2) // Inserts 2 new rows after row 1
```

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

### `FDocumentTable.insertRowsBefore`

Inserts multiple rows before the specified row index.

```typescript
insertRowsBefore(row: number, count: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to insert before.
* `count` — Required. The number of rows to insert.

**Returns**

`true` if the rows were successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertRowsBefore(1, 2) // Inserts 2 new rows before row 1
```

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

### `FDocumentTable.insertTitleRow`

Inserts a title row at the top of the table.

```typescript
insertTitleRow(): boolean
```

**Returns**

`true` if the title row was successfully inserted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.insertTitleRow() // Inserts a title row at the top of the table
```

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

### `FDocumentTable.mergeCells`

Merges a range of cells in the table into a single cell. The content of the merged cell will be taken from the top-left cell in the range.

```typescript
mergeCells(range: IDocsTableCellRange): boolean
```

**Parameters**

* `range` — Required. The range of cells to merge.

**Returns**

`true` if the cells were successfully merged.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Merges the cells in the range from row 1 to 2 and column 1 to 2 into a single cell
table?.mergeCells({
  startRow: 1,
  endRow: 2,
  startColumn: 1,
  endColumn: 2,
})
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.moveColumn`

Moves a single column to a target column index with the specified insert position relative to the target column.

```typescript
moveColumn(column: number, targetColumn: number, position?: DocsTableColumnInsertPosition): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to move.
* `targetColumn` — Required. The zero-based target column index to move to.
* `position` — Optional. Default: `DocsTableInsertPosition.Left`. The position to insert the moved column relative to the target column. Defaults to `Left`.

**Returns**

`true` if the column was successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveColumn(1, 3, univerAPI.Enum.DocsTableColumnInsertPosition.Right) // Moves column 1 to right of column 3
```

**Types:** [`DocsTableColumnInsertPosition`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/actions.d.ts)

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

### `FDocumentTable.moveColumns`

Moves multiple columns to a target column index with the specified insert position relative to the target column.

```typescript
moveColumns(startColumn: number, count: number, targetColumn: number, position?: DocsTableColumnInsertPosition): boolean
```

**Parameters**

* `startColumn` — Required. The zero-based starting column index to move.
* `count` — Required. The number of columns to move.
* `targetColumn` — Required. The zero-based target column index to move to.
* `position` — Optional. Default: `DocsTableInsertPosition.Left`. The position to insert the moved columns relative to the target column. Defaults to `Left`.

**Returns**

`true` if the columns were successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveColumns(1, 2, 4, univerAPI.Enum.DocsTableColumnInsertPosition.Right) // Moves columns 1 and 2 to right of column 4
```

**Types:** [`DocsTableColumnInsertPosition`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/actions.d.ts)

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

### `FDocumentTable.moveRow`

Moves a single row to a target row index with the specified insert position relative to the target row.

```typescript
moveRow(row: number, targetRow: number, position?: DocsTableRowInsertPosition): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to move.
* `targetRow` — Required. The zero-based target row index to move to.
* `position` — Optional. Default: `DocsTableInsertPosition.Above`. The position to insert the moved row relative to the target row. Defaults to `Above`.

**Returns**

`true` if the row was successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveRow(1, 3, univerAPI.Enum.DocsTableRowInsertPosition.Below) // Moves row 1 to below row 3
```

**Types:** [`DocsTableRowInsertPosition`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/actions.d.ts)

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

### `FDocumentTable.moveRows`

Moves multiple rows to a target row index with the specified insert position relative to the target row.

```typescript
moveRows(startRow: number, count: number, targetRow: number, position?: DocsTableRowInsertPosition): boolean
```

**Parameters**

* `startRow` — Required. The zero-based starting row index to move.
* `count` — Required. The number of rows to move.
* `targetRow` — Required. The zero-based target row index to move to.
* `position` — Optional. Default: `DocsTableInsertPosition.Above`. The position to insert the moved rows relative to the target row. Defaults to `Above`.

**Returns**

`true` if the rows were successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveRows(1, 2, 4, univerAPI.Enum.DocsTableRowInsertPosition.Below) // Moves rows 1 and 2 to below row 4
```

**Types:** [`DocsTableRowInsertPosition`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/actions.d.ts)

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

### `FDocumentTable.moveTableBy`

Moves the entire table by the specified horizontal and vertical offsets.

```typescript
moveTableBy(deltaX: number, deltaY: number): boolean
```

**Parameters**

* `deltaX` — Required. Horizontal offset delta applied to the table's floating position
* `deltaY` — Required. Vertical offset delta applied to the table's floating position

**Returns**

`true` if the table was successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveTableBy(50, 100) // Moves the table 50 units to the right and 100 units down
```

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

### `FDocumentTable.moveTableToOffset`

Moves the entire table to the specified offset in the document's data stream.

```typescript
moveTableToOffset(offset: number): boolean
```

**Parameters**

* `offset` — Required. The target offset to move the table to.

**Returns**

`true` if the table was successfully moved.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.moveTableToOffset(500) // Moves the table to offset 500 in the document's data stream
```

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

### `FDocumentTable.pinHeaderRows`

Pins the specified number of rows at the top of the table as header rows, which will be repeated on each page when the table spans multiple pages.

```typescript
pinHeaderRows(count: number): boolean
```

**Parameters**

* `count` — Required. The number of rows to pin as header rows.

**Returns**

`true` if the header rows were successfully pinned.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.pinHeaderRows(2) // Pins the first 2 rows of the table as header rows
```

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

### `FDocumentTable.selectCell`

Selects a single cell in the table.

```typescript
selectCell(row: number, column: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index of the cell to select.
* `column` — Required. The zero-based column index of the cell to select.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectCell(1, 1) // Selects the cell at row 1, column 1
```

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

### `FDocumentTable.selectColumn`

Selects a single column in the table.

```typescript
selectColumn(column: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to select.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectColumn(1)
```

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

### `FDocumentTable.selectColumns`

Selects multiple columns in the table.

```typescript
selectColumns(startColumn: number, count?: number): boolean
```

**Parameters**

* `startColumn` — Required. The zero-based starting column index to select.
* `count` — Optional. Default: `1`. The number of columns to select.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectColumns(1, 2) // Selects columns 1 and 2
```

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

### `FDocumentTable.selectRange`

Selects a range of cells in the table with the specified selection kind.

```typescript
selectRange(range: IDocsTableCellRange, kind?: Exclude<DocsTableSelectionKind, DocsTableSelectionKind.None | DocsTableSelectionKind.Text>): boolean
```

**Parameters**

* `range` — Required. The cell range to select.
* `kind` — Optional. Default: `DocsTableSelectionKind.Range`. The selection kind, which determines the selection behavior and UI. Defaults to `Range`.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Select a range of cells from row 1 to 2 and column 1 to 2 with the 'Range' selection kind
table.selectRange({
  startRow: 1,
  endRow: 2,
  startColumn: 1,
  endColumn: 2,
})
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts) · [`Exclude`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`DocsTableSelectionKind`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts) · [`DocsTableSelectionKind.None`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts) · [`DocsTableSelectionKind.Text`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.selectRow`

Selects a single row in the table.

```typescript
selectRow(row: number): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to select.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectRow(1)
```

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

### `FDocumentTable.selectRows`

Selects multiple rows in the table.

```typescript
selectRows(startRow: number, count?: number): boolean
```

**Parameters**

* `startRow` — Required. The zero-based starting row index to select.
* `count` — Optional. Default: `1`. The number of rows to select.

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectRows(1, 2) // Selects rows 1 and 2
```

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

### `FDocumentTable.selectTable`

Selects the entire table.

```typescript
selectTable(): boolean
```

**Returns**

`true` if the selection was successfully set, or `false` if the table source is not found in the document snapshot.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.selectTable()
```

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

### `FDocumentTable.setBorder`

Sets the border properties for a range of cells in the table.

```typescript
setBorder(range: IDocsTableCellRange, options: IDocsTableBorderOptions): boolean
```

**Parameters**

* `range` — Required. The range of cells to set the border for.
* `options` — Required. The border options, including color, width, dash style, and presets for which sides to apply the border to.

**Returns**

`true` if the cell border was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Sets a solid red border with a width of 2 for the cells in the range from row 1 to 2 and column 1 to 2
table?.setBorder(
  {
    startRow: 1,
    endRow: 2,
    startColumn: 1,
    endColumn: 2,
  },
  {
    preset: univerAPI.Enum.DocsTableBorderPreset.All,
    color: '#ff0000',
    width: 2,
  },
)

// Sets a dashed blue border with a width of 1 for the cells in the range from row 0 to 0 and column 0 to 2, applying only to the bottom side
table?.setBorder(
  {
    startRow: 0,
    endRow: 0,
    startColumn: 0,
    endColumn: 2,
  },
  {
    preset: univerAPI.Enum.DocsTableBorderPreset.Bottom,
    border: {
      color: { rgb: '#0000ff' },
      width: { v: 1 },
      dashStyle: univerAPI.Enum.DashStyleType.DASHED,
    },
  },
)
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts) · [`IDocsTableBorderOptions`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.setCellBackground`

Sets the background color of a range of cells in the table.

```typescript
setCellBackground(range: IDocsTableCellRange, color: string): boolean
```

**Parameters**

* `range` — Required. The range of cells to set the background color for.
* `color` — Required. The background color to set, specified as a hex string (e.g., `#ff0000` for red).

**Returns**

`true` if the cell background color was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Sets the background color of the cells in the range from row 1 to 2 and column 1 to 2 to red
table?.setCellBackground(
  {
    startRow: 1,
    endRow: 2,
    startColumn: 1,
    endColumn: 2,
  },
  '#ff0000',
)
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.setCellMargin`

Sets or clears the explicit margin override for a range of cells.
Pass `null` to make the cells inherit the table default.

```typescript
setCellMargin(range: IDocsTableCellRange, margin: Nullable<ITableCellMargin>): boolean
```

**Parameters**

* `range` — Required. The target cell range.
* `margin` — Required. The margin override, or `null` to clear it.

**Returns**

Whether the mutation succeeded.

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts) · [`Nullable`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/shared/types.d.ts) · [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.setCellText`

Sets the text content of a specific cell in the table. If the cell is merged, the text will be set for the entire merged cell range.

```typescript
setCellText(row: number, column: number, text: string): boolean
```

**Parameters**

* `row` — Required. The zero-based row index of the cell to set text for.
* `column` — Required. The zero-based column index of the cell to set text for.
* `text` — Required. The text content to set in the cell.

**Returns**

`true` if the cell text was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.setCellText(1, 1, 'In Progress') // Sets the text of the cell at row 1, column 1 to 'In Progress'
```

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

### `FDocumentTable.setColumnType`

Sets the metadata type of a specific column in the table.

The column type is used as the value parsing hint for table features such as sorting.
It does not enable dedicated cell editors or rendering for date, checkbox, or dropdown columns.

```typescript
setColumnType(column: number, config: IDocsTableColumnTypeConfig): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to set the type for.
* `config` — Required. The column type configuration, including the type and any additional options specific to the column type.

**Returns**

`true` if the column type metadata was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Sorts column 2 as date values when table sorting is applied.
table?.setColumnType(2, {
  type: univerAPI.Enum.DocsTableColumnType.Date,
})
```

**Types:** [`IDocsTableColumnTypeConfig`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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

### `FDocumentTable.setColumnWidth`

Sets the width of a specific column in the table.

```typescript
setColumnWidth(column: number, width: number): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to set the width for.
* `width` — Required. The width value to set for the column.

**Returns**

`true` if the column width was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.setColumnWidth(1, 100) // Sets the width of column 1 to 100 units
```

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

### `FDocumentTable.setDefaultCellMargin`

Sets or clears the table-level default cell margin.
Pass `null` to restore the built-in fallback.

```typescript
setDefaultCellMargin(margin: Nullable<ITableCellMargin>): boolean
```

**Parameters**

* `margin` — Required. The table default, or `null` to clear it.

**Returns**

Whether the mutation succeeded.

**Types:** [`Nullable`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/shared/types.d.ts) · [`ITableCellMargin`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.setHeaderRowCount`

Sets the number of header rows in the table.
Header rows are typically styled differently and repeated on each page when the table spans multiple pages.

```typescript
setHeaderRowCount(count: number): boolean
```

**Parameters**

* `count` — Required. The number of header rows to set for the table.

**Returns**

`true` if the header row count was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.setHeaderRowCount(2) // Sets the first 2 rows of the table as header rows
```

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

### `FDocumentTable.setRowHeight`

Sets the height of a specific row in the table.

```typescript
setRowHeight(row: number, height: number, hRule?: TableRowHeightRule): boolean
```

**Parameters**

* `row` — Required. The zero-based row index to set the height for.
* `height` — Required. The height value to set for the row.
* `hRule` — Optional. Default: `TableRowHeightRule.AT_LEAST`.

**Returns**

`true` if the row height was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.setRowHeight(1, 30) // Sets the height of row 1 to 30 units
```

**Types:** [`TableRowHeightRule`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/types/interfaces/i-document-data.d.ts)

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

### `FDocumentTable.setTableBackground`

Sets the background color for the entire table.

```typescript
setTableBackground(color: string): boolean
```

**Parameters**

* `color` — Required. The background color to set for the table, specified as a hex string (e.g., `#ff0000` for red).

**Returns**

`true` if the table background color was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.setTableBackground('#ff0000') // Sets the background color of the entire table to red
```

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

### `FDocumentTable.setTableBorder`

Sets the border properties for the entire table.

```typescript
setTableBorder(border: IDocsTableBorderOptions): boolean
```

**Parameters**

* `border` — Required. The border options, including color, width, dash style, and presets for which sides to apply the border to.

**Returns**

`true` if the table border was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Sets a solid red border with a width of 2 for the entire table
table?.setTableBorder({
  preset: univerAPI.Enum.DocsTableBorderPreset.All,
  color: '#ff0000',
  width: 2,
})

// Sets a dashed blue border with a width of 1 for the entire table, applying only to the bottom side
table?.setTableBorder({
  preset: univerAPI.Enum.DocsTableBorderPreset.Bottom,
  border: {
    color: { rgb: '#0000ff' },
    width: { v: 1 },
    dashStyle: univerAPI.Enum.DashStyleType.DASHED,
  },
})
```

**Types:** [`IDocsTableBorderOptions`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.setTableStyle`

Sets the overall style for the entire table, including background color and border properties.

```typescript
setTableStyle(style: IDocsTableStyle): boolean
```

**Parameters**

* `style` — Required. The table style options, including background color and border properties.

**Returns**

`true` if the table style was successfully set.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Sets the background color of the entire table to light gray and applies a solid black border with a width of 1
table?.setTableStyle({
  backgroundColor: '#f0f0f0',
  border: {
    preset: univerAPI.Enum.DocsTableBorderPreset.All,
    color: '#000000',
    width: 1,
  },
})
```

**Types:** [`IDocsTableStyle`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/facade/types.d.ts)

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

### `FDocumentTable.sortByColumn`

Sort the table by a specific column in either ascending or descending order.

```typescript
sortByColumn(column: number, direction: DocsTableSortDirection): boolean
```

**Parameters**

* `column` — Required. The zero-based column index to sort by.
* `direction` — Required. The direction to sort the column, either ascending or descending.

**Returns**

`true` if the table was successfully sorted.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')
table?.sortByColumn(1, univerAPI.Enum.DocsTableSortDirection.Asc) // Sorts the table by column 1 in ascending order
```

**Types:** [`DocsTableSortDirection`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/sort.d.ts)

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

### `FDocumentTable.unmergeCells`

Unmerges a previously merged cell back into individual cells based on the specified range.

```typescript
unmergeCells(range: IDocsTableCellRange): boolean
```

**Parameters**

* `range` — Required. The range of the merged cell to unmerge, which should match the original merge range.

**Returns**

`true` if the cells were successfully unmerged.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const table = fDocument?.findTableByText('Status')

// Unmerges the previously merged cell in the range from row 1 to 2 and column 1 to 2 back into individual cells
table?.unmergeCells({
  startRow: 1,
  endRow: 2,
  startColumn: 1,
  endColumn: 2,
})
```

**Types:** [`IDocsTableCellRange`](https://unpkg.com/@univerjs-pro/docs-table@1.0.0-rc.0/lib/types/common/type.d.ts)

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