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

Number of Pages before Print

edited October 2004 in General
Hello,
I need to create some executive versions of reports, First and last page, so
I need to know how many pages before I print. I am using two pass.

How do I do this? I know i need to use PageList and PageSetting, but how and
when do I get the last page number?

Thanks

Comments

  • edited October 2004
    Hi Todd,

    If you are using a two pass report, you can use the Report.AbsolutePageCount
    property inside the OnStartSecondPass to determine the total amount 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 October 2004
    Then How do I set the report to print only 1st page and Last
    Page(Report.AbsolutePageCount ) at that point before the second pass. The
    second pass sends the pages, correct?, I tried setting the PageList in this
    event and I got an Exception.

    I do not want to call print twice- reports to big

    Thanks


  • edited October 2004
    Hi Todd,

    Sorry, I did not understand the initial question. See Demo 124 located in
    the \RBuilder\Demos\1. Reports\... directory (dm0124.pas) for an example of
    how to print only the pages you define. This example coincidentally prints
    the first and last page of a 30 page report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2004
    My problem is "Before Print" fires before I can get the the last page
    number, In your demo you have 1,30 hard coded for pages to send in the
    "Before Print" event, Is this the only place to set this?

  • edited October 2004
    I no longer get AV when I use the code in "StartSecondPass"

    if (ppReport1.PrinterDevice <> nil) then
    begin
    ppReport1.PrinterDevice.PageSetting := psPageList;
    if ppReport1.AbsolutePageCount > 1 then
    ppTextToPageList('1,'+IntToStr(ppReport1.AbsolutePageCount),
    ppReport1.PrinterDevice.PageList, True) else
    ppTextToPageList('1', ppReport1.PrinterDevice.PageList, True);

    end;

    Thanks for your help

This discussion has been closed.