TableRowCollection Class
A collection of the TableRow objects.
#Declaration
export class TableRowCollection extends TableBaseCollection<TableRow>
#Remarks
An object of this class can be accessed by the rows property.
#Methods
#insert(index) Method
Inserts a row above or below the specified row.
#Declaration
insert(
index: number,
below?: boolean
): TableRow
#Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the row relative to which to insert a row. |
below | boolean |
|
#Returns
Type | Description |
---|---|
Table |
The newly inserted table row. |
#Remarks
Note
The newly inserted row copies appearance settings from the row whose index you passed as the index
parameter.
The following code snippet adds a new row above the first table row:
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
table.rows.insert(0, false);
#remove(index) Method
Removes a row with the specified index from the table.
#Declaration
remove(
index: number
): void
#Parameters
Name | Type | Description |
---|---|---|
index | number | A row index in the collection. |
#Remarks
Note
Once you remove all rows from a table, the component removes the table from the document.
The following code snippet removes the last row in the table:
const subDocument = richEdit.selection.activeSubDocument;
const table = subDocument.tables.getByIndex(0);
table.rows.remove(table.rows.count-1);