Hi, I'm wondering if I'm barking up the wrong tree here. I'm trying to recreate the document generation process in a legacy application using LazReports to generate the repeating content (the data bands), and using the generated report as a section of the more complex document. The legacy system's document generator appears as a word processor with the ability to insert sections which may be headers, footers, or report bands, along with a few additional features.
I've been checking out the export filters in LazReports, trying to use the ExportTo function to load a the report output into a TStream. From there, loading the report output into a RichText or RichMemo (TKMemo, currently) during runtime.
So far however, the frExportFilter option for writing to a TStream doesn't seem to do anything.
The code below compiles and runs, but nothing gets displayed in the TKMemo object I'm trying to load.
Thanks for any suggestions you might have.
procedure TForm1.Button2Click(Sender: TObject);
var
txtStream: TStringStream; //I've tried Memory, File, and StringStreams, all with the same result
begin
AppDirectory := ExtractFilePath(ParamStr(0));
frReport.LoadFromFile(AppDirectory+'Charges.lrf');
frReport.PrepareReport;
frReport.ShowReport; //Added this line just to ensure the report did get generated
txtStream := TStringStream.Create;
frReport.ExportTo(TfrExportFilter,txtStream) ;
txtStream.Position := 0;
try
Page1.Blocks.LoadFromRTFStream(txtStream);
finally
FreeAndNil(txtStream);
end;
end
//Page1 is a TKMemo, in case it matters.