Custom-Print Link Step 3: Set the output destination
Example
PEOutputToWindow (job, ReportTitle, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, 0, NULL);
Description
The Crystal Report Engine must know where to send the final report. The report can be printed to a printer, displayed in a preview window, exported to a disk file, exported to another database, or exported to an e-mail address. The example above sends the report to the preview window.
Although you can choose any of the several destinations for report output, you must establish a destination for the report to print. You can, however, write code in your application that allows your users to decide on a destination themselves.
Note: This step does not actually print the report, it only establishes a destination for the report when printed. The report is actually printed in Step 4 using the PEStartPrintJob function.
The following functions are available to establish a print destination:
- PEOutputToWindow
Printing a report to a window requires no other print destination code other than the function itself.
- PEOutputToPrinter
Printing a report to a printer requires no other print destination code other than the function itself. However, PESelectPrinter, can be used to select a printer other than the default printer at runtime. The PESelectPrinter function uses the Windows structure DEVMODE. For more information on this structure, refer to the Windows SDK.
- PEExportTo
The PEExportTo function works with the PEExportOptions Structure and several DLLs that control a report's export destination and format. The information required by PEExportTo can be set in your code at design time or it can work with options in your application to allow a user to specify export destination and format. If you would like to allow your users to set the destination and format of a report file, but you do not wish to program the interface to do this, use the PEGetExportOptions function to have the Crystal Report Engine provide dialog boxes that query the user for export information at runtime.