Aracılığıyla paylaş


How to: Specify and Distribute Report Output Application Components

When you write and distribute Visual FoxPro applications, you can distribute ReportOutput.app or its component files as part of your applications. In this topic, you learn how to:

  • Distribute the default ReportOutput.app with your applications with appropriate instructions to use the application and an accompanying registry table.

  • Adjust the registry table defaults in ReportOutput.app.

  • Integrate the Report Output Application registry table and other Report Output Application components into your applications without distributing ReportOutput.app.

Using a non-default registry table in an application

If you distribute ReportOutput.App as a separate file from your application, and if you plan to distribute the registry table externally, the table can have any name.

To include code designating a registry table with a non-default name for the default ReportOutput.app

  1. Create a new registry table on disk. For more information about creating the table, see How to: Specify an Alternate Report Output Registry Table.

  2. Edit the table with records suitable for your application. For more information, see How to: Register Custom ReportListeners and Custom OutputTypes in the Report Output Registry Table.

  3. Store the name and location in which you are distributing ReportOutput.app to the _REPORTOUTPUT System variable, either in the CONFIG.FPW file for your application or in your setup code. For more information, see Setting Configuration Options at Startup.

    _ReportOutput = <your ReportOutput.app file name and location>
    
  4. Include code similar to the following during setup code in your application:

    #DEFINE OUTPUTAPP_CONFIG_READ -200
    DO (_REPORTOUTPUT) with OUTPUTAPP_CONFIG_READ, ;
       <your registry table file name and location>
    

Changing ReportOutput.app's default registry table information

You can distribute a recompiled copy of ReportOutput.app with different default registry table names to suit your application.

To recompile ReportOutput.app with different default registry filenames

  1. Expand the ReportOutput subfolder in the zip file located in Visual FoxPro's Tools\Xsource folder. For more information about Xsource, see XSource Folder.

  2. Navigate to the folder in which you expanded the ReportOutput component source files. Modify the ReportOutput.H (header) file.

    CD <your source folder>
    MODIFY COMMAND ReportOutput.H
    
  3. Locate the following two lines of code in the header file:

    #DEFINE OUTPUTAPP_INTERNALDBF   "_ReportOutputConfig"
    #DEFINE OUTPUTAPP_EXTERNALDBF   "OutputConfig"
    
  4. Edit the value "OutputConfig", replacing it with the name of the table (.dbf) you want your application to use as a default value for finding the table on disk. Edit the value "_ReportOutputConfig", replacing it with the name of the table you want your application to use as a default value for finding the table built into your application, if it does not first locate a table with the default name on disk.

  5. Save your changes.

  6. Rebuild the ReportOutput.App file, being sure to use the RECOMPILE switch:

    BUILD APPLICATION ReportOutput FROM ReportOutput RECOMPILE
    
  7. If you have changed the value in OUTPUTAPP_INTERNALDBF, the build process should automatically build in the table you specified and create the appropriate reference in your project. Locate the table for the Project Manager, during the build process, if it asks you to find the table.

  8. Store the name and location of your new ReportOutput.app to the _REPORTOUTPUT System variable, either in the CONFIG.FPW file for your application or in your setup code. For more information, see Setting Configuration Options at Startup.

    _ReportOutput = <your ReportOutput.app filename and location>
    
  9. Distribute the new ReportOutput.App file with your applications. Include an appropriate registry table to match the file name you chose, either built into the application or on-disk.

Building Report Output Application components directly into your application

If you distribute Report Output Application components into your application file (.app or .exe), the registry table can have any name, whether you distribute the table internally or externally. This section shows you how to build the components into your project and application files.

Tip

You do not need to distribute the ReportOutput.App file externally with your application if you follow this procedure.

To include a registry table and Report Output Application components in your application (.app or .exe) file

  1. Include code similar to the following during setup code in your application to build the Report Output Application components into your application:

    * make sure that the main program of the 
    * Report Output Application is included 
    * in your project:
    EXTERNAL proc frxoutput.prg
    
    * make sure that the registry table is
    * also included, if you plan to build it in
    * to the application file:
    EXTERNAL TABLE MyConfig
    
  2. In your application setup code, designate the main program of the default Report Output Application

    * set the value of the _REPORTOUTPUT 
    * system variable to the main program of
    * the default Report Output Application:
    _REPORTOUTPUT = FULLPATH("frxoutput.prg")
    
  3. In the application setup code, designate the appropriate registry table as described in the last section. You do not need to include a path if you build the registry table into the application:

    * designate the appropriate registry table:
    #DEFINE OUTPUTAPP_CONFIG_READ -200
    DO (_REPORTOUTPUT) with OUTPUTAPP_CONFIG_READ, "myconfig" 
    
  4. Rebuild your application. Because you have included the main program of Report Output Application, the other required components should be automatically built into your application by the build process. During the build process, locate any files requested by the Project Manager.

  5. Your application is now ready to use the built-in Report Output Application files and your custom registry table:

    * the following line will look for an class
    * to instantiate using your registry table. 
    * It will throw an error if no appropriate
    * record exists in the registry table:
    REPORT FORM <your report> OBJECT TYPE 993
    
    * the following line will look for a class
    * to instantiate using your registry table.
    * It will use Report Output Application's 
    * built-in default values if no appropriate
    * record exists in the registry table:
    REPORT FORM <your report> OBJECT TYPE 5 
    
    * the following lines of code causes Visual FoxPro
    * to automatically ask Report Output Application
    * for a ReportListener-derived object of 
    * TYPE 1 (print).  Your registry table
    * will be used to find a class of the appropriate
    * type, and Report Output Application's defaults
    * will be used if the table has no records 
    * designating a class for this type:
    SET REPORTBEHAVIOR 90
    REPORT FORM <your report> TO PRINT
    

See Also

Reference

_REPORTOUTPUT System Variable

Including Report Files for Distribution