How to: Specify and Distribute ReportPreview.App

When you write and distribute Visual FoxPro applications, you will probably want to allow your users to preview reports on screen. If you wish to leverage the new object-assisted report engine to preview reports in your application, then you must choose whether to:

In this topic, you will learn how to redistribute the ReportPreview.App, the default Preview Container factory application, in two ways:

  • A separate App file alongside your own application.

  • An integrated source directly into your own application.

Redistributing ReportPreview.App with Your Application

By default, if ReportPreview.App exists in the same directory as the Visual FoxPro run time files, then _REPORTPREVIEW will contain the fully-qualified path and file name. One solution is to ensure that the setup program used to distribute your application places ReportPreview.App in the same directory as the run time files. Alternatively, you can distribute ReportPreview.App in the same directory as your application, providing you explicitly set _REPORTPREVIEW to that copy of the file.

To distribute ReportPreview.App with your application

  • In the main program of your application, use code similar to the following:

    * Get the application's home directory:
    cHomeDir = CURDIR()  && use whatever method you prefer
    * Set the system variable to use the fully-qualified path:
    _REPORTPREVIEW = m.cHomeDir+"ReportPreview.App"
    :
    

You could also use a line in CONFIG.FPW:

_REPORTPREVIEW=<path>\ReportPreview.App

Integrating the Preview Container Factory Source into Your Project

Instead of distributing the compiled application, you may choose to incorporate the source code of the report preview factory directly into your application's project.

To integrate the preview container factory source into your application

  1. Unpack the xsource.zip file found in the Tools\xsource\ folder under the Visual FoxPro home directory.

  2. In the main program of your application, use code similar to the following:

    * Ensure the report builder source is pulled into the project:
    EXTERNAL PROCEDURE frxpreview.prg
    * Set the system variable to use the local source version:
    _REPORTPREVIEW = "frxpreview.prg"
    :
    
  3. Rebuild your project.

    The preview factory source code files will be added to your project and compiled in to your application.

Shared Source Files

ReportBuilder.App and ReportPreview.App have the following source files in common:

  • frxControls.vcx

  • frxCommon.prg

  • grabber.gif

  • wwrite.ico

  • foxpro_reporting.h

The Project Manager builds only one copy of each of these files into your application's project, depending on the order of the EXTERNAL statements in your main program.

See Also

Tasks

How to: Specify and Distribute Report Output Application Components
How to: Specify and Distribute ReportBuilder.App

Reference

_REPORTPREVIEW System Variable
Including Report Files for Distribution

Concepts

Application Distribution Process