Tables and fonts..

General TRichView support forum. Please post your questions here
Post Reply
miyomo
Posts: 5
Joined: Fri Apr 13, 2007 6:13 am

Tables and fonts..

Post by miyomo »

Hi!
how can I build a table without borders, and is it possible to use differents fonts inside cells?
I have to align data with differents fonts. No edit need, just readonly.

Any example?

Thanks!
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

var table: TRVTableItemInfo;
begin
  table := TRVTableItemInfo.CreateEx(1, 2, RichView1.RVData);
  table.CellBorderWidth := 0;
  table.BorderWidth := 0;
  table.Cells[0,0].Clear;
  table.Cells[0,0].AddNL('A', 0, 0);
  table.Cells[0,1].Clear;
  table.Cells[0,1].AddNL('B', 1, 0);
  RichView1.AddItem('', table);
  RichView1.Format;
end;
This code creates table with 2 columns and 1 row, without borders.
In the left cell, it adds 'A', formatted using RichView1.Style.TextStyles[0] font.
In the right cell, it adds 'B', formatted using RichView1.Style.TextStyles[1] font.
miyomo
Posts: 5
Joined: Fri Apr 13, 2007 6:13 am

Post by miyomo »

[quote="Sergey Tkachenko"]

Code: Select all

var table: TRVTableItemInfo;
begin
  table := TRVTableItemInfo.CreateEx(1, 2, RichView1.RVData);
[/quote]

Thanks for your kindly help, Sergey. Just the last question. Is it possible arrange column width runtime? I tried table.Cells[0,0].Width := xx but doens't work. 
I need some colums with different size in order to have data as much as closer possible..
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use Cell.BestWidth (and may be table.BestWidth).
They work like <td width> and <table width> in HTML.
Post Reply