IdxRichEditSubDocument.Tables Property
Provides access to the collection of tables in the document.
Declaration
property Tables: IdxRichEditTableCollection read;
Property Value
Type | Description |
---|---|
IdxRichEditTableCollection | A table collection in a document. |
Remarks
Use the Tables
property to access and manage all tables in the current document.
Available Options
To create a new table anywhere within the document, call the Tables
.Add function. If you need to delete a table, call the Tables
.Delete or Tables
.Remove procedure.
For detailed information on all available options, refer to the IdxRichEditTableCollection interface description.
Code Example
The following code example creates a table with three rows and three columns at the current caret position and populates all cells in the table:
var
ADocument: IdxRichEditDocument;
ATable: IdxRichEditTable;
I, J: Integer;
begin
ADocument := dxRichEditControl1.Document;
ADocument.BeginUpdate; // Initiates the following batch change
try
ATable := ADocument.Tables.Add(ADocument.CaretPosition, 3, 3);
for I := 0 to ATable.Rows.Count - 1 do
for J := 0 to ATable.Rows.Self[I].Cells.Count - 1 do
ADocument.InsertText(ATable.Cell(I, J).Range.Start, 'Lorem ipsum dolor sit amet');
finally
ADocument.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
See Also