Tables
Tables in a TXTextControl arrange text in rows and columns. Your program inserts them with a method or loads them with a document, users select and edit them like other text, and built-in dialog boxes and the ruler change their attributes and cell sizes.
What follows explains how TX Text Control organizes a table and which members insert, delete and format tables. The pages of this section go further: identifiers that address a table from code, formulas that calculate cell text and number formats that display the results.
How Tables Are Organized
TX Text Control treats a table as a number of cells organized in rows and columns:
- A cell holds text. Each cell can have as many lines and paragraphs as required. Paragraph formatting is performed in relation to the cell's borders.
- A cell has a position and an extension in the document. Within this area, TX Text Control draws the cell's frames and its text with its paragraph and character formatting attributes. There can be a distance between the frame and the text.
Insert Tables
A table gets into a TXTextControl in one of two ways:
- With the TableInsert method, which inserts a new table in the text.
- With the Load method, as part of a document in the RTF or HTML format.
To let users define the table, call TableInsertDialog instead of TableInsert. It opens the built-in Insert Table dialog box and inserts the table when the user closes it with OK. It takes an optional table identifier and returns the identifier of the new table, -1 when the new table was combined with an existing table, or 0 when no table could be inserted, for example because text is selected.

When a table is inserted at the first position of another table or directly after another table, and both tables have the same number of columns, they are combined into a single table. Inserting one table inside another table is not possible.
Select, Delete and Copy Table Text
Text can be selected within a single cell, or in steps of complete cells or rows. Deleting a selection inside a table deletes only the text. To delete one or more complete rows, use the TableDeleteLines method.

Tables can be copied to the clipboard and pasted from the clipboard.
Change Table Attributes
The attributes of a table are its frame width, the distance between the frame and the formatted text, and its background color. To change the attributes of a table or a part of it, select the cells first. The TableAttrDialog method then opens a built-in dialog box for them.


Attributes cannot be changed when the selection extends over several tables, or over tables and text. To find out whether attributes can be changed or tables can be inserted or deleted, for example to enable or disable the items of a menu, use these properties:
- TableCanChangeAttr tells whether the attributes of all selected table cells can be changed.
- TableCanDeleteLines tells whether table lines can be deleted.
- TableCanInsert tells whether a table can be inserted.
Resize Cells With the Ruler
When the current input position is inside a table, the ruler shows the positions of all cells in the table's row and the formatting attributes of the cell that contains the input position. Users can then change the positions and extensions of the cells with a built-in mouse interface.

Key Members
| Member | Description |
|---|---|
| TableInsert | Inserts a new table in the text. |
| Load | Loads text in a certain format from a file and inserts it into the control. |
| TableDeleteLines | Deletes the selected table lines or the table line at the current input position. |
| TableAttrDialog | Opens the built-in dialog box for table attributes. |
| TableCanChangeAttr | Tells whether the attributes of all selected table cells can be changed. |
| TableCanDeleteLines | Tells whether table lines can be deleted. |
| TableCanInsert | Tells whether a table can be inserted. |
| TableCellFormula | Returns or sets the formula of a table cell. |
| TableCellNumberFormat | Returns or sets the number format of a table cell. |
Programming Categories - Tables lists all properties, methods and events for programming with tables.
Pages in This Section
- Programming with Table Identifiers: addressing a table from code by its identifier.
- Using Formulas in Table Cells: constants, operators, functions and cell references.
- Number Formats: placeholders, separators, percentages and text in results.