How to save prepared Reports to Database
I have a requirement to archive daily reports which my application produces. I need to maintain an archive of these reports. Currently I am storing all the prepared reports in .frp files.
Is there an easy way to store these prepared reports in a database in such a way that they can be easily accessed by Fast Reports.
I know that Fast Reports has functionality to easily store the report template (.frf) files.
How can I do the same with the prepared report files.
Any info is appreciated
Thanks
Conor
Is there an easy way to store these prepared reports in a database in such a way that they can be easily accessed by Fast Reports.
I know that Fast Reports has functionality to easily store the report template (.frf) files.
How can I do the same with the prepared report files.
Any info is appreciated
Thanks
Conor
Comments
tblPrintoutLogPRINTOUT is a TBlobField.
We use deflate from the Abbrevia (turbopower) to compress it.
procedure TDataModuleMain.frReportPrintReport;
var
blobStream : TFFBlobStream;
memStream : TMemoryStream;
dt : TDateTime;
begin
if NOT FR_Class.ErrorFlag then
begin
tblPrintoutLog.Append;
memStream := TMemoryStream.Create;
blobStream :=
TFFBlobStream(tblPrintoutLog.CreateBlobStream(tblPrintoutLogPRINTOUT,
bmReadWrite));
try
frReport.EMFPages.SaveToStream(memStream);
memStream.Position := 0;
Deflate(MemStream, BlobStream, nil);
tblPrintoutLog.Post;
finally
blobStream.Free;
memStream.Free;
end;
end;
end;
To view it again:
procedure TDataModuleMain.PreviewReportFromLog();
VAR
blobStream : TFFBlobStream;
memStream : TMemoryStream;
begin
blobStream :=
TFFBlobStream(tblPrintoutLog.CreateBlobStream(blPrintoutLogPRINTOUT,
bmRead));
memStream := TMemoryStream.Create;
try
Inflate(BlobStream, memStream, nil);
memStream.Position := 0;
frReport.EMFPages.LoadFromStream(memStream);
frReport.ShowPreparedReport;
finally
blobStream.Free;
memStream.Free;
end;
end;