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:
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;