Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TableCellCollection Class

A collection of the TableCell objects.

#Declaration

TypeScript
export class TableCellCollection extends TableBaseCollection<TableCell>

#Remarks

An object of this class can be accessed by the cells property.

#Inherited Members

#Methods

#insert(index) Method

Inserts a cell to the right or left of the specified cell.

#Declaration

TypeScript
insert(
    index: number,
    toRight?: boolean
): TableCell

#Parameters

Name Type Description
index number

The index of the cell relative to which to insert a cell.

toRight boolean

true to insert a cell to the right of the specified cell; false to insert a cell to the left of the specified cell.

#Returns

Type Description
TableCell

The newly inserted table cell.

#Remarks

Note

The newly inserted cell copies appearance settings from the cell whose index you passed as the index parameter.

The following code snippet inserts a new cell to the right of the first table cell:

js
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
table.rows.getByIndex(0).cells.insert(0, true);

#remove(index) Method

Removes a cell with the specified index from the row.

#Declaration

TypeScript
remove(
    index: number
): void

#Parameters

Name Type Description
index number

A cell index in the collection.

#Remarks

Note

Once you remove all cells from a row, the table removes the row from the row collection.

The following code snippet removes the last cell in the first row:

js
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
const firstRow = table.rows.getByIndex(0);
firstRow.cells.remove(firstRow.cells.count-1);