> ## 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.

# Types: OfficeJS: Tables

## `CellBorder`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `color?` | `string` | "auto" or RRGGBB; defaults to auto. |
| `sizePt?` | `number` | Eighth-point steps from 0.25 through 12; defaults to 0.5. |
| `spacePt?` | `number` | Gap between border and content in whole points, 0 through 31. |
| `style?` | `CellBorderStyle` | |

## `CellBorders`

Import from `@reductoai/docx/node`.

```ts theme={null}
type CellBorders = Partial<Record<CellBorderSide | CellDiagonal, CellBorder | false>>
```

## `CellBorderSide`

Import from `@reductoai/docx/node`.

```ts theme={null}
type CellBorderSide = "top" | "bottom" | "left" | "right"
```

## `CellBorderSideName`

Not exported by name. You get it from the API.

```ts theme={null}
type CellBorderSideName = "top" | "left" | "bottom" | "right"
```

## `CellBorderStyle`

Import from `@reductoai/docx/node`.

```ts theme={null}
type CellBorderStyle = typeof CELL_BORDER_STYLES[number]
```

## `CellDiagonal`

Word's Diagonal Down (w:tl2br) and Diagonal Up (w:tr2bl) borders.

Not exported by name. You get it from the API.

```ts theme={null}
type CellDiagonal = "diagonalDown" | "diagonalUp"
```

## `CellEdges`

Grid edges of one cell: which of its sides lie on the table's outer boundary.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bottom` | `boolean` | |
| `left` | `boolean` | |
| `right` | `boolean` | |
| `top` | `boolean` | |

## `CellPaddingLocation`

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

```ts theme={null}
type CellPaddingLocation = "Top" | "Left" | "Bottom" | "Right"
```

## `CellSide`

One cell side a border handle reads and writes; a handle is a live list of these.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cell` | `TableCell` | |
| `side` | `CellBorderSideName` | |

## `CellTextDirection`

Import from `@reductoai/docx/node`.

```ts theme={null}
type CellTextDirection = typeof CELL_TEXT_DIRECTIONS[number]
```

## `CellTextInsertLocation`

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

```ts theme={null}
type CellTextInsertLocation = Extract<InsertLocation, "Start" | "End" | "Replace">
```

## `CellVerticalAlignment`

Import from `@reductoai/docx/node`.

```ts theme={null}
type CellVerticalAlignment = typeof CELL_VERTICAL_ALIGNMENTS[number]
```

## `ColumnHost`

What a collection needs from its section: the sectPr, its measure and a tracked write.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `direction()` | `() => "RightToLeft" \| "LeftToRight"` | |
| `measurePoints()` | `() => number` | |
| `sectPr()` | `() => XElement` | |
| `setDirection()` | `(value: "RightToLeft" \| "LeftToRight") => void` | |
| `write()` | `(apply: () => void) => void` | |

## `ColumnSortOptions`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type ColumnSortOptions = Pick<TableSortOptions, "excludeHeader" | "caseSensitive" | "sortFieldType" | "sortOrder">
```

## `DeleteCells`

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

```ts theme={null}
type DeleteCells = "ShiftLeft" | "ShiftUp" | "EntireRow" | "EntireColumn"
```

## `ParagraphSortOptions`

VBA Range.Sort's arguments for paragraphs, named as Word.TableSortOptions names them.

Import from `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `caseSensitive?` | `boolean` | |
| `excludeHeader?` | `boolean` | |
| `sortFieldType?` | `SortFieldType` | |
| `sortOrder?` | `SortOrder` | |

## `RowHeightRule`

Not exported by name. You get it from the API.

```ts theme={null}
type RowHeightRule = "Auto" | "AtLeast" | "Exactly"
```

## `RowInsertLocation`

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

```ts theme={null}
type RowInsertLocation = Extract<InsertLocation, "Start" | "End">
```

## `SortOrder`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type SortOrder = "Ascending" | "Descending"
```

## `SortParagraphsOptions`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `caseSensitive?` | `boolean` | |
| `descending?` | `boolean` | |
| `type?` | `"text" \| "number" \| "date"` | |

## `TableAlignment`

Not exported by name. You get it from the API.

```ts theme={null}
type TableAlignment = typeof TABLE_ALIGNMENTS[number]
```

## `TableBorders`

Not exported by name. You get it from the API.

```ts theme={null}
type TableBorders = Partial<Record<TableBorderSide, CellBorder | false>>
```

## `TableBorderSide`

Not exported by name. You get it from the API.

```ts theme={null}
type TableBorderSide = "top" | "bottom" | "left" | "right" | "insideHorizontal" | "insideVertical"
```

## `TableBorderUpdateData`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableBorderUpdateData = WritableProperties<TableBorder>
```

## `TableBorderWriter`

A whole-table border handle writes `w:tblBorders`, as Word does, instead of each cell.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `sides()` | `() => (XElement \| undefined)[]` | The border element each covered side paints with, direct or from the style. |
| `update()` | `(change: BorderChange) => void` | |

## `TableCellCollectionItem`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cellIndex` | `number` | |
| `column` | `{ autoFit: any }` | |
| `columnSpan` | `number` | |
| `columnWidth` | `number` | |
| `parentRow` | `{ element: object; delete: any; setHeight: any }` | |
| `parentTable` | `{ delete: any; deleteColumns: any }` | |
| `width` | `number` | |
| `merge()` | `(mergeTo: TableCellCollectionItem) => void` | |
| `split()` | `(rowCount: number, columnCount: number) => void` | |

## `TableCellFormat`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `borders?` | `CellBorders` | Per-side direct borders; false on a side writes w:val="nil". |
| `marginsPt?` | `CellMarginsPt` | Per-side cell padding in points; 0 explicitly clears an inherited margin. |
| `shading?` | `string \| false` | Cell fill as RRGGBB; false explicitly clears inherited table-style shading. |
| `textDirection?` | `CellTextDirection` | Horizontal text or Word's bottom-to-top rotated cell text. |
| `verticalAlignment?` | `CellVerticalAlignment` | Vertical placement of cell content; top explicitly clears inherited alignment. |

## `TableCellFormulaOptions`

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

| Name | Type | Description |
| - | - | - |
| `formula?` | `string` | |
| `numFormat?` | `string` | |

## `TableCellUpdateData`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableCellUpdateData = WritableProperties<TableCell> & { body?: BodyUpdateData }
```

## `TableColumnUpdateData`

One logical grid column: its position, its width, and the cells that cover it.

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableColumnUpdateData = WritableProperties<TableColumn> & { shading?: ShadingUniversalUpdateData }
```

## `TableConvertToTextOptions`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `nestedTables?` | `boolean` | |
| `separator?` | `"Paragraph" \| "Tab" \| "Comma" \| "DefaultListSeparator"` | |

## `TableDirection`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableDirection = typeof TableDirection[keyof typeof TableDirection]
```

## `TableDistancePt`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bottom?` | `number` | |
| `left?` | `number` | |
| `right?` | `number` | |
| `top?` | `number` | |

## `TableFormat`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `alignment?` | `TableAlignment` | Table placement within the text column. |
| `bidiVisual?` | `boolean \| null` | Visual right-to-left grid (`w:bidiVisual`): logical column 0 paints at the right edge. Both booleans write an explicit direct property, so false overrides an RTL table style; null removes the direct property so the table style chain shows through again. |
| `borders?` | `TableBorders \| false` | Direct outer/inner borders; false removes the table-level border override. |
| `cellSpacingPt?` | `number \| false` | Space between cells (`w:tblCellSpacing`) in points; false removes the direct value. |
| `defaultCellMarginsPt?` | `CellMarginsPt \| false` | Default cell padding for this table; false removes all direct table-level defaults. |
| `indentPt?` | `number \| false` | Left table indent in points, negative to hang into the margin; false removes the direct indent. |
| `layout?` | `TableLayout` | Word's autofit algorithm or a fixed grid. |
| `look?` | `TableLook \| false` | Conditional regions of the table style to apply; false removes direct look flags. |
| `position?` | `TablePosition \| false` | Float the table at a page position; false returns it to the text flow. |
| `shading?` | `string \| false` | Fill every physical cell as RRGGBB; false removes their direct shading overrides. |
| `styleId?` | `string \| false` | Existing Word table style ID; false removes the direct style reference. |
| `widthPct?` | `number` | Preferred table width as a percent of the text column (w:tblW type="pct"); 100 fills it. |
| `widthPt?` | `number \| false` | Preferred table width in points; false writes Word's automatic width. |

## `TableInsertOptions`

Not exported by name. You get it from the API.

```ts theme={null}
type TableInsertOptions = Omit<OfficeRunFormat<InsertTableOptions>, "rows">
```

## `TableLayout`

Not exported by name. You get it from the API.

```ts theme={null}
type TableLayout = typeof TABLE_LAYOUTS[number]
```

## `TableLook`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `firstColumn?` | `boolean` | |
| `firstRow?` | `boolean` | |
| `horizontalBanding?` | `boolean` | |
| `lastColumn?` | `boolean` | |
| `lastRow?` | `boolean` | |
| `verticalBanding?` | `boolean` | |

## `TablePosition`

A floating table (`w:tblpPr`). Each axis takes an offset in points or an
alignment inside its anchor; both anchors default to `text` (the column and
the paragraph), which is what Word writes for "Text wrapping: Around".

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `allowOverlap?` | `boolean` | `w:tblOverlap`: whether other floating tables may overlap this one; Word's default is true. |
| `distancePt?` | `number \| TableDistancePt` | Text clearance in points, one value for every side or per side; Word's default is 9 left/right, 0 above/below. |
| `horizontalAnchor?` | `TablePositionAnchor` | |
| `verticalAnchor?` | `TablePositionAnchor` | |
| `xAlign?` | `typeof TABLE_X_ALIGNS[number]` | |
| `xPt?` | `number` | |
| `yAlign?` | `typeof TABLE_Y_ALIGNS[number]` | |
| `yPt?` | `number` | |

## `TablePositionAnchor`

What a floating table's offsets measure from: the page, its margins, or the text column/paragraph.

Not exported by name. You get it from the API.

```ts theme={null}
type TablePositionAnchor = "page" | "margin" | "text"
```

## `TableRowCollectionItem`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `parentTable` | `{ element: object; rowCount: number; convertToText: any; format: any }` | |
| `preferredHeight` | `number` | |
| `delete()` | `() => void` | |
| `setHeight()` | `(rowHeight: number, heightRule: RowHeightRule) => void` | |

## `TableRowFormat`

Import from `@reductoai/docx/node`.

| Name | Type | Description |
| - | - | - |
| `cantSplit?` | `boolean` | Prevent page breaks inside this row when it can fit on an empty page. |
| `heightPt?` | `number \| false` | Requested row height in points; false removes direct row height. |
| `heightRule?` | `"atLeast" \| "exact"` | Exact height or minimum height. Omitted numeric heights default to atLeast. |
| `repeatHeader?` | `boolean` | Repeat this row on continuation pages when it belongs to the leading header run. |

## `TableRowUpdateData`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableRowUpdateData = WritableProperties<TableRow> & { font?: FontSetFormat }
```

## `TableSortKey`

One Sort by / Then by: a grid column, read as text, number or date.

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

| Name | Type | Description |
| - | - | - |
| `column` | `number` | |
| `descending?` | `boolean` | |
| `type?` | `"text" \| "number" \| "date"` | |

## `TableSortOptions`

Word.TableSortOptions; language and script options are accepted and do not change the order.

Import from `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `bidirectionalSort?` | `boolean` | |
| `caseSensitive?` | `boolean` | |
| `excludeHeader?` | `boolean` | |
| `fieldNumber?` | `string \| number` | |
| `fieldNumber2?` | `string \| number` | |
| `fieldNumber3?` | `string \| number` | |
| `ignoreArabicThe?` | `boolean` | |
| `ignoreDiacritics?` | `boolean` | |
| `ignoreHebrew?` | `boolean` | |
| `ignoreKashida?` | `boolean` | |
| `languageId?` | `string` | |
| `sortFieldType?` | `SortFieldType` | |
| `sortFieldType2?` | `SortFieldType` | |
| `sortFieldType3?` | `SortFieldType` | |
| `sortOrder?` | `SortOrder` | |
| `sortOrder2?` | `SortOrder` | |
| `sortOrder3?` | `SortOrder` | |

## `TableStyleUpdateData`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableStyleUpdateData = WritableProperties<TableStyle>
```

## `TableUpdateData`

Import from `@reductoai/docx/officejs`.

```ts theme={null}
type TableUpdateData = WritableProperties<Table> & { font?: FontSetFormat }
```
