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

Printing each page to a diferent file

edited December 2004 in General
Hi,

How can I print each page to a diferent RAF file (page1.raf, page2.raf, and
so on) ?

Thanks.

---
Fabio Lindner
Gvdasa Inform?tica Ltda.

Comments

  • edited December 2004
    Hi Fabio,

    Check out demo 123 located in the \RBuilder\Demos\1. Reports\... directory
    (dm0123.pas). This example shows how to send individual pages to the device
    at will.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2004
    Hi Nico,

    Ok, I'll try to adapt the code to send individual pages as RAF.

    Thanks.

    ---
    Fabio Lindner
  • edited December 2004
    Hi Fabio,

    If you set your report to a psTwoPass, you will be able to use the
    AbsolutePageCount to find the total number of pages in your report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2004
    Hi,

    Ok I've changed demo 124 instead to print each page to a individual RAF file
    (see code below).

    Now how can I detect the last page and stop printing ? Demo 124 prints 30
    pages but I can request pages 31 and up w/o exceptions. It prints the last
    page again and again. ppReport.AbsolutePageCount is useless since I allways
    request a single page.

    procedure Tfrm0124.Button1Click(Sender: TObject);
    var
    oDevice: TppArchiveDevice;
    iPageNo: Integer;
    begin
    oDevice := TppArchiveDevice.Create(Self);
    oDevice.Publisher := ppReport.Publisher;
    oDevice.PageSetting := psSinglePage;
    for iPageNo := 1 to 30 do // need to figure out the real page count
    begin
    oDevice.PageRequested := iPageNo;
    oDevice.FileName := Format('page_%d.raf', [iPageNo]);
    ppReport.PrintToDevices;
    end;
    end;

    Any idea ?

    ---
    Fabio Lindner
  • edited December 2004
    Thanks, Nico. I forgot that. It's working now.


    ---
    Fabio Lindner
This discussion has been closed.