Cell item text style

General TRichView support forum. Please post your questions here
Post Reply
xmedia
Posts: 3
Joined: Wed Nov 30, 2011 6:01 pm

Cell item text style

Post by xmedia »

Is it possible to set the text style for all the cells when inserting a new table
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Each table cell initially has one text item of the 0-th text and the 0th paragraph styles. You can delete it and replace to the text item of another style.

If you do not use RichViewActions, do it before calling rve.InsertItem.

Code: Select all

table := TRVTableItemInfo.CreateEx(...);
// changing all cell styles to the current text and paragraph styles
for r := 0 to table.RowCount-1 do
  for c := 0 to table.ColCount-1 do begin
    table.Cells[r,c].Clear;
    table.Cells[r,c].AddNL('', rve.CurTextStyleNo, rve.CurParaStyleNo);
  end;
rve.InsertItem('', table);
If you use RichViewActions, add this cycle in rvActionInsertTable.OnInserting event.
xmedia
Posts: 3
Joined: Wed Nov 30, 2011 6:01 pm

Post by xmedia »

This is exactly what i want to do :), Thank you very much for your help
What is the signification of the property 'AssociatedTextStyle', when use it and for what ?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It is used internally, do not use it in your code.
(it is used for non-text items linked to a text style, like a labelitem or a tabulator).
Post Reply