Data splitting

Top  Previous  Next

Let's look at a peculiarity of this report: There is a lot of blank space at bottom of the pages. Why is this? When a report is created the FastReport engine fills the white space of the page with the bands. After displaying each band the current position shifts down. When FastReport finds that there is not enough white space left to display the next band (its height is larger than the white space left on the page) FastReport creates a new page and carries on with band display from there. This sequence continues for as many times as there are records in the dataset.


Our report contains an object with large text, which is why the band height is quite large. Furthermore, if a large band does not have enough room on a page it is shifted to the next one leaving a lot of unused space remaining at the bottom of the page, as shown here:




To limit paper wastage, let's use a FastReport feature that makes paragraphs from a band’s contents. All we need do is enable the “AllowSplit” property of the “First level data” band. You will see that there is now less white space at the bottom of the report pages:




How does this band splitting work? There are some objects in FastReport which support this feature. They are the “Text”, “Line” and “RichEdit” objects. They can be “split”, while other objects cannot. When FastReport needs to split a band, it does it in the following way:


- displays the non-splittable objects which have room in the white space

- partially displays splittable objects (“Text” objects are displayed in a way that all lines have space in the object)

- creates a new page and continues with object display in the band

- if a non-splittable object does not have room in the white space, it is shifted to the next page; at the same time all the objects located beneath it are shifted as required

- the process continues until all of the band objects are fully displayed.


The splitting algorithm will become clearer by looking at this example:




It should be noted, that the splitting algorithm is not perfect and the final output may not be quite as expected. You should use this option very carefully in cases where objects on the split band are grouped in a complicated way, and/or their font sizes differ. Here is an example of what could be generated: