Question
“Is is possible to export an archive directly to a memory stream?”
Solution
Starting with ReportBuilder 9, it is possible to use the TppStreamDevice.OutputStream property to export a report directly to a memory stream. Note that you will need to create and manage the string yourself once you take control of it.
Download: ArchiveToStream.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
procedure TForm1.FormCreate(Sender: TObject); begin FOutputStream := TMemoryStream.Create; end; procedure TForm1.Button1Click(Sender: TObject); var lArchiveDevice: TppArchiveDevice; begin FOutputStream.Clear; lArchiveDevice := TppArchiveDevice.Create(nil); lArchiveDevice.OutputStream := FOutputStream; lArchiveDevice.Publisher := ppReport1.Publisher; ppReport1.PrintToDevices; lArchiveDevice.Free; end; |