Creating your first report is easy. This example demonstrates how little effort is required to preview a simple "Hello World!" report. It assumes you have VPE and VPE+ installed - but if not, you can still follow the simple nature of this example.

Add the following components to a new VCL project:

Application components

1. TReportInterface provides reporting infrastructure in an application.

Typically, a single ReportInterface is placed in a common DataModule to serve the entire application. It is an interface between the application and Virtual Print Engine (VPE), and all reports are executed through its methods.

2. TReportWriter encapsulates the core VPE component, TVPEngine, providing access to all its functionality.

A separate ReportWriter may be used as the basis of a single report. It is placed locally on the form generating the report. Multiple reports can also share the same ReportWriter - how you organise this is a matter of convenience in each case.

3. The TButton will be used to start the report.

Add the following code to its OnClick event:

procedure TForm1.Button1Click(Sender: TObject);


ReportInterface1.ExecuteReport(ReportWriter1, smPreview);



a) The ReportInterface handles report execution via the ExecuteReport method.

b) The specified ReportWriter provides the core output functionality or report engine for this report.

c) Using SetupMode = smPreview will send the report directly to preview in the default preview form. Find out about other SetupModes.

4. Now add an output statement to the ReportWriters OnGenerate event:

procedure TForm1.ReportWriter1Generate(ReportInterface: TReportInterface; ReportWriter: TReportWriter);


ReportInterface.PrintPos('Hello World!');



a) The ReportInterface provides output methods such as PrintPos which utilise the core report engine of the ReportWriter.

b) The text to output is not qualilfied by specific positional details or font settings in this case, so it will be output using the default font at the default (top-left) position on the page (within the default page margins).

5. Run the application and click Button1... here is the preview:

Report preview