Back to Devexpress

TableCellCollection Class

aspnetcore-js-devexpress-dot-richedit-247d9528.md

latest2.2 KB
Original Source

TableCellCollection Class

A collection of the TableCell objects.

Declaration

ts
export class TableCellCollection extends TableBaseCollection<TableCell>

Remarks

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

Inherited Members

count

getByIndex(index)

Methods

insert(index) Method

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

Declaration

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

Parameters

NameTypeDescription
indexnumber

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

TypeDescription
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

ts
remove(
    index: number
): void

Parameters

NameTypeDescription
indexnumber

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);