> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Other classes: Tables

## `TableBorder`

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableBorder properties

| Name | Type | Description |
| - | - | - |
| `color` | `string` | |
| `type` | `BorderType` | |
| `width` | `number` | The line's thickness in points; 0 when the covered sides disagree, as Word reports a Mixed border. |

### `TableBorder.set()`

```ts theme={null}
set(properties: TableBorderUpdateData, options?: UpdateOptions): void
```

## `TableCellCollection`

OfficeJS cell-collection operations over the live cells of a table row.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableCellCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `TableCellCollection.at()`

```ts theme={null}
at(index: number): T
```

### `TableCellCollection.autoFit()`

```ts theme={null}
autoFit(): void
```

Fit every represented uniform column to its widest cell content.

### `TableCellCollection.delete()`

```ts theme={null}
delete(shiftCells?: DeleteCells): void
```

Delete the row-scoped selection with Office's shift policy.

### `TableCellCollection.distributeHeight()`

```ts theme={null}
distributeHeight(): void
```

Equalize the distinct rows represented by the selected cells.

### `TableCellCollection.distributeWidth()`

```ts theme={null}
distributeWidth(): void
```

Equalize selected uniform logical columns while preserving their total width.

### `TableCellCollection.getFirst()`

```ts theme={null}
getFirst(): T
```

### `TableCellCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `TableCellCollection.getItem()`

```ts theme={null}
getItem(index: number): T
```

OfficeJS spelling of at().

### `TableCellCollection.getLast()`

```ts theme={null}
getLast(): T
```

### `TableCellCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `TableCellCollection.merge()`

```ts theme={null}
merge(): void
```

Merge the contiguous cells represented by this row-scoped collection.

### `TableCellCollection.setHeight()`

```ts theme={null}
setHeight(rowHeight: number, heightRule: RowHeightRule): void
```

Set the height of every distinct row represented by the collection.

### `TableCellCollection.setWidth()`

```ts theme={null}
setWidth(columnWidth: number, rulerStyle: RulerStyle): void
```

Set selected logical columns to a point width using Word's ruler-style spelling.

### `TableCellCollection.split()`

```ts theme={null}
split(
  options?: { mergeBeforeSplit?: boolean; numColumns?: number; numRows?: number },
): void
```

Split each cell, or merge the collection first and split the result.

## `TableCollection`

OfficeJS-flavored live collection: `items` is recomputed on every access.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `TableCollection.at()`

```ts theme={null}
at(index: number): T
```

### `TableCollection.getFirst()`

```ts theme={null}
getFirst(): T
```

### `TableCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `TableCollection.getItem()`

```ts theme={null}
getItem(index: number): T
```

OfficeJS spelling of at().

### `TableCollection.getLast()`

```ts theme={null}
getLast(): T
```

### `TableCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

## `TableColumn`

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableColumn properties

| Name | Type | Description |
| - | - | - |
| `columnIndex` | `number` | read-only 0-based, the counting Table.getCell(row, col) and TableCell.cellIndex use. |
| `isFirst` | `boolean` | read-only |
| `isLast` | `boolean` | read-only |
| `nestingLevel` | `number` | read-only A top-level table's column is level 1; each containing w:tbl adds one. |
| `preferredWidth` | `number` | Points under Points, whole percent under Percent, 0 under Auto (no declared width). |
| `preferredWidthType` | `PreferredWidthType` | The unit `w:tcW` declares on the covering cells: dxa is Points, pct is Percent, auto (or no `w:tcW` at all) is Auto. Cells that disagree throw, because OfficeJS has no Mixed member here. |
| `shading` | `ShadingUniversal` | read-only Cell-backed shading; writes reach every covering cell. |
| `width` | `number` | The grid width in points — the same read Table.width sums. |

### `TableColumn.autoFit()`

```ts theme={null}
autoFit(): void
```

Fit the column to the widest unwrapped line using OOXML point sizes.

### `TableColumn.delete()`

```ts theme={null}
delete(): void
```

Remove the column through Table.deleteColumns, so it inherits that door's
tracked behavior: under changeTrackingMode TrackAll/TrackMine every cell is
marked `w:cellDel` with its content struck and the grid keeps the column
until the revision is accepted; untracked, the cells and the `w:gridCol` go.

### `TableColumn.set()`

```ts theme={null}
set(properties: TableColumnUpdateData, options?: UpdateOptions): void
```

### `TableColumn.setWidth()`

```ts theme={null}
setWidth(columnWidth: number, rulerStyle: RulerStyle): void
```

Word's ruler-free width write: the column takes `columnWidth` points.

### `TableColumn.sort()`

```ts theme={null}
sort(options?: ColumnSortOptions): void
```

office.js TableColumn.sort: this column's cells, ascending, the other columns stay; options as VBA Column.Sort.

**Not implemented.** These Office.js members throw: `borders`, `select`.

## `TableRowCollection`

OfficeJS table-row collection operations over a live row set.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableRowCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `TableRowCollection.at()`

```ts theme={null}
at(index: number): T
```

### `TableRowCollection.convertToText()`

```ts theme={null}
convertToText(options?: TableConvertToTextOptions): Range
```

### `TableRowCollection.delete()`

```ts theme={null}
delete(): void
```

Delete every row in the collection, last-to-first so live indexes remain stable.

### `TableRowCollection.distributeHeight()`

```ts theme={null}
distributeHeight(): void
```

### `TableRowCollection.getFirst()`

```ts theme={null}
getFirst(): T
```

### `TableRowCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `TableRowCollection.getItem()`

```ts theme={null}
getItem(index: number): T
```

OfficeJS spelling of at().

### `TableRowCollection.getLast()`

```ts theme={null}
getLast(): T
```

### `TableRowCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): T & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `TableRowCollection.setHeight()`

```ts theme={null}
setHeight(rowHeight: number, heightRule: RowHeightRule): void
```

### `TableRowCollection.setLeftIndent()`

```ts theme={null}
setLeftIndent(leftIndent: number, rulerStyle: RulerStyle): void
```

**Not implemented.** These Office.js members throw: `select`.

## `TableStyle`

Table formatting of a table style.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### TableStyle properties

| Name | Type | Description |
| - | - | - |
| `alignment` | `Alignment` | A table takes no justified spelling: `w:jc` values a table cannot use read unknown. |
| `allowBreakAcrossPage` | `boolean` | A row of the table may split over a page break: `w:trPr/w:cantSplit` inverted. |
| `borders` | `BorderCollection` | read-only The style's `w:tblPr/w:tblBorders` — the same handle as `Style.borders`. |
| `bottomCellMargin` | `number` | |
| `cellSpacing` | `number` | Points of space between cells (`w:tblCellSpacing`). |
| `columnStripe` | `number` | Columns per vertical band (`w:tblStyleColBandSize`); 1 when unset. |
| `isBreakAcrossPagesAllowed` | `boolean` | read-only office.js ships this readonly alias of `allowBreakAcrossPage`; same read. |
| `leftCellMargin` | `number` | |
| `leftIndent` | `number` | Points the whole table is indented by (`w:tblInd`, twentieths, type dxa). |
| `rightCellMargin` | `number` | |
| `rowStripe` | `number` | Rows per horizontal band (`w:tblStyleRowBandSize`); 1 when unset. |
| `shading` | `Shading` | read-only The style's `w:tcPr/w:shd` — the same handle as `Style.shading`. |
| `tableDirection` | `TableDirection` | Visual grid direction (`w:bidiVisual`). |
| `topCellMargin` | `number` | Points; default cell padding written on the style's own `w:tblCellMar`. |

### `TableStyle.condition()`

```ts theme={null}
condition(conditionCode: ConditionCode): ConditionalStyle
```

Formatting of one table area (`w:tblStylePr`). The block is resolved on
every access and created by the first write, so reading a condition never
changes the document.

### `TableStyle.set()`

```ts theme={null}
set(properties: TableStyleUpdateData, options?: UpdateOptions): void
```
