rvico TRichView Reference | Tables

Tables in RichView

Top  Previous  Next

Table is a special kind of RichView items, like images, controls, breaks, etc. But tables are much more complicated, because they contain RichView document in each cell. Moreover, tables can contain other tables inside, so RichView documents can be nested on any depth.

How to Create and Insert a Table

Creating table

uses RVTable;

...

var table:TRVTableItemInfo;

...

table := TRVTableItemInfo.CreateEx(RowCount,ColumnCount,

  RVData);

where RVData is a richview document where you wish to insert table. Usually this is richview.RVData or richviewedit.RVData.

How to append table to RichView

table.ParaNo := <Paragraph Style Index>

richview.AddItem(<Table name>, table)

where <table name> is any string associated with table, <paragraph style index> is the index in the collection of paragraph styles. This paragraph style is used for the table itself, not for each cells.

This method does not perform reformatting and requires explicit call of Format before displaying the document.

How to insert table in RichViewEdit

richviewedit.InsertItem(<Table name>, table)

This method inserts table in the position of caret, even if caret is in a cell of another table.

This method can return False, if document is read-only or insertion is impossible because of text protection. In this case table was freed by InsertItem method.

Table Placement

Table always occupies the whole line, no items are possible to the left or to the right of it (if you need this effect, use nested tables), including list markers.

The table's paragraph style defines its position: Alignment, LeftIndent, RightIndent (FirstIndent is ignored). The paragraph style can define border around the table and background. All these properties are applied to the table itself, not to its cells.


TRichView © trichview.com