trichview.com

trichview.support




new with TRiviewEdit and TRVTable


Return to index


Author

Message

Rato

Posted: 07/09/2003 12:52:59


Hello,

I don't understand how to insert text before a TRVTableItemInfo * table

component

When I AddNL text before the table an "insufficient memory" message appears

I hope you could help me

I thank you in advance

Patrick


Here is my code :


void TForm3::AffiFact()

{

RichViewEdit1->Clear();


AnsiString maintenant="22/22/22";//just to try

AnsiString moissuivant="22/23/22";//just to try

/*

RichViewEdit1->AddNL("Le Mill�naire",0,0);

RichViewEdit1->AddNL("",0,0);

RichViewEdit1->AddNL("",0,0);

RichViewEdit1->AddNL("Montpellier le : "+maintenant,0,0);

RichViewEdit1->AddNL("",0,0);   */


//------------------------------ here I try to insert this text at the

beginning of the page


RichViewEdit1->AddNL("Facture du :" +maintenant+" au: "+moissuivant,0,0);

//RichViewEdit1->AddNL("",0,0);


//------------------------------ for the first column

RVStyle1->TextStyles->Items[1]->Style<<fsBold;

Form1->Table1->First();

//comptage lignes colonnes

//--------------------- here I count column of a created table in another

cpp

countlines=0;

        do{

        Form1->Table1->Next();

        countlines++;

        }while(!Form1->Table1->Eof);

comptfields=Form1->Table1->FieldCount;


// fabrication de la table dans richview

//------------------------ creating the table in the TRichViewEdit component


TRVTableItemInfo *table= new TRVTableItemInfo(countlines,comptfields,

                                                RichViewEdit1->RVData);

table->Color=clNone;

table->BorderStyle=rvtbColor;

table->BorderColor=clWhite;

table->CellBorderColor=clWhite;

table->CellBorderStyle=rvtbColor;


table->BorderWidth=0;

table->BorderVSpacing=0;

table->BorderHSpacing=2;

table->CellBorderWidth=1;

table->CellPadding=3;

table->CellVSpacing=0;

table->CellHSpacing=5;

table->VRuleWidth=0;

table->HRuleWidth=0;

Form1->Table1->First();

for(int i=0;i<countlines;i++){

        for(int j=0;j<comptfields;j++){


table->Cells[i][j]->BestWidth=70;

table->Cells[i][j]->BestHeight=10;


//----------- here I change the size with column number


if(j>=1)table->Cells[i][j]->BestWidth=30;


if(j>=3)table->Cells[i][j]->BestWidth=10;


if(j==12){contenu=FloatToStrF(Form1->Table1->Fields->Fields[j]->AsFloat,ffCu

rrency,2,2);

        table->Cells[i][j]->BestWidth=40;}

else

if(j==13){contenu=FloatToStrF(Form1->Table1->Fields->Fields[j]->AsFloat,ffCu

rrency,2,2);

         table->Cells[i][j]->BestWidth=40;}

else

contenu=Form1->Table1->Fields->Fields[j]->AsString;

  table->Cells[i][j]->AddNL(contenu,0,0);

table->Cells[i][j]->Color=clWhite;

                                        }// fin for j

        Form1->Table1->Next();

                                }//fin for i


//-----------end of the table


RichViewEdit1->InsertText("",true);

if(RichViewEdit1->InsertItem("",table)){}

RichViewEdit1->Format();

}





Powered by ABC Amber Outlook Express Converter