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

collate problem?

edited January 2004 in General
I have set the report to 2 copies (pplist.PrinterSetup.Copies:=2).

I code the startpage event as:
procedure Tfrm_schdr1.pplistStartPage(Sender: TObject);
begin
inherited;
if pplist.SecondPass and (pplist.AbsolutePageNo = 1) then
Inc(FCopy);
end;

Problem:
1. If I set pplist.PrinterSetup.Collation:=false, the Startpage procedure
will do twice by the breakpoint analysis => my report is ok
2. If I set pplist.PrinterSetup.Collation:=true, the Startpage procedure
will do only once => my report is wrong.

Pls. help
Benson.
D5, RB6.03 pro

Comments

  • edited January 2004
    Benson,

    I'm a bit unclear about what you are trying to accomplish with the code in
    the StartPage Event. When you set Collation to True, will the report print
    two copies or just one total? Try printing your report without the use of
    the StartPage event and see if that works. This may be the problem area.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    > I'm a bit unclear about what you are trying to accomplish with the code in
    print
    The coding in StartPage event is referenced from
    "UniqueCaptionForEachCopy.pas", which is downloaded from digital-metaphors.

    Restate question again:
    When I set collation to false, the Startpage procedure fires twice and the
    report prints 2 copies of output with correct Fcopy value.
    When I set collation to true, the Startpage procedure fires once and the
    report prints 2 copies of output. But the variable FCopy=1 which cause my
    report errors.

    I will test it again in this area
    Benson.

    procedure
  • edited January 2004
    Hi Benson,

    In my testing, turning Collation off (False) causes the Report.OnStartPage
    to only fire once per page. If I turn Collation on (True) then OnStartPage
    fires once for every page including the copied pages. Regardless, it is not
    a good idea to be using the Report.OnStartPage event when dealing with the
    printer. I would suggest trying to use the Device.StartPage event as an
    alternative.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Sorry, I cannot find where is Device.StartPage? Should I need

    Pls. help

    Benson.


  • edited January 2004
    Hi Benson,

    You can access the TppPrintDevice from the Report.Publisher.Devices
    property. From the printer device, you can assign the OnStartPage event

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Thanks for your advice. But
    1. I cannot find ppReport.Publisher.Devices.onstartpage or
    ppReport.Publisher.Devices.startpage?
    2. Can I find this event in the object inspector?
    3. If the event is not in the object inspector, then should I code a event
    myself and assign it to ppReport.Publisher.Devices.onstartpage?

    Benson.


  • edited January 2004
    Hi Benson,

    Sorry, my mistake. To access the printer device, you first need to check in
    the Report.BeforePrint that the PrinterDevice is not nil. Then you can
    access it through the Report.PrinterDevice property. From here you can
    assign the OnStartPage event. The TppPrinterDevice will only be created
    when you print to the printer, this is why you need to check if it is nil
    first.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Yes, I found it. But

    I have code this procedure:
    procedure pplistprinterDeviceStartPage(aPage: TppPage);

    and then assign it to:
    pplist.printerDevice.OnStartPage:=pplistprinterDeviceStartPage;

    and the actual procedure:
    procedure Tfrm_schdr1.pplistprinterDeviceStartPage(aPage: TppPage);
    begin
    if pplist.SecondPass and (pplist.AbsolutePageNo = 1) then
    Inc(FCopy);
    end;

    Compile error:
    Incompatiables type: Tobject and TppPage;

    Pls. help.
    Benson.


  • edited January 2004
    Hi Benson,

    I believe the OnStartPage event needs a TObject in its declaration as the
    sender for the event.

    OnStartPage(Sender: TObject; aPage: TppPage);

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Sorry, I still cannot get it, pls. help!

    I have coded this procedures as follows:

    procedure pplistprinterDeviceStartPage(Sender: TObject; aPage: TppPage);

    procedure Tfrm_report1.pplistBeforePrint(Sender: TObject);
    begin
    inherited;
    FCopy:=0;
    if pplist.PrinterDevice<>nil then
    begin
    pplist.printerDevice.OnStartPage:=pplistprinterDeviceStartPage;
    end;
    end;

    procedure Tfrm_report1pplistprinterDeviceStartPage(Sender: TObject; aPage:
    TppPage);
    begin
    if pplist.SecondPass and (pplist.AbsolutePageNo = 1) then
    Inc(FCopy);
    end;

    Compile error:
    Incompatiables type: Tobject and TppPage;

    Benson

  • edited January 2004
    Sorry, my fault again. Both objecs being sent to the OnStartPage event
    should be TObjects.

    ppListPrinterDeviceStartPage(Sender: TObject; aPage: TObject);

    --
    Best Regards,

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