hi, is it possible to archive a report directly to a memory stream? i know have to dump the archive to a physical file and then move it to the database this is a unnecessairy step and i'm looking to eliminate this process can it be done? tia, marc
RB 10 includes support for generating any of the file output formats directly to stream. There is a StreamDevice class that is the ancestor of FileDevice, so all FileDevice descendant automatically inherited this capability.
Here is a downloadable example of archiving directly to stream:
Comments
RB 10 includes support for generating any of the file output formats
directly to stream. There is a StreamDevice class that is the ancestor of
FileDevice, so all FileDevice descendant automatically inherited this
capability.
Here is a downloadable example of archiving directly to stream:
www.digital-metaphors.com/tips/ArchiveToStream.zip
Here is the code to the example:
procedure TForm1.FormCreate(Sender: TObject);
begin
// create output stream
FOutputStream := TMemoryStream.Create;
// create archive device
FArchiveDevice := TppArchiveDevice.Create(Self);
//assign output stream to archive device, otherwise it will create a file
stream
FArchiveDevice.OutputStream := FOutputStream;
// connect archive device to the report
FArchiveDevice.Publisher := ppReport1.Publisher;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FOutputStream.Free;
FOutputStream := nil;
FArchiveDevice := nil;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FOutputStream.Clear;
ppReport1.PrintToDevices;
ShowMessage('Report completed, archive size is ' +
IntToStr(FOutputStream.Size));
end;
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thx!
i just knew this had to be possible
cu
marc