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

IdxRichEditSubDocument.Tables Property

Provides access to the collection of tables in the document.

#Declaration

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

VCL Rich Edit Control: A Table Example

See Also