rvico TRichView Reference | Tables

Table Cells

Top  Previous  Next

Table Cells

The main property of a table is Cells[<Row>,<Col>].

<Row>,<Col> are indices of a row and a column, from 0.

Attention: The standard Delphi grids use Cells[<Col>,<Row>] instead!

The type of Cell[r,c] is TRVTableCellData. Each RichView control has a similar class inside (richview.RVData). Cell and richview.RVData are descendants from the same class designed to store formatted RichView document.

Cells also have additional table-related properties (discussed below).

Table Rows

Tables have another property: Rows.

It is a list of table rows. Each row is a list of cells.

Each row has the same number of cells (important!)

So:

number of rows in table = table.Rows.Count;

number of columns in table = table.Rows[0].Count (each row has the same number of cells as the 0-th)

table.Cells[r,c] is the same as table.Rows[r][c].

Accessing and Modifying Cells

In editor, you need no special processing to access cells.

Methods working with current/selected item(s) do it automatically (see more info).

Cells have the most of the methods which RichView (not RichViewEdit!) has.

For example:

with table.Cells[r,c] do begin

  Clear;

  AddNLATag('hello!'00, '');

end;

Read more about methods of cell.

 

Initially every cell contains one empty line of the 0-th text and paragraph style.

Cells do not have editor-style methods. RichViewEdit creates special inplace editor to edit cell.

Read more about cell editing.


TRichView © trichview.com