logo
small logo
  • Products
  • Buy
  • Support
  • About
  • Customer panel Support
    • en
    • de
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • How to make report inheritance in FastReport.NET
  • Copying report bands to another with all the contents

    March 31, 2021

    Sometimes there is a need to use parts of one report in another. In simple

    read more
  • FastCube - High-Speed OLAP Cube Engine and Pivot Grid

    February 29, 2020

    It is difficult to imagine data analysis without OLAP (On-Line Analytical Processing) technology. Although there

    read more
  • Reports and PDF documents in Blazor

    April 5, 2021

    Microsoft has recently launched a web platform called Blazor. This framework allows creating an interactive

    read more
  • How to install FastReport Business Graphics .NET

    August 18, 2021

    This article shows how to install FastReport Business Graphics .NET on your computer and how

    read more
  • Report generators family FastReport brief review

    March 23, 2020

    Without reporting it is impossible to carry on business in any sphere of life. Bureaucracy

    read more

How to make report inheritance in FastReport.NET

January 29, 2021

When you are tasked with creating a large number of reports within one corporate style, you face the problem of duplicating some information, design styles in each report. As a rule, public reports (documents) in a company have the same header with name and contact information. Let's say you have 50 templates with the same header. But the company address changes and you need to open each template in the editor and correct it. But if there are not 50 templates, but 100, it's a real headache.

Avoiding this problem is helped by the inheritance mechanism, where you have a template that can be used in different reports. Changes to this template will appear in all inherited reports.

Report inheritance in FastReport.NET is organized as follows. You start by creating a so-called base report from which you inherit others. This report should contain a template with information common to all inherited reports. For example, it can be a header with the company details.

As mentioned above you can modify the base report template and then it will change in all the legacy reports. But you can also edit the information from the base report in the legacy report. These changes will only be saved in that particular report.

But what if you have modified an object from the base report in an inherited report and then modified the same object in the base report. In this case, the changes from the base report will be applied to that object, but only those that do not overlap with the changes in the legacy report. For example, if you change the font in a text object in an inherited report, and then set bold spelling for the same object in the base report, both changes will be applied. And if you change the font in the base report too, it will not be reflected in the legacy report, as it has already been changed in it.

It is also worth bearing in mind the restrictions on inheriting the report. You may not:

  1. Delete and move the base report, otherwise all inherited reports will be damaged.
  2. Inherit a report from another inherited report. That is, multiple inheritance is not allowed.
  3. Use script, report parameters, "Table" object and "Matrix" object in the base report.

Now let's look at an example of creating an inherited report. First you need to create a basic report.

For example, it will contain a report template with the title:

FastReport.NET

Save this report with a name containing base, so that it is easier to find amongst the other report templates.

To create a legacy report you need to use the legacy report wizard. This is available either in the welcome screen or in the new report window (File->New):

FastReport.NET

The Legacy Report Wizard will only offer you one action - select the base report using the Open File dialog box. Select the base report you have previously created. All elements of the report have a padlock icon. This means that they are inherited from the base report. 

FastReport.NET

Newly added objects will no longer have this icon. Add a data source to our report and place the fields on the "Data" band. For example, you can use the demo data source nwind.xml from FastReport.NET:

FastReport.NET

From the data source we select the Categories and Products tables. These tables are linked by key and so we can easily create a Master-Detail report:

FastReport.NET

As you can see, the added data fields and the Header and DetailData bends do not have a padlock icon. You can always tell the difference between the legacy report objects and the baseline report by this feature.

This way you can create a large number of reports in a single style, and then easily edit them all by changing only the basic template.

about product buy
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET FastReport

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Extended licensing
  • Contact us

© 1998-2023 by Fast Reports Inc.

  • Privacy Policy