Show.Table
Show.Table is an object type of the Presentation module (Office.show(iframe)). 56 methods.
Presentation · 10 object types · 586 methods · namespace Show. This reference is generated from the API document artifact (sdk-api-doc.html) produced with the SDK build. Descriptions are the editor's API comments as published. Pin the SDK and Office versions together and regenerate when either changes.
Remarks
- Module: Presentation ·
Office.show(iframe)· namespaceShow - Obtained from:
Document.findTables(slides, filter),Slide.findTables(filter),Slide.insertTable(rowNum, colNum, styleName) - Every method returns a
Promise; signatures use TypeScript notation.
Methods
| Method | Description |
|---|---|
align(alignType) | Aligns the shape relative to the slide. |
deleteCol(startCol, endCol) | Deletes the columns in the given range. |
deleteRow(startRow, endRow) | Deletes the rows in the given range. |
findCells(filter) | Returns the cells that match the criteria. |
flip(direction) | Flips the shape vertically or horizontally. |
getCell(row, col) | Returns the cell at the given coordinates. |
getCells() | Returns all cells as an array. |
getColCount() | Returns the table's column count. |
getColumn(colIndex) | Returns the cells of the given column as an array. |
getColWidth(colIndex) | Returns the width of the given column. |
getHeight() | Returns the shape's height. |
getHyperlink() | Returns the hyperlink set on the shape. |
getPlaceholderType() | Returns the placeholder type of the shape. |
getPresetId() | Returns the shape's OOXML preset id (prst). |
getRotation() | Returns the rotation angle of the shape. |
getRow(rowIndex) | Returns the cells of the given row as an array. |
getRowCount() | Returns the table's row count. |
getRowHeight(rowIndex) | Returns the height of the given row. |
getStyleName() | Returns the name of the style applied to the table. |
getStyleOption(option) | Returns whether a table style option (header row, banded rows, etc.) is enabled. |
getTransform() | Returns the position, size, and rotation of the shape. |
getWidth() | Returns the shape's width. |
getX() | Returns the shape's X coordinate. |
getY() | Returns the shape's Y coordinate. |
getZOrderIndex() | Returns the z-order index of the shape within its parent (the slide, or the group for a group child). |
hasText() | Returns whether the shape contains text. |
insertCol(baseColIndex, position, insertNum) | Inserts columns to the left or right of the base column. |
insertRow(baseRowIndex, position, insertNum) | Inserts rows above or below the base row. |
isChart() | Checks whether this handle is a Chart (a type guard for union narrowing). |
isControl() | Checks whether this handle is a Control (a type guard for union narrowing). |
isDiagram() | Checks whether this handle is a Diagram (a type guard for union narrowing). |
isFlippedH() | Returns whether the shape is flipped horizontally. |
isFlippedV() | Returns whether the shape is flipped vertically. |
isGroup() | Checks whether this handle is a Group (a type guard for union narrowing). |
isImage() | Checks whether this handle is an Image (a type guard for union narrowing). |
isLine() | Checks whether this handle is a Line (a type guard for union narrowing). |
isOleObject() | Checks whether this handle is an OleObject (a type guard for union narrowing). |
isPlaceholder() | Returns whether the shape is a placeholder (title, body frame, etc.). |
isShape() | Checks whether this handle is a Shape (a type guard for union narrowing). |
isTable() | Checks whether this handle is a Table (a type guard for union narrowing). |
mergeCell(startRow, startCol, endRow, endCol) | Merges the cells in the given range. |
moveBy(distance) | Moves the shape by x, y relative to its current position. |
removeHyperlink() | Removes the shape's hyperlink. |
reorder(order) | Changes the shape's z-order (forward/backward). |
setColWidth(colIndex, newWidth) | Changes the width of the given column. |
setHeight(height) | Sets the height of the shape. |
setHyperlink(hyperlink) | Sets a hyperlink on the shape (symmetric with getHyperlink - the returned object can be passed back to copy a hyperlink). |
setRotation(rotation) | Sets the rotation angle of the shape as an absolute value. |
setRowHeight(rowIndex, newHeight) | Changes the height of the given row. |
setStyle(styleName) | Changes the table style. |
setStyleOption(option, enabled) | Changes a table style option (header row, banded rows, etc.). |
setTransform(transform) | Sets the position, size, and rotation of the shape in one call. |
setWidth(width) | Sets the width of the shape. |
setX(x) | Sets the X coordinate of the shape as an absolute value. |
setY(y) | Sets the Y coordinate of the shape as an absolute value. |
unmergeCell(startRow, startCol, endRow, endCol) | Unmerges the merged cells in the given range. |
Method details
align(alignType)
Aligns the shape relative to the slide. Ignored for shapes that cannot be moved. Group children also move relative to the slide, not within the group (same as the editor). If a child moves outside its group, the group grows to contain it.
align(alignType: AlignType): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
alignType | AlignType | Alignment type |
Returns
Promise<void>
deleteCol(startCol, endCol)
Deletes the columns in the given range. Not every column can be deleted - deleting the only column of a one-column table raises an error. To remove the table itself, use Slide.deleteShape.
deleteCol(startCol: number, endCol: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
startCol | number | Start column index to delete (0-based) |
endCol | number | End column index to delete (0-based, inclusive) |
Returns
Promise<void>
deleteRow(startRow, endRow)
Deletes the rows in the given range. Not every row can be deleted - deleting the only row of a one-row table raises an error. To remove the table itself, use Slide.deleteShape.
deleteRow(startRow: number, endRow: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
startRow | number | Start row index to delete (0-based) |
endRow | number | End row index to delete (0-based, inclusive) |
Returns
Promise<void>
findCells(filter)
Returns the cells that match the criteria. Multiple criteria are combined with AND. range matches when the cell body overlaps the range (a cell is included if any part of it is inside the range, even when the merged anchor cell is outside). Other criteria are evaluated against the anchor cell's coordinates/attributes for merged cells.
findCells(filter?: CellFilter): Promise<TableCell[]>;
Parameters
| Name | Type | Description |
|---|---|---|
filter (optional) | CellFilter | Search criteria. null also means no criteria (default: all cells) |
Returns
Promise<TableCell[]> - List of matching cells
flip(direction)
Flips the shape vertically or horizontally. This toggles the current flip state; read whether it is currently flipped with isFlippedH()/isFlippedV(). Ignored for shapes that cannot be rotated. For a rotated shape the angle is mirrored as well (getRotation() becomes 360 - previous angle).
flip(direction: FlipDirection): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
direction | FlipDirection | Flip direction |
Returns
Promise<void>
getCell(row, col)
Returns the cell at the given coordinates. For coordinates inside a merged area, returns the anchor cell of that merged area.
getCell(row: number, col: number): Promise<TableCell>;
Parameters
| Name | Type | Description |
|---|---|---|
row | number | Row index (0-based) |
col | number | Column index (0-based) |
Returns
Promise<TableCell> - The cell (null if out of range)
getCells()
Returns all cells as an array. Merged cells include only their representative cell.
getCells(): Promise<TableCell[]>;
Returns
Promise<TableCell[]> - List of cells
getColCount()
Returns the table's column count.
getColCount(): Promise<number>;
Returns
Promise<number> - Number of columns. 0 if there is no table
getColumn(colIndex)
Returns the cells of the given column as an array. Merged cells include only their representative cell.
getColumn(colIndex: number): Promise<TableCell[]>;
Parameters
| Name | Type | Description |
|---|---|---|
colIndex | number | 0-based column index |
Returns
Promise<TableCell[]> - List of cells in that column
getColWidth(colIndex)
Returns the width of the given column. (Symmetric with setColWidth.)
getColWidth(colIndex: number): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
colIndex | number | Column index (0-based) |
Returns
Promise<number | null> - Width (px); null if out of range
getHeight()
Returns the shape's height. (Symmetric with setHeight.)
getHeight(): Promise<number | null>;
Returns
Promise<number | null> - Height (px). null if the target shape is gone
getHyperlink()
Returns the hyperlink set on the shape. The returned object can be passed straight to setHyperlink. null if an unsupported kind (run program, macro, etc.) is attached.
getHyperlink(): Promise<Hyperlink | null>;
Returns
Promise<Hyperlink | null> - Hyperlink information. null if there is no hyperlink (action)
getPlaceholderType()
Returns the placeholder type of the shape.
getPlaceholderType(): Promise<PlaceholderType | null>;
Returns
Promise<PlaceholderType | null> - Placeholder type. null if the shape is not a placeholder or the target shape is gone
getPresetId()
Returns the shape's OOXML preset id (prst).
getPresetId(): Promise<string | null>;
Returns
Promise<string | null> - Preset id (prst); null if none
getRotation()
Returns the rotation angle of the shape. (counterpart of setRotation)
getRotation(): Promise<number | null>;
Returns
Promise<number | null> - Rotation angle (degrees). null if the target shape is gone
getRow(rowIndex)
Returns the cells of the given row as an array. Merged cells include only their representative cell.
getRow(rowIndex: number): Promise<TableCell[]>;
Parameters
| Name | Type | Description |
|---|---|---|
rowIndex | number | 0-based row index |
Returns
Promise<TableCell[]> - List of cells in that row
getRowCount()
Returns the table's row count.
getRowCount(): Promise<number>;
Returns
Promise<number> - Number of rows. 0 if there is no table
getRowHeight(rowIndex)
Returns the height of the given row. (Symmetric with setRowHeight.)
getRowHeight(rowIndex: number): Promise<number | null>;
Parameters
| Name | Type | Description |
|---|---|---|
rowIndex | number | Row index (0-based) |
Returns
Promise<number | null> - Height (px); null if out of range
getStyleName()
Returns the name of the style applied to the table. (counterpart of setStyle) The returned name can be fed back to setStyle as is. A style that exists only in the document and not in the editor gallery does not appear in the doc.getTableStyleNames() list.
getStyleName(): Promise<string | null>;
Returns
Promise<string | null> - Table style name. null if there is no style or the style has no name (the document does not carry one)
getStyleOption(option)
Returns whether a table style option (header row, banded rows, etc.) is enabled. (counterpart of setStyleOption)
getStyleOption(option: TableStyleOption): Promise<boolean | null>;
Parameters
| Name | Type | Description |
|---|---|---|
option | TableStyleOption | Option type (apiConstants.TableStyleOption) |
Returns
Promise<boolean | null> - Enabled state. null if the table or its properties cannot be read
getTransform()
Returns the position, size, and rotation of the shape. x/y are the top-left corner of the shape regardless of flip, so passing the returned value to another shape's setTransform places both shapes at the same spot. Values are rounded to the editor's input units - size to one decimal place, position to integers. The setters use the same units, so shapes placed more finely (e.g. imported documents) move by that amount when the value is passed back.
getTransform(): Promise<ShapeTransform | null>;
Returns
Promise<ShapeTransform | null> - Position, size, and rotation of the shape. null if the target shape is gone (e.g. deleted during collaboration)
getWidth()
Returns the shape's width. (Symmetric with setWidth.)
getWidth(): Promise<number | null>;
Returns
Promise<number | null> - Width (px). null if the target shape is gone
getX()
Returns the shape's X coordinate. (Symmetric with setX.)
getX(): Promise<number | null>;
Returns
Promise<number | null> - X coordinate (px). null if the target shape is gone
getY()
Returns the shape's Y coordinate. (Symmetric with setY.)
getY(): Promise<number | null>;
Returns
Promise<number | null> - Y coordinate (px). null if the target shape is gone
getZOrderIndex()
Returns the z-order index of the shape within its parent (the slide, or the group for a group child). 0 is the back; larger values are further to the front.
getZOrderIndex(): Promise<number | null>;
Returns
Promise<number | null> - z-order index. null if the target shape is gone
hasText()
Returns whether the shape contains text. Uses the same criterion the editor uses for empty text - true when there is only whitespace or two or more empty paragraphs (only line breaks), false when there is a single empty paragraph. Kinds without shape-level text (table, group, chart) are always false. (query tables per cell)
hasText(): Promise<boolean | null>;
Returns
Promise<boolean | null> - Whether text exists. null if the target shape is gone
insertCol(baseColIndex, position, insertNum)
Inserts columns to the left or right of the base column. New columns inherit the base column's formatting.
insertCol(baseColIndex: number, position: InsertPosition, insertNum: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
baseColIndex | number | Base column index for the insertion (0-based) |
position | InsertPosition | InsertPosition.LEFT | InsertPosition.RIGHT |
insertNum | number | Number of columns to insert |
Returns
Promise<void>
insertRow(baseRowIndex, position, insertNum)
Inserts rows above or below the base row. New rows inherit the base row's formatting.
insertRow(baseRowIndex: number, position: InsertPosition, insertNum: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
baseRowIndex | number | Base row index for the insertion (0-based) |
position | InsertPosition | InsertPosition.ABOVE | InsertPosition.BELOW |
insertNum | number | Number of rows to insert |
Returns
Promise<void>
isChart()
Checks whether this handle is a Chart (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isChart(): Promise<this is Chart>;
Returns
Promise<this is Chart>
isControl()
Checks whether this handle is a Control (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isControl(): Promise<this is Control>;
Returns
Promise<this is Control>
isDiagram()
Checks whether this handle is a Diagram (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isDiagram(): Promise<this is Diagram>;
Returns
Promise<this is Diagram>
isFlippedH()
Returns whether the shape is flipped horizontally. (calling flip(FlipDirection.HORIZONTAL) toggles this value)
isFlippedH(): Promise<boolean | null>;
Returns
Promise<boolean | null> - Horizontal flip state. null if the target shape is gone
isFlippedV()
Returns whether the shape is flipped vertically. (calling flip(FlipDirection.VERTICAL) toggles this value)
isFlippedV(): Promise<boolean | null>;
Returns
Promise<boolean | null> - Vertical flip state. null if the target shape is gone
isGroup()
Checks whether this handle is a Group (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isGroup(): Promise<this is Group>;
Returns
Promise<this is Group>
isImage()
Checks whether this handle is an Image (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isImage(): Promise<this is Image>;
Returns
Promise<this is Image>
isLine()
Checks whether this handle is a Line (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isLine(): Promise<this is Line>;
Returns
Promise<this is Line>
isOleObject()
Checks whether this handle is an OleObject (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isOleObject(): Promise<this is OleObject>;
Returns
Promise<this is OleObject>
isPlaceholder()
Returns whether the shape is a placeholder (title, body frame, etc.).
isPlaceholder(): Promise<boolean | null>;
Returns
Promise<boolean | null> - Placeholder state. null if the target shape is gone
isShape()
Checks whether this handle is a Shape (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isShape(): Promise<this is Shape>;
Returns
Promise<this is Shape>
isTable()
Checks whether this handle is a Table (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.
isTable(): Promise<this is Table>;
Returns
Promise<this is Table>
mergeCell(startRow, startCol, endRow, endCol)
Merges the cells in the given range.
mergeCell(startRow: number, startCol: number, endRow: number, endCol: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
startRow | number | Start row index of the merge (0-based) |
startCol | number | Start column index of the merge (0-based) |
endRow | number | End row index of the merge (0-based, inclusive) |
endCol | number | End column index of the merge (0-based, inclusive) |
Returns
Promise<void>
moveBy(distance)
Moves the shape by x, y relative to its current position. (Absolute placement is setX / setY.)
moveBy(distance: ShapeMoveDistance): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
distance | ShapeMoveDistance | Distance to move (px) |
Returns
Promise<void>
removeHyperlink()
Removes the shape's hyperlink.
removeHyperlink(): Promise<void>;
Returns
Promise<void>
reorder(order)
Changes the shape's z-order (forward/backward). Ignored if it is already at the target position.
reorder(order: ShapeZOrder): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
order | ShapeZOrder | Reorder type |
Returns
Promise<void>
setColWidth(colIndex, newWidth)
Changes the width of the given column.
setColWidth(colIndex: number, newWidth: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
colIndex | number | Column index (0-based) |
newWidth | number | New width (px). Ignored if colIndex is outside the table's column count |
Returns
Promise<void>
setHeight(height)
Sets the height of the shape. Ignored for shapes that cannot be resized.
setHeight(height: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
height | number | Height (px, rounded to one decimal place) |
Returns
Promise<void>
setHyperlink(hyperlink)
Sets a hyperlink on the shape (symmetric with getHyperlink - the returned object can be passed back to copy a hyperlink). An unsupported kind or an invalid target, such as a deleted slide, is ignored.
setHyperlink(hyperlink: Hyperlink): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
hyperlink | Hyperlink | The same Hyperlink object as returned by getHyperlink(). Ignored if type is missing |
Returns
Promise<void>
setRotation(rotation)
Sets the rotation angle of the shape as an absolute value. Ignored for shapes that cannot be rotated. (counterpart of getRotation)
setRotation(rotation: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
rotation | number | Rotation angle (degrees) |
Returns
Promise<void>
setRowHeight(rowIndex, newHeight)
Changes the height of the given row.
setRowHeight(rowIndex: number, newHeight: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
rowIndex | number | Row index (0-based) |
newHeight | number | New height (px). Ignored if rowIndex is outside the table's row count |
Returns
Promise<void>
setStyle(styleName)
Changes the table style. (counterpart of getStyleName)
setStyle(styleName: string): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
styleName | string | Table style name (from doc.getTableStyleNames()) |
Returns
Promise<void>
setStyleOption(option, enabled)
Changes a table style option (header row, banded rows, etc.). (counterpart of getStyleOption)
setStyleOption(option: TableStyleOption, enabled: boolean): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
option | TableStyleOption | Option type (apiConstants.TableStyleOption) |
enabled | boolean | Enabled state |
Returns
Promise<void>
setTransform(transform)
Sets the position, size, and rotation of the shape in one call. The value returned by getTransform() can be passed as is. (counterpart of getTransform) Only the fields given a value are applied, in the order size → position → rotation; omitted fields keep their current value. As with the individual setters, each field is ignored on shapes that do not support that operation (resize/move/rotate).
setTransform(transform?: Partial<ShapeTransform>): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
transform (optional) | Partial<ShapeTransform> | Position/size (px) · rotation (degrees) |
Returns
Promise<void>
setWidth(width)
Sets the width of the shape. Ignored for shapes that cannot be resized.
setWidth(width: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
width | number | Width (px, rounded to one decimal place) |
Returns
Promise<void>
setX(x)
Sets the X coordinate of the shape as an absolute value. Ignored for shapes that cannot be moved. (use moveBy for a relative move)
setX(x: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
x | number | X coordinate (px, rounded to an integer) |
Returns
Promise<void>
setY(y)
Sets the Y coordinate of the shape as an absolute value. Ignored for shapes that cannot be moved.
setY(y: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
y | number | Y coordinate (px, rounded to an integer) |
Returns
Promise<void>
unmergeCell(startRow, startCol, endRow, endCol)
Unmerges the merged cells in the given range.
unmergeCell(startRow: number, startCol: number, endRow: number, endCol: number): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
startRow | number | Start row index to unmerge (0-based) |
startCol | number | Start column index to unmerge (0-based) |
endRow | number | End row index to unmerge (0-based, inclusive) |
endCol | number | End column index to unmerge (0-based, inclusive) |
Returns
Promise<void>