Skip to main content

ApiTable

Class representing a table.

ApiTable is a subclass of ApiTablePr.

Properties​

NameTypeDescription
CellsApiTableCell[][]Returns all cells of the table as a two-dimensional array indexed by [row][cell].
RowsApiTableRow[]Returns all rows of the table as an array.

Methods​

The following table lists the available methods.

MethodReturnsDescription
AddCaptionbooleanAdds a caption paragraph after (or before) the current table.
AddColumnbooleanAdds a new column to the current table.
AddColumnsApiTableAdds the new columns to the current table.
AddCommentApiComment | null | undefinedAdds a comment to all contents of the current table.
AddElementbooleanAdds a paragraph or a table or a blockLvl content control using its position in the cell.
AddRowApiTableRowAdds a new row to the current table.
AddRowsApiTableAdds the new rows to the current table.
ClearbooleanClears the content from the table.
CopyApiTableCreates a copy of the current table.
DeletebooleanDeletes the current table.
GetAllCellsApiTableCell[]Returns a collection of all cells in the table.
GetCellApiTableCellReturns a cell by its position.
GetClassType"table"Returns a type of the ApiTable class.
GetColumnWidthEMU | nullReturns the width of the specified column (by index) of the current table.
GetColumnsCountnumberReturns a number of columns in the current table.
GetInternalIdstringReturns an internal ID of the current table.
GetParentApiDocument | ApiDocumentContent | nullReturns the document content that contains the current table.
GetParentContentControlApiBlockLvlSdt | nullReturns a content control that contains the current table.
GetParentTableApiTable | nullReturns a table that contains the current table.
GetParentTableCellApiTableCell | nullReturns a table cell that contains the current table.
GetPosInParentNumberReturns the table position within its parent element.
GetRangeApiRangeReturns a Range object that represents the part of the document contained in the specified table.
GetRowApiTableRowReturns a table row by its position in the table.
GetRowsCountnumberReturns a number of rows in the current table.
GetSelectedCellsApiTableCell[]Returns the selected cells of the current table.
GetSelectedColumnsCellsApiTableCell[]Returns all cells from the columns that contain the currently selected cells. This method identifies which columns contain selected cells and then returns all cells in those columns, not just the selected cells themselves.
GetSelectedRowsApiTableRow[]Returns all rows that contain the currently selected cells. This method identifies which rows contain selected cells and returns those complete row objects.
GetTableDescriptionstringReturns the table description.
GetTableLookTableLookGets table look properties
GetTableTitlestringReturns the table title (caption).
GetTablesApiTable[]Returns an array of tables that represents all the tables nested within the specified table.
InsertInContentControlApiTable | ApiBlockLvlSdtWraps the current table object with a content control.
MergeCellsApiTableCell | null | undefinedMerges an array of cells.
RemoveColumnbooleanRemoves a table column with a specified cell.
RemoveRowbooleanRemoves a table row with a specified cell.
ReplaceByElementbooleanReplaces the current table with a new element.
SearchApiRange[]Searches for a scope of a table object.
SelectbooleanSelects the current table.
SelectRangebooleanSelects a range of cells in the current table.
SetBackgroundColorbooleanSets the background color to all cells in the current table.
SetCellSpacingbooleanSpecifies the default table cell spacing (the spacing between adjacent cells and the edges of the table).
SetColumnWidthEMU | nullSets the width of the specified column (by index) of the current table.
SetHAlignbooleanSets the horizontal alignment to the table.
SetHeightEMU | nullSets the total height of the current table, distributing it evenly among the table rows. The value is applied as a minimum height for each row, so a row can be taller if its content requires more space.
SetJcbooleanSpecifies the alignment of the current table with respect to the text margins in the current section.
SetPaddingsbooleanSets the table paddings.
SetShdbooleanSpecifies the shading which is applied to the extents of the current table.
SetStylebooleanSets a style to the current table.
SetStyleColBandSizebooleanSpecifies a number of columns which will comprise each table column band for this table style.
SetStyleRowBandSizebooleanSpecifies a number of rows which will comprise each table row band for this table style.
SetTableBorderAllbooleanSpecifies a border which will be displayed on all table cell borders.
SetTableBorderBottombooleanSets the border which will be displayed at the bottom of the current table.
SetTableBorderInsideHbooleanSpecifies the border which will be displayed on all horizontal table cell borders which are not on the outmost edge of the parent table (all horizontal borders which are not the topmost or bottommost borders).
SetTableBorderInsideVbooleanSpecifies the border which will be displayed on all vertical table cell borders which are not on the outmost edge of the parent table (all vertical borders which are not the leftmost or rightmost borders).
SetTableBorderLeftbooleanSets the border which will be displayed on the left of the current table.
SetTableBorderRightbooleanSets the border which will be displayed on the right of the current table.
SetTableBorderTopbooleanSets the border which will be displayed at the top of the current table.
SetTableCellMarginBottombooleanSpecifies an amount of space which will be left between the bottom extent of the cell contents and the border of all table cells within the parent table (or table row).
SetTableCellMarginLeftbooleanSpecifies an amount of space which will be left between the left extent of the cell contents and the left border of all table cells within the parent table (or table row).
SetTableCellMarginRightbooleanSpecifies an amount of space which will be left between the right extent of the cell contents and the right border of all table cells within the parent table (or table row).
SetTableCellMarginTopbooleanSpecifies an amount of space which will be left between the top extent of the cell contents and the top border of all table cells within the parent table (or table row).
SetTableDescriptionbooleanSets the table description.
SetTableIndbooleanSpecifies the indentation which will be added before the leading edge of the current table in the document (the left edge in the left-to-right table, and the right edge in the right-to-left table).
SetTableLayoutbooleanSpecifies the algorithm which will be used to lay out the contents of the current table within the document.
SetTableLookbooleanSpecifies the conditional formatting components of the referenced table style (if one exists) which will be applied to the set of table rows with the current table-level property exceptions. A table style can specify up to six different optional conditional formats, for example, different formatting for the first column, which then can be applied or omitted from individual table rows in the parent table.
SetTableTitlebooleanSets the table title (caption).
SetTextPrbooleanApplies the text settings to the entire contents of the table.
SetVAlignbooleanSets the vertical alignment to the table.
SetWidthbooleanSets the preferred width to the current table.
SetWrappingStylebooleanSets the table wrapping style.
SplitApiTable | nullSplits the cell into a given number of rows and columns.
ToJSONJSONConverts the ApiTable object into the JSON object.