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

Comments

  • edited 8:27AM
    Here is what I do in the OnPrintReport event of the frReport and then below I show how to view it again.

    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;
  • edited 8:27AM
    ack! it took out all my pretty formating. ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.