Home General

How to free a report when done?

edited October 2001 in General
How do I free a report after previewing it with the viewer? I set a
breakpoint in my ReportAfterPrint event and it never gets called. I think
I'm leaking memory (or at least not freeing the last preview) because I
don't know how to stop the report once the user is done previewing. My
viewer just shows up on a form that has other components on it. I'm not
using the standard previewer or a custom descendant.

Comments

  • edited October 2001
    You can call TppViewer.Cancel and then you should be able to free the report
    after the call to PrintToDevices.
    ...
    ppReport1.PrintToDevices;
    if ppReport1.Engine.StopPrinting then
    ppReport1.Free;
    ...

    Report.AfterPrint event

    Description

    This event fires after the print process has been completed. When printing
    to the printer or to the file, AfterPrint fires after the print job has been
    closed or after the file has been closed. When printing to the screen,
    AfterPrint fires after the Print Preview form has been closed.

    Note: BeforePrint, AfterPrint, and OnPrintingComplete fire only when the
    Print method is used to print the report.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.