Let's create a simple report that uses inheritance. Our finished report should look like this:
First the base report has to be created. Which elements must it contain? They are the logo bitmap, "Our company" title and email address. Create a new report and place the common objects in the “ReportTitle”:
Save the report as "base.fr3". In which folder? This depends on how you setup the “TfrxDesigner” component. By default FastReport searches for base reports in the folder that contains the application's .exe file. Alternatively a folder for templates can be specified in the “TfrxDesigner.TemplateDir” property.
Now create the derived report. To do this use “File > New”, select the “Templates” tab in the dialogue and search for the base report ("base.fr3"). Click the "Inherit the report" checkbox and press OK:
FastReport will create a report containing all of the objects from the base report. They are tagged with the "lock" symbol:
What does "lock" symbol mean? It means that these objects cannot be renamed or deleted, nor can they be moved to another band. Changes to any other property (such as text, color or frame) can be made. Note that if you change some property of a locked object (for example color) this change will be stored in the derived report. If you subsequently change the color of this object in the base report the change will be ignored by the derived report. For example: open the derived report, change the color of "Our company" to red and save the report. Now open the base report and set the color for "Our company" to green. When the derived report is opened again the color of "Our company" is still red. It is therefore preferable to change the properties of objects having the "lock" symbol back in the base report and not in the derived report.
Let's finish our report. All that is needed is to add page header and master data bands:
And the report is finished.
|