Printing TEdit, TStringGrid

edited 9:01PM in FastReport 4.0
Hello!

I have several TEdit and TStringGrid to print. The frxDBDataSet component requires the use of a table BDD thing I want to avoid (I let the choice to the user to print the data entered directly without saving and I also put calculations in TEdit) . I thought about using the frxUserDataSet component. I added some lines corresponding to TEdit.Text through frxUserDataSet.Fields.

Now I want to change the values of the added fields but I dry (I look for code similar to one of the following instructions):

frxUserDataSet->FieldByName["champ1"]->AsString = Edit1->Text;
frxUserDataSet->Fields->Strings[0] = Edit1->Text;

I get also an error when I write TfrxCrossView *c (unknown type)!

void __fastcall Tshet_faktura::frxReport1BeforePrint(
TfrxReportComponent *c)
{
TfrxCrossView* Cross;

AnsiString s=c->ClassName();

if(s == "TfrxCrossView")
{
Cross = (TfrxCrossView*)c;
for (int i = 1 ;i<=16;i++)
{
for (int j = 1;j<=16;j++)
{

Variant pRows[] = {i};
Variant pCols[] = {j};
Variant pStrs[] = {"12345"};
int nSize = ARRAYSIZE(pStrs);
Cross->AddValue((const Variant*)pRows,ARRAYSIZE(pRows)-1,
(const Variant*)pCols,ARRAYSIZE(pCols)-1,
(const Variant*)pStrs,ARRAYSIZE(pStrs)-1);
}
}
}
}

Comments

  • edited 9:01PM
    I find this code :
    procedure TForm1.frxReport1BeforePrint (c: TfrxReportComponent);
    var
    [b]Cross: TfrxCrossView;[/b]
    i, j: Integer;
    begin
    if c is TfrxCrossView then
    begin
    Cross: = TfrxCrossView (c);
    for i: = 1 to 16 do
    for j: = 1 to 16 do
    Cross. AddValue ([i], [j], [StringGrid1.Cells [i - 1, j - 1]]);
    end;
    
    I get an error : [bcc32 Erreur] Unit1.cpp(20): E2451 Symbole 'TfrxCrossView' indefined

    I read in the documentation :
    wrote:
    let us use the ?«Cross-tab?» object (it becomes available when the
    ?«TfrxCrossObject?» component is added to the project)
    . This object is responsible only for
    printing table data with a number of rows and columns unknown beforehand. The object
    has two versions: ?«TfrxCrossView?» for user
    ???s data printing, and ?«TfrxDBCrossView?» for
    printing the specially prepared data from the DB table.
    How can I add this object to my project ?

Leave a Comment