Page 1 of 1

Tables and fonts..

Posted: Fri Apr 20, 2007 9:49 pm
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!

Posted: Sat Apr 21, 2007 6:48 am
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.

Posted: Sat Apr 21, 2007 8:19 am
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..

Posted: Sat Apr 21, 2007 9:27 am
by Sergey Tkachenko
Use Cell.BestWidth (and may be table.BestWidth).
They work like <td width> and <table width> in HTML.