蓝
蓝叶菱
Unregistered / Unconfirmed
GUEST, unregistred user!
预览报表,使用frPreview,rmPreview装载报表文件,frp,rmp,居然需要装载个默认的模板文件rmf,frf,这怎么行。。。
【怎么保存报表文件frp,rmp文件,怎么使用frPreview,rmPreview装载他们呢?】
注:frp,rmp分别是fastreport/Reportmachine的报表结果文件,frf,rmf分别是他们的模板文件,本题是要求保存结果文件和预览结果文件的方法。
我做的根本什么也看不到!
frreport2关联frPreview,frReport1不关联
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_Class, StdCtrls, Buttons, ExtCtrls, FR_View;
type
TForm1 = class(TForm)
frReport2: TfrReport;
Panel1: TPanel;
frReport1: TfrReport;
btnSave: TBitBtn;
ed_Title: TLabeledEdit;
btnLoad: TBitBtn;
BitBtn1: TBitBtn;
ScrollBox1: TScrollBox;
frPreview1: TfrPreview;
procedure btnSaveClick(Sender: TObject);
procedure btnLoadClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function AppPath:String;
begin
Result:=ExtractFilePath(ParamStr(0))+'/';
end;
procedure TForm1.btnSaveClick(Sender: TObject);
begin
frReport1.LoadFromFile(AppPath+'Demo1.frf');
frReport1.ShowProgress:=False;
frVariables['RTitle']:=ed_Title.Text+DateToStr(now);
frReport1.ShowReport;
//frReport1.Preview.SaveToFile(AppPath+'Demo1.frp');
//这里保存的根本不是报表结果文件,只是报表模板文件啊。。。
//ShowMessage('完毕了!');
end;
procedure TForm1.btnLoadClick(Sender: TObject);
begin
frPreview1.LoadFile(AppPath+'Demo1.frp');
frPreview1.LoadFromFile;
frPreview1.Show;
ShowMessage('看见了什么没有啊?');
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
frReport2.LoadFromFile(AppPath+'Demo2.frp');
frPreview1.LoadFromFile;
//frReport2.ShowProgress:=False;
frReport2.ShowReport;
//还是也看不见!!!!
end;
end.
【怎么保存报表文件frp,rmp文件,怎么使用frPreview,rmPreview装载他们呢?】
注:frp,rmp分别是fastreport/Reportmachine的报表结果文件,frf,rmf分别是他们的模板文件,本题是要求保存结果文件和预览结果文件的方法。
我做的根本什么也看不到!
frreport2关联frPreview,frReport1不关联
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_Class, StdCtrls, Buttons, ExtCtrls, FR_View;
type
TForm1 = class(TForm)
frReport2: TfrReport;
Panel1: TPanel;
frReport1: TfrReport;
btnSave: TBitBtn;
ed_Title: TLabeledEdit;
btnLoad: TBitBtn;
BitBtn1: TBitBtn;
ScrollBox1: TScrollBox;
frPreview1: TfrPreview;
procedure btnSaveClick(Sender: TObject);
procedure btnLoadClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function AppPath:String;
begin
Result:=ExtractFilePath(ParamStr(0))+'/';
end;
procedure TForm1.btnSaveClick(Sender: TObject);
begin
frReport1.LoadFromFile(AppPath+'Demo1.frf');
frReport1.ShowProgress:=False;
frVariables['RTitle']:=ed_Title.Text+DateToStr(now);
frReport1.ShowReport;
//frReport1.Preview.SaveToFile(AppPath+'Demo1.frp');
//这里保存的根本不是报表结果文件,只是报表模板文件啊。。。
//ShowMessage('完毕了!');
end;
procedure TForm1.btnLoadClick(Sender: TObject);
begin
frPreview1.LoadFile(AppPath+'Demo1.frp');
frPreview1.LoadFromFile;
frPreview1.Show;
ShowMessage('看见了什么没有啊?');
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
frReport2.LoadFromFile(AppPath+'Demo2.frp');
frPreview1.LoadFromFile;
//frReport2.ShowProgress:=False;
frReport2.ShowReport;
//还是也看不见!!!!
end;
end.