Save report
I created an table in database Firebird to save report??s (*.FRF) in field
kind BLOB. The problem is that it save just half of the report and when
i load again it show message of the error...
Anybody know if i can save the report how ASC? I think that it save kind
STREAM, but give error above...
thanks
kind BLOB. The problem is that it save just half of the report and when
i load again it show message of the error...
Anybody know if i can save the report how ASC? I think that it save kind
STREAM, but give error above...
thanks
Comments
first is the table structure to save the .frf file
firstfield must be integer "repid",2nd field must be a blobfield "repdef" another fields can follow.
you must hook into the designer components onsave event as described in faq.txt file.
You will probably reed to create a customdialog to handle the choice of overwriting an existing report record or creating a new one.
procedure TForm1.frDesigner1SaveReport(Report: TfrReport;
var ReportName: String; SaveAs: Boolean; var Saved: Boolean);
begin
if SaveAs then
with saverepdlg do
begin
Saved := ShowModal = mrOk;
if Saved and not bloverwrite then
begin
repdm.TblRepdef.active := true;
repdm.tblrepdef.edit;
repdm.tblrepdef.insert;
repdm.TblRepdefrepid.value := intrepno +1;
repdm.TblRepdefDescription.Value := strrepname;
Report.SaveToBlobField(repdm.tblrepdefrepdef);
ReportName := strrepname;
repdm.TblRepdef.Post;
form1.blrepsaved := true;
end;// end ifsavedand not overwrite
if saved and bloverwrite then
begin
repdm.TblRepdef.active := true;
repdm.TblRepdef.FindKey([intrepno]);
repdm.TblRepdef.edit;
repdm.tblrepdefrepdef.clear;
Report.SaveToBlobField(repdm.tblrepdefrepdef);
repdm.TblRepdefDescription.Value := strrepname;
repdm.TblRepdef.Post;
form1.blrepsaved := true;
end;
end
else
showmessage('save cancelled');
repdm.TblRepdef.Active := false;
end; // endpro
some database engines may require a blob column.
to load and display report
procedure TForm1.Button1Click(Sender: TObject);
begin
repdm.TblRepdef.Active := true;
frreport1.clear;
frreport1.FileName := repdm.TblRepdefDescription.value +'.frf';
frreport1.LoadFromBlobField(repdm.tblrepdefrepdef);
frreport1.showreport;
end;
hope this helps
regards
gord