Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

output to archive file

edited December 2009 in General
RB 10.07, D7
Is there a way to print to archive file but instead of writing to a file,
write to a memo field in the database? I see the dbArchiveReader component
but do not see anything in help about how to output to archive in db. I am
sure I am missing something simple.

Thanks,
Bob

Comments

  • edited December 2009
    Hi Bob,

    Originally it was up to the you to export to file, stream the file, then
    save it to database. For RB 9, we added the concept of the TppStreamDevice
    which is the ancestor to all file devices and allows you to take out the
    middle step and export directly to a stream, then save to the database.
    Using this ancestor is simple, just assign the OutputSteam property of the
    archive device to a stream of your choice, then PrintToDevices.

    var
    lArchiveDevice: TppArchiveDevice;
    begin

    // create and configure the ArchiveDevice
    lArchiveDevice := TppArchiveDevice.Create(nil);

    if (FOutputStream = nil) then
    FOutputStream := TMemoryStream.Create
    else
    FOutputStream.Clear;

    try
    lArchiveDevice.OutputStream := FOutputStream; // assign output
    stream
    lArchiveDevice.Publisher := ppReport1.Publisher;

    // generate the report
    ppReport1.PrintToDevices;

    finally
    lArchiveDevice.Free;
    end;
    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2009
    Thanks for the info. I will do that. I am having to do this because
    Gnostice eDocEngine does not correctly output RichView text directly.
    However, if you save to archive, open archive and then output using
    eDocEngine it handles the RichView correctly. This is the only problem I
    have found with eDocEngine but hopefully they can get it resolved.

    Report Builder is awesome. Been using for many years and continue to learn
    new things about it.

    Thanks,
    Bob
  • edited December 2009
    Nico,

    I am successfully saving to DB. But I am immediately using ppViewer and
    ppDBArchiveReader to load back in from DB to output via eDocEngine.

    Is there a way to load ppArchiveReader and / or ppViewer with archive from
    Stream?

    This would save me from even having to write to DB at all.

    Thanks,
    Bob
  • edited December 2009
    Hi Bob,

    Yes, the TppArchiveReader does allow loading an archive directly from a
    stream. Simply assign the TppArchiveReader.ArchiveStream to the stream
    created by your application and print.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2009
    Can you give me a code sample? I can't seem to get a valid property or
    component for ppARchiveReader1.ArchiveStream. ArchiveStream doesn't seem to
    work for me. I am using RB 10.07.

    Thanks,
    Bob

  • edited December 2009
    Hi Bob,

    I'm sorry, I forgot that you were using RB 10. The ArchiveStream property
    was added for RB 11. To take advantage of this feature, please consider
    upgrading your version of ReportBuilder.


    //Export file to Stream
    procedure TForm1.Button1Click(Sender: TObject);
    var
    lArchiveDevice: TppArchiveDevice;
    begin

    // create and configure the ArchiveDevice
    lArchiveDevice := TppArchiveDevice.Create(nil);

    if (FOutputStream = nil) then
    FOutputStream := TMemoryStream.Create
    else
    FOutputStream.Clear;

    try
    lArchiveDevice.OutputStream := FOutputStream; // assign output
    stream
    lArchiveDevice.Publisher := ppReport1.Publisher;

    // generate the report
    ppReport1.PrintToDevices;

    finally
    lArchiveDevice.Free;
    end;


    end;

    //Read and print the stream
    procedure TForm1.Button2Click(Sender: TObject);
    begin
    ppArchiveReader1.ArchiveStream := FOutputStream;
    ppArchiveReader1.Print;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2009
    If I purchase version 11 now, will I have to pay more when 11.07 is
    realeased or will I that be a free upgrade?

    Thanks,
    Bob

  • edited December 2009


    Free.

    The RB 11.x maintenance releases are free to all RB 11 registered users.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2009
    Thanks for the help. I upgraded to version 11 which supports the
    ArchiveStream property. This allowed me to get around the Gnostice issue by
    outputing the report to archive stream and then reading in archive stream
    and then exporting.

    Thanks
    Bob Tucker

This discussion has been closed.