Table Class
Defines a table in the document.
Declaration
export class Table
Remarks
richEdit.beginUpdate();
richEdit.history.beginTransaction();
var subDocument = richEdit.selection.activeSubDocument;
var position = richEdit.selection.active;
var columnCount = 5;
var rowCount = 5;
var table = subDocument.tables.create(position, columnCount, rowCount);
for (var rowInd = 0, row; row = table.rows.getByIndex(rowInd); rowInd++) {
for (var cellInd = 0, cell; cell = row.cells.getByIndex(cellInd); cellInd++) {
subDocument.insertText(cell.interval.start, "Row[" + rowInd + "].Cell[" + cellInd + "]");
}
}
richEdit.history.endTransaction();
richEdit.endUpdate();
Properties
index Property
Gets an index of the table.
Declaration
readonly index: number
Property Value
Type | Description |
---|---|
number | The table’s index. |
Remarks
Use the index to access the corresponding table by the TableCollection.getByIndex method.
interval Property
Gets the text buffer interval occupied by the current table element.
Declaration
readonly interval: Interval
Property Value
Type | Description |
---|---|
Interval | An object that contains the interval settings. |
rows Property
Provides access to a collection of table rows.
Declaration
readonly rows: TableRowCollection
Property Value
Type | Description |
---|---|
TableRowCollection | An array of TableRow objects that store information about individual table rows. |
Methods
delete Method
Deletes the current table.
Declaration
delete(): void
Remarks
var subDocument = richEdit.selection.activeSubDocument;
var position = richEdit.selection.active;
var tables = subDocument.tables.find(position);
for(var i = tables.length - 1, table; table = tables[i]; i--)
table.delete();