在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, frxClass, frxDesgn; type TForm1 = class(TForm) btn1: TButton; frxReport1: TfrxReport; edt1: TEdit; edt2: TEdit; frxReport2: TfrxReport; btn2: TButton; frxDesigner1: TfrxDesigner; procedure frxReport2GetValue(const VarName: string; var Value: Variant); procedure btn1Click(Sender: TObject); procedure btn2Click(Sender: TObject); procedure frxReport2BeforePrint(Sender: TfrxReportComponent); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin frxReport2.Clear; frxReport2.LoadFromFile('1111.fr3'); frxReport2.showReport; end; procedure TForm1.btn2Click(Sender: TObject); begin frxReport2.DesignReport; end; procedure TForm1.frxReport2BeforePrint(Sender: TfrxReportComponent); var memo1 : TfrxMemoView; begin //给变量赋值的第一方式 frxReport2.Variables.Variables['EDIT1'] := QuotedStr('abc'); //给控件赋值的一种方式 Memo1 := frxReport2.FindObject('Memo1') as TfrxMemoView; memo1.Text := 'ABCDEFG'; end; procedure TForm1.frxReport2GetValue(const VarName: string; var Value: Variant); begin //给变量赋值的第二方式 // if CompareText(VarName, 'edit1') = 0 then // Value := edt1.Text; if CompareText(VarName, 'edit2') = 0 then Value := edt2.Text; end; end. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论