Skip to main content

Table

A live handle to one top-level or cell-nested w:tbl element. Import from @reductoai/docx/node, @reductoai/docx/officejs.

Table properties

Table.addColumns()

Add columns; values is row-major (values[row][addedColumn]).

Table.addRows()

Add rows cloned from the adjacent row’s formatting; returns the new rows. values is row-major with rowCount rows sized to the adjacent row’s cells (vertical-merge continuations, which become ordinary empty cells in the clone, may be included or omitted).

Table.autoFitBehavior()

Word’s AutoFit behavior. “FixedSize” freezes the current grid (cell width writes become authoritative), “Content” reflows columns to their contents, “Window” stretches the table across the text column.

Table.autoFitWindow()

Autofit the table to the width of the text column (autoFitBehavior(“Window”)).

Table.clear()

Clear every physical cell’s contents without changing the table structure or formatting.

Table.convertToText()

Convert the complete table to paragraph text and return its first range.

Table.delete()

Table.deleteColumns()

Delete logical grid columns; spanning cells shrink around them. Word does not track this, even under change tracking.

Table.deleteRows()

Delete count rows starting at rowIndex (the OfficeJS Table.deleteRows shape).

Table.distributeColumns()

Equalize a uniform table’s logical columns while preserving total width. Under tracking the old grid and cell widths are recorded, Word’s shape for a tracked column resize.

Table.format()

Direct table sizing, placement, and layout behavior; tracked as property records.

Table.getBorder()

The table’s border at one location, Word’s meaning: Top/Bottom/Left/Right are the OUTER EDGES (the sides of the cells on that boundary), the Inside locations the shared edges between neighbouring cells. Reads are effective — direct w:tcBorders, else the table’s w:tblBorders, else the table style chain — and report Mixed when the covered sides disagree. Writes stay direct on each covered cell. Conditional w:tblStylePr formats are not consulted.

Table.getCell()

Table.getCellByOrdinal()

Address by a row’s physical cells, the counting OfficeJS getCell uses.

Table.getCellOrNullObject()

Table.getCellPadding()

Table.getNext()

The next table in the same body, skipping intervening paragraphs.

Table.getNextOrNullObject()

Table.getOoxml()

This table’s own w:tbl element, serialized with the prefixes it uses. Immediate ClientResult; .value is the fragment. Use it to read what the table declares itself, apart from what the table style contributes.

Table.getParagraphAfter()

Table.getParagraphAfterOrNullObject()

Table.getParagraphBefore()

Table.getParagraphBeforeOrNullObject()

Table.getRange()

Table.insertContentControl()

office.js Table.insertContentControl: wrap the w:tbl, keeping every handle live.

Table.insertParagraph()

Table.insertTable()

A table directly before or after this one; Word draws the two as one grid.

Table.mergeCells()

Merge the rectangle (startRow, startCol)..(endRow, endCol); returns the merged cell.
Literal search over visible cell paragraphs in row-major order.

Table.set()

Table.setCellPadding()

Table.sort()

office.js Table.sort: whole rows by up to three columns; excludeHeader keeps the first row. Not implemented. These Office.js members throw: applyStyleDirectFormatting, autoFormat, reapplyAutoFormat, select.

TableRow

A live handle to one w:tr element. Import from @reductoai/docx/node, @reductoai/docx/officejs.

TableRow properties

TableRow.clear()

Clear every physical cell, including vertical-merge continuation storage.

TableRow.convertToText()

TableRow.delete()

TableRow.format()

Repeat-as-header, split behavior, and row height.

TableRow.getBorder()

TableRow.getCellPadding()

TableRow.getNext()

TableRow.getNextOrNullObject()

TableRow.insertContentControl()

office.js TableRow.insertContentControl: wrap the w:tr, keeping every handle live.

TableRow.insertRows()

Insert rows cloned from this row’s shape directly before or after it — the escape hatch when the table’s last row is a merged footer. values rows are sized to this row’s cells (vertical-merge continuations, which become ordinary empty cells in the clone, may be included or omitted).

TableRow.merge()

Merge every physical cell in this row into one cell.

TableRow.set()

TableRow.setCellPadding()

TableRow.setHeight()

Set the row height using OfficeJS RowHeightRule spellings.

TableRow.setLeftIndent()

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

TableCell

A live handle to one w:tc element. Import from @reductoai/docx/node, @reductoai/docx/officejs.

TableCell properties

TableCell.autoSum()

Insert Word’s automatic =SUM field, preferring numeric cells above, then to the left.

TableCell.delete()

Delete this cell using Word’s cell-shift policy; ShiftLeft is the default.

TableCell.deleteColumn()

TableCell.deleteRow()

TableCell.fill()

Fill an answer slot: reuse the cell’s trailing blank paragraph when one exists, otherwise append a new paragraph. Returns the paragraph written.

TableCell.format()

Shading, vertical alignment, borders, margins, text direction.

TableCell.formula()

Insert an = (Formula) field with a cached result that Word can update on open.

TableCell.getBorder()

Live border handle. Reads are effective — direct w:tcBorders, else the style’s conditional w:tblStylePr borders, else the table’s w:tblBorders, else the table style chain — while writes stay direct on this cell.

TableCell.getCellPadding()

Effective cell padding in points: direct w:tcMar, else the table’s own w:tblCellMar, else the table style chain. Office’s ClientResult shape.

TableCell.getNext()

TableCell.getNextOrNullObject()

TableCell.getRange()

The cell’s content as a Range: “Whole” spans every paragraph the cell owns (nested tables excluded), “Start”/“End” are collapsed carets in its first/last paragraph. A Whole range is measurable — getRects reports one rectangle per laid line across all of the cell’s paragraphs.

TableCell.insertColumns()

TableCell.insertRows()

TableCell.insertText()

Newlines split into separate paragraphs inside the cell.

TableCell.merge()

TableCell.set()

TableCell.setCellPadding()

TableCell.split()

Split this cell into a rectangular set of cells. Not implemented. These Office.js members throw: select.