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

Printing a range of Pages

edited June 2003 in General
Hi,

I don't know whether this problem has been explained before, but I couldn't
find any relevant information. So please accept my apology, if this has
been answered earlier.

My problem, is how do I only print a given range of pages....

Example, if the report is 5 pages long, and I only want to print the 3rd and
4th pages out to the printer, what do I need to do?

Thanks in advance....

Comments

  • edited June 2003
    Tarun,

    Check out Demo #124 in the \RBuilder\Demos\1. Reports\... directory
    (dm0124.pas). This gives a good example of controling the pages sent to the
    printer.

    --
    Best Regards,

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

    As you suggested, I looked at the demo, and did exactly what it does in rhe
    unit (dm0124.pas). I placed the following code in the BeforePrint event:

    if (CapRepBldr.PrinterDevice <> nil) then
    begin

    CapRepBldr.PrinterDevice.PageSetting := psPageList;

    ppTextToPageList('1,1', CapRepBldr.PrinterDevice.PageList, True);
    end;

    but, it doesn't even seem to go in this event, and is printing out all 16
    pages of the report.

    I have overcome similar problems in other software before by just setting
    the StartPage and EndPage property....

    Is there nothing like this in ReportBuilder? If not, maybe, a suggestion
    for future updates?

    Thanks in Advance.





  • edited June 2003
    --------------------------------------------
    Article: Troubleshooting Lost Event Handlers
    --------------------------------------------

    Let's assume you have created a report in Delphi and assign an event
    handlers to the OnPreviewFormCreate event of the report. The event is
    generated by Delphi as:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);

    You then save the report to an RTM file 'Report1.RTM.' The events are
    stored as references only, and so the RTM contains:

    object ppReport1: TppReport
    .
    .
    OnPreviewFormCreate = ppReport1PreviewFormCreate
    end

    You then go on to work on a different report. Saving it with under then
    name 'Report2.RTM'. Only this time, before you save the report you change
    the report component name to: rptOrders. Delphi automatically updates the
    event declaration for OnPreviewFormCreate event to:

    procedure TForm1.rptOrdersPreviewFormCreate(Sender: TObject);


    You then create two buttons on the form, one to load Report1 and preview,
    the other to load Report2 and preview. When you run the app and click
    Report1, you an error. This is because the Report1.RTM file contains a
    reference to ppReport1PreviewFormCreate, a method which no longer exists (at
    least with this name) in the form.

    One answer is to load all your rtm files into the report component you will
    be using for loading. Fix any errors, reassign any events that get cleared.
    This will update your rtms to contain the proper event handler names.



    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.