Using Tables

Tables can be inserted into a Text Control either with the TableInsert method or via the Load method as part of a document formatted with the RTF or HTML formats. Text Control treats a table as a number of cells organized in rows and columns. Each cell can have as many lines and paragraphs as required. Paragraph formatting is performed in relation to a cell's borders. Each cell has a position and an extension in the document, within this area a cell's frames and text are drawn along with its paragraph and character formatting attributes. There can be a distance between the frame and the text.

Text can be selected either within a single cell or in steps of complete cells or rows. When a selection is deleted inside a table only the text is deleted. To delete one or more complete rows use the TableDeleteLines method. Tables can be copied to the clipboard and pasted from the clipboard. When a table is inserted at the first position of another table or immediately behind another table and both tables have the same number of columns they are combined into a single table. The insertion of one table inside another table is not possible.

A table's attributes are its frame width, distance between frame and formatted text, and background color. To alter the attributes of a table or part of a table, cells must be selected. Then a built-in dialog box can be opened with the TableAttrDialog method. When the selection extends over several tables or tables mixed with text, attributes cannot be changed. To get information about whether attributes can be changed or tables can be inserted or deleted, for example to implement a menu, the TableCanChangeAttr, TableCanDeleteLines and TableCanInsert properties can be used.

When the current input position is inside a table, the ruler shows the positions of all the cells in a table's row and the formatting attributes of the cell the input position belongs to. Then the cells' positions and extensions can be changed with a built-in mouse interface.