unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, frxClass;type
TForm1 = class(TForm)
frxReport1: TfrxReport;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
begin
frxREPORT1.FindObject('MEMO1').MEMO.Text:='图书目录';
frxReport1.ShowReport(true);
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, frxClass;type
TForm1 = class(TForm)
frxReport1: TfrxReport;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
begin
frxREPORT1.FindObject('MEMO1').MEMO.Text:='图书目录';
frxReport1.ShowReport(true);
end;end.
第一步:在报表设计器中为报表增加变量,report菜单--variables,点category,为新变量命名为var1,然后在报表中加入text object,点插入表达式(insert expression),点variables页面,双击刚才新建的变量var1,然后退出就行了(也可在文本框的内容中直接输入[var1])。
第二步:在uses中加入frxvariables单元,然后:
frxreport1.loadfromfile(报表名);
frxreport1.variables.clear;
frxreport1.variables['var1']:='字符串';
frxreport1.showreport;这样动态替换文本框的值绝对没问题的~~~~