trichview.com

trichview.support




Re: How to insert a table by code?


Return to index


Author

Message

Muhammad

Posted: 05/22/2003 11:55:28


Here is a good example:


uses RVTable


var

   Table: TRVTableItemInfo; // unit "RVTable" must included in uses list

   i: integer;

begin

  with Table do

  begin

    Table := TRVTableItemInfo.CreateEx(DM.qryAyat.RecordCount + 1, 4,

RV.RVData); // create a table object


    //changing apearence of Table

    BorderStyle := rvtbLowered; BorderColor := clSilver; BorderWidth := 1;

    CellBorderStyle := rvtbLowered; CellBorderColor := clSilver;

CellBorderWidth := 1;

    CellPadding := 3; CellVSpacing := 0; CellHSpacing := 0;



    // with Cells[Row, Col] you can access to content of any cell

    // In fact any cell itself is a RichView object

    Cells[0, 3].Clear; Cells[0, 3].AddNL('Radif', tsTitle, psCenter);

Cells[0, 3].BestWidth := 30;

    Cells[0, 2].Clear; Cells[0, 2].AddNL('Ayeh', tsTitle, psCenter);

    Cells[0, 1].Clear; Cells[0, 1].AddNL('Name', tsTitle, psCenter);

Cells[0, 1].BestWidth := 70;

    Cells[0, 0].Clear; Cells[0, 0].AddNL('Numbers', tsTitle, psCenter);

Cells[0, 0].BestWidth := 70;



    DM.qryAyat.First;

    for i := 1 to DM.qryAyat.RecordCount do

    begin

      Cells[i, 3].Clear; // clear content of cell. by default there is a

#13#10 character in any cell

      Cells[i, 3].AddNL(IntToStr(i), tsNormalText, psCenter);

    end;

  end;



  RV.Clear;

  RV.AddItem('', Table); // Add Talbe object inside RichView

  RV.Format; // Format RichView to apear content




"Tran Duc Quan" <quantd@ssp.com.vn> wrote in message

news:3ecc55af@support.torry.net...

> Hi,

> I am new to TRichView.

> How can I do to insert a table to TRichView ?

> Thanks for your time.

>

> Regards,

>

> Quan

>

>





Powered by ABC Amber Outlook Express Converter