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

OnPrintingComplete

edited September 2007 in General
Good afternoon to all,
I have this problem :

I use a ppReport and I must to set a boolean variable after the print : the
print and not preview, so I decided to use the event OnPrintingComplete.

When I try it in a empty report (showing message into OnPrintingComplete) I
haven't problems, but when I do the same thing in a report (with calc), seem
that that event isn't called.

Is it possible?
Anyone did have the same problem?

Thank you..

Nicoletta

Comments

  • edited September 2007
    I use DELPHI7 and RB 9.03.

    ty

    "Nicoletta Rottino" ha scritto nel messaggio
  • edited September 2007
    Hi Nicoletta,

    ------------------------------------------
    Tech Tip: Detecting whether Report was
    Printed to the Printer
    ------------------------------------------

    The Report.AfterPrint event can be used to
    determine whether the report was printed
    to the printer (rather than preview, ...).


    Example:


    procedure TForm1.ppReport1AfterPrint(Sender: TObject);
    begin

    if (ppReport1.PrinterDevice <> nil) then
    ShowMessage('Report was printed to the printer');

    end;



    Note: If the user cancels the report while it
    is running, then the Report.OnCancel event will
    fire, followed by the Report.AfterPrint event.

    Example:

    procedure TForm1.ppReport1Cancel(Sender: TObject);
    begin
    ShowMessage('Printing cancelled by user');

    end;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Unfortunately I must use OnPrintingComplete and not AfterPrint, because, in
    preview, when I close the window without print, it called anyway AfterPrint.

    And Also if I use AfterPrint, this event don't be generate.

    I think It so strange the situation : using empty report, it's generated
    OnPrintingComplete event; using a report with calc, no.
    Why?

    Nicoletta

  • edited September 2007
    > Unfortunately I must use OnPrintingComplete and not AfterPrint, because,

    Yes, this is why you check if the Printer Device is not nil. If it isn't,
    the report is being printed to the printer and you can set your boolean
    value.

    In my testing, the AfterPrint event always fires after a report has finished
    printing.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    ok, but is it a mistake use event OnPrintingComplete?

    and why it not called at the end of print?

    NB : I open preview and I print using button in preview.


This discussion has been closed.