Home > Back-end >  Print stringgrid fastreport statements
Print stringgrid fastreport statements

Time:10-22

I use fastreport print stringgrid form content, the code is as follows:
Procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: Integer;
The begin
For I:=1 to 16 do
For j:=1 to 16 do
StringGrid1. Cells [] I - 1, j - 1:=IntToStr (I * j);
end;

Procedure TForm1. Button1Click (Sender: TObject);
The begin
FrxReport1. ShowReport;
end;

Procedure TForm1. FrxReport1BeforePrint (c: TfrxReportComponent);
Var
Cross: TfrxCrossView;
I, j: Integer;
The begin
If c is TfrxCrossView then
The begin
Cross:=TfrxCrossView (c);
For I:=1 to 16 do
For j:=1 to 16 do
Cross. AddValue ([I], [j], [StringGrid1. Cells [j - I - 1, 1]]).
end;
end;

When will this line of code in the formCreate:
StringGrid1. Cells [] I - 1, j - 1:=IntToStr (I * j); The IntToStr (I * j) into characters (such as' ABC '), complains, prompt string and double can't conversion, what reason be? If I want to achieve in print stringgrid character or let Chinese characters, how to implement? How to change the code? Thank you


CodePudding user response:

Top up, no one answer

CodePudding user response:

Is there a man met a similar problem

CodePudding user response:

Can not ah, I * j is int,,,

CodePudding user response:

IntToStr (I * j); I * j is an integer, so use IntToStr correctly.

For IntToStr (' ABC '), there is a string, so no translation, use IntToStr errors.
  • Related