Printing data with sections
Sections in ReportBro allow to iterate a list of data with more layout options than a table. Elements of a list can be positioned individually rather than in rows. Further, not only text elements but all kinds of elements can be used in a section.In this tutorial you will learn to:
1 Insert a section
Most configuration of a section is done directly on the element. A section always contains a content element, both header and footer are optional. It requires a parameter of type list as a data source.
Access section content, header and footer by clicking the respective element in the menu panel on the left. Both header and footer are only present if enabled.
2 Create a parameter list
Parameters are used to pass data from an application to ReportBro in order to fill the report with dynamic data. Sections require a parameter of type list as a data source.
Let's assume we have an online shop and we want to print delivery labels for our packages. Every label contains the recipient's address data and a bar code to track the package for the delivery company.
Let's create the parameter list:
Inside this list add the following parameters which specify the fields of each list entry:
- first_name (text)
- last_name (text)
- street (text)
- zip (text)
- city (text)
- shipping_code (text)
Finally, we add corresponding test data for the parameter list which is used to preview the report.
3 Define printable content
The list parameter shipping_data can now be set as data source for the section. This allows us to access its parameters.
We can continue with the layout design by adding a text element to the section and assign the recipient address details. All we have to do is select the needed parameters as text value. We also add a bar code element and choose the shipping_code parameter as text value.
4 Print one data set per page
With the above step data is printed but ReportBro puts as many section contents onto one page as possible. However, we want the section to take up all space of the layout to print exactly one label per page.
To get one label per page we expand the section content to fill up all space. Now we can rearrange all section content to make it look like a proper shipping label.
Finally, we add another text element and add the sender address as static text.
Print it like a Bro
Let's have a look at the result. Looks like we are ready to ship.