ApiTable

class ApiTable extends ApiTablePr

Description

Class representing a table.

Instance Methods

GetClassType(): table

Returns a type of the ApiTable class.

GetRowsCount(): number

Returns a number of rows in the current table.

GetRow(nPos): ApiTableRow | "null"

Returns a table row by its position in the table.

GetCell(nRow, nCell): ApiTableCell | "null"

Returns a cell by its position.

MergeCells(aCells): ApiTableCell

M.

SetStyle(oStyle): boolean

Sets a style to the current table.

SetTableLook(isFirstColumn, isFirstRow, isLastColumn, isLastRow, isHorBand, isVerBand)

S.

Split(oCell, nRow, nCol): ApiTable | "null"

Splits the cell into a given number of rows and columns.

AddRow(oCell, isBefore): ApiTableRow

Adds a new row to the current table.

AddRows(oCell, nCount, isBefore): ApiTable

Adds the new rows to the current table.

AddColumn(oCell, isBefore)

Adds a new column to the current table.

AddColumns(oCell, nCount, isBefore)

Adds the new columns to the current table.

AddElement(oCell, nPos, oElement)

Adds a paragraph or a table or a blockLvl content control using its position in the cell.

RemoveRow(oCell): boolean

Removes a table row with a specified cell.

RemoveColumn(oCell): boolean

Removes a table column with a specified cell.

Copy(): ApiTable

Creates a copy of the current table.

Select(): boolean

Selects the current table.

GetRange(Start, End): ApiRange

Returns a Range object that represents the part of the document contained in the specified table.

SetHAlign(sType): boolean

Sets the horizontal alignment to the table.

SetVAlign(sType): boolean

Sets the vertical alignment to the table.

SetPaddings(nLeft, nTop, nRight, nBottom): boolean

S.

SetWrappingStyle(isFlow): boolean

Sets the table wrapping style.

GetParentContentControl(): ApiBlockLvlSdt | "null"

Returns a content control that contains the current table.

InsertInContentControl(nType): ApiTable | ApiBlockLvlSdt

Wraps the current table object with a content control.

GetParentTable(): ApiTable | "null"

Returns a table that contains the current table.

GetTables(): ApiTable[]

Returns a Tables array that represents all the tables nested within the specified table.

GetParentTableCell(): ApiTableCell | "null"

Returns a table cell that contains the current table.

Delete(): boolean

Deletes the current table.

Clear(): boolean

Clears the content from the table.

Search(sText, isMatchCase): ApiRange[]

S.

SetTextPr(oTextPr): boolean

Applies the text settings to the entire contents of the table.

SetBackgroundColor(r, g, b, bNone): boolean

Sets the background color to all cells in the current table.

ToJSON(bWriteNumberings, bWriteStyles): JSON

Converts the ApiTable object into the JSON object.

GetPosInParent(): Number

Returns the table position within its parent element.

ReplaceByElement(oElement): boolean

Replaces the current table with a new element.

AddComment(sText, sAuthor, sUserId): ApiComment

A.

AddCaption(sAdditional, sLabel, bExludeLabel, sNumberingFormat, bBefore, nHeadingLvl, sCaptionSep): boolean

A.

SetStyleColBandSize(nCount)

Specifies a number of columns which will comprise each table column band for this table style.

SetStyleRowBandSize(nCount)

Specifies a number of rows which will comprise each table row band for this table style.

SetJc(sJcType)

Specifies the alignment of the current table with respect to the text margins in the current section.

SetShd(sType, r, g, b, isAuto)

Specifies the shading which is applied to the extents of the current table.

SetTableBorderTop(sType, nSize, nSpace, r, g, b)

Sets the border which will be displayed at the top of the current table.

SetTableBorderBottom(sType, nSize, nSpace, r, g, b)

Sets the border which will be displayed at the bottom of the current table.

SetTableBorderLeft(sType, nSize, nSpace, r, g, b)

Sets the border which will be displayed on the left of the current table.

SetTableBorderRight(sType, nSize, nSpace, r, g, b)

Sets the border which will be displayed on the right of the current table.

SetTableBorderInsideH(sType, nSize, nSpace, r, g, b)

Specifies 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).

SetTableBorderInsideV(sType, nSize, nSpace, r, g, b)

Specifies 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).

SetTableCellMarginBottom(nValue)

Specifies 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).

SetTableCellMarginLeft(nValue)

Specifies 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).

SetTableCellMarginRight(nValue)

Specifies 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).

SetTableCellMarginTop(nValue)

Specifies 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).

SetCellSpacing(nValue)

Specifies the default table cell spacing (the spacing between adjacent cells and the edges of the table).

SetTableInd(nValue)

Specifies 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).

SetWidth(sType, nValue)

S.

SetTableLayout(sType)

Specifies the algorithm which will be used to lay out the contents of the current table within the document.

SetTableTitle(sTitle)

Sets the table title (caption).

GetTableTitle()

Returns the table title (caption).

SetTableDescription(sDescr)

Sets the table description.

GetTableDescription()

Returns the table description.

Extends

ApiTablePr

Class representing the table properties.

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).