Compartir a través de


PrintCachedPages Method

Enables a user to print cached pages in a report run with ListenerType 1 or 3 without closing the preview window.

Object.PrintCachedPages()

Remarks

Object can be any object derived from the _ReportListener base class or its subclasses.

The most common use of PrintCachedPages is to send output to the printer when a user still has a Print Preview window open.

Example

The following code example comes from the ActionPrint method of the frxpreviewform class in the ReportPreview project. This project contains the source code for the default _REPORTPREVIEW application, ReportPreview.app. You can find and modify the source code in the Tools\xsource subfolder of your Visual FoxPro 9.0 installation folder.

if THIS.oReport.commandClauses.NOWAIT
THIS.oReport.PrintCachedPages()
else
* Terminate:
THIS.suppressRendering = .T.
THIS.printOnExit       = .T.
THIS.Release()
endif

Because the ReportPreview application that is included with Visual FoxPro uses PrintCachedPages( ), you can control the behavior of the Print button in the Print Preview toolbar. If you want the Print Preview window to stay open after a user clicks Print, include the NOWAIT clause in your REPORT FORM command, for example:

REPORT FORM (filename) OBJECT oReportListener PREVIEW NOWAIT

If you want the Print Preview window to close when a user clicks Print, do not include the NOWAIT clause in your REPORT FORM command. For example:

REPORT FORM (filename) OBJECT oReportListener PREVIEW

See Also

Tasks

How to: Specify and Distribute ReportPreview.App

Reference

ListenerType Property

_REPORTPREVIEW System Variable