How to Create Professional Reports with FastReport VCL for Delphi 7
If you are a Delphi developer who needs to create reports and documents for your applications, you might be interested in FastReport VCL, a powerful and flexible reporting library that works with Delphi 7 and later versions.
FastReport VCL allows you to design reports visually with a drag-and-drop interface, access data from various sources, including databases, files, web services, and internal datasets, use scripting languages to control the report logic, preview and export reports to more than 30 formats, such as PDF, HTML, RTF, Excel, SVG, and more.
In this article, we will show you how to install FastReport VCL for Delphi 7, create a simple report with a chart and a barcode, and export it to PDF.
Installing FastReport VCL for Delphi 7
To install FastReport VCL for Delphi 7, you need to download the latest version of the library from the official website[^1^]. You can choose between different editions of FastReport VCL, depending on your needs and budget. The Embarcadero RAD Edition is distributed with Embarcadero RAD Studio and has basic features. The Standard Edition has more features, such as a built-in script shell and an end-user report designer. The Professional Edition adds a visual SQL builder and full source code. The Enterprise Edition includes web-reporting components. The Ultimate Edition combines all the features of the previous editions and adds cross-platform solutions with FastCube VCL and FastReport FMX.
After downloading the library, run the setup file and follow the instructions. You will need to select the Delphi version you are using and the components you want to install. You can also choose to install additional packages, such as demos, documentation, and third-party components.
Once the installation is complete, you can open Delphi 7 and start using FastReport VCL.
Creating a Simple Report with FastReport VCL
To create a simple report with FastReport VCL, you need to add a TfrxReport component to your form. This component represents the main report object that contains all the report elements. You can set various properties for this component, such as FileName, Description, ScriptLanguage, PreviewOptions, etc.
To design the report layout, double-click on the TfrxReport component to open the report designer. The report designer is a graphical tool that lets you add and edit report objects on a page. You can use the toolbar to insert different objects, such as texts, pictures, charts, barcodes, cross-tabs, etc. You can also use the object inspector to change their properties.
For this example, we will create a simple report that shows some sales data in a chart and a barcode. To do this:
Add a TfrxDBDataset component to your form and set its DataSet property to point to a table that contains sales data. For example, you can use the Orders table from the dbdemos database that comes with Delphi 7.
In the report designer, add a Data band from the toolbar and set its DataSet property to frxDBDataset1. This band will print one row for each record in the dataset.
Add a Chart object from the toolbar and place it on the Data band. Set its ViewType property to vtPie and its DataBand property to Data1. This will create a pie chart that shows the percentage of each order amount in the total sales.
Add a Memo object from the toolbar and place it on the Data band below the chart. Set its Text property to [Orders.OrderNo]. This will print the order number for each record.
Add a Barcode object from the toolbar and place it on the Data band next to the memo. Set its Text property to [Orders.OrderNo] and its BarType property to bcCode39. This will create a barcode that encodes the order number using Code 39 symbology.
Add a PageHeader band from the toolbar and place it on top of the page. Add a Memo object on this band and set its Text property to \"Sales Report\". This will print a title for the report on each page.
Add a PageFooter band from the toolbar and place it aa16f39245