Share via


How to: Preview Reports

You can view a report in a preview window before sending it to an output destination.

Note

The actions discussed in this topic have different results, depending on the setting of REPORTBEHAVIOR. When you use the command SET REPORTBEHAVIOR 90, Visual FoxPro uses a ReportListener object to generate your results through GDI+ instead of GDI. The results of the generation process are sent through a different previewing interface. For more information, see SET REPORTBEHAVIOR Command and _REPORTPREVIEW System Variable.

To preview a report

  1. Open the report or label in the appropriate designer.

  2. On the View menu, click Preview.

    The preview window and Print Preview toolbar open so you can navigate the report.

  3. To navigate the preview window, you can perform the following using the Print Preview toolbar:

    • To browse the report, click First Page, Previous Page, Go to Page, Next Page, or Last Page.

    • To change the size of view, choose a zoom level.

    • To print the report, click Print.

    • To return to design mode, click Close Preview.

      Warning

      When you close the preview window, you might be prompted to save your changes to a file. If you receive this prompt, the selection you made not only closes the preview window but also the report layout file. To return to preview mode, click Cancel. To save your changes, and close the preview window and report layout file, click Save. To leave the changes to the layout unsaved, click No.

To preview a report programmatically

  • Use the REPORT FORM or LABEL FORM command with the PREVIEW clause.

For more information, see REPORT FORM Command and LABEL Command.

For example, the following code displays the report in a modal preview window:

REPORT FORM MyReport.FRX PREVIEW
  • Use the REPORT FORM or LABEL FORM command with the OBJECT TYPE 1 clause to explicitly request object-assisted preview. You can also use an OBJECT reference on the command with a reference to a ReportListener object, and set the object's ListenerType property value to 1:
REPORT FORM MyReport.FRX OBJECT TYPE 1 && preview
* - OR - 
LOCAL loReportListener
loReportListener = CREATEOBJECT("ReportListener")
loReportListener.ListenerType = 1
REPORT FORM MyReport.FRX OBJECT loReportListener

For more information, see ListenerType Property.

See Also

Tasks

How to: Generate Output for Reports
How to: Control Record Selection in Report Output

Reference

ReportListener Object

Other Resources

Running Reports