The End User Designer which is a part of the professional edition of ActiveReports 8, allows you to host the report designer in your own Windows Forms applications and allow your end users to create and modify their own reports. You can find the article from our documentation – Basic End User Designer – with information about creating a basic End User Designer (referred to as EUD hereafter). This article is trying to showcase some additional functionalities – like adding a sub report without writing any code – that you add to your implementation of End User Designer.
The good thing with ActiveReports is that it already provides samples demonstrating and talking about different functionalities available in the product and the EUD. A user can use all the report features in the EUD; however using a subreport in the EUD is a non-trivial task as there is no option to create multiple reports simultaneously. In addition to this if we want to use a subreport in the EUD, then a lot of script code is required to achieve the desired results. The complexity increases as the report layout for the subreport has to be saved on the disk to be used later. A typical code example can be found in the article - Script for Subreports - from the documentation. In this article, I would like to present an enhanced version of the End User Designer (using the shipped sample) which allows creating and using subreports without writing a single line of code. This will enable us to save the report layouts in memory, which will be added to a list present in the toolbar. The image below will make it clearer: Finally when we are done with the creation of report layouts for the subreport and drag a subreport control to the main report, we will have an option to select report for the subreport either from the list of reports which we added or specify it from a physical location. The next image provides a better idea about this:
Though it sounds pretty straightforward but there are lots of things which need to be considered when approaching it. Let us find out what it takes to achieve this functionality:
Once all the steps have been completed, we should be ready to use the design reports using subreports in the End User Designer. If it sounds too complex then you should take a look at the – Enhanced – End User Designer – sample application where I have demonstrated how to incorporate all the above mentioned steps. To make it clearer, I have divided the additional code (apart from the code which is already present in the shipped End User Designer sample) into different sections. I hope this would help users to design their reports quickly and effectively. P.S: The sample application currently uses ActiveReports 7 references, so that anyone using ActiveReports 7 can also use it.