How to make a report with Gambas

It is now 10 years at least that report component has existed. Maybe it's time for me to document it!

First of all if someone can deal with my spelling faults and grammar errors, I'll give him a big hug.

The base concepts of a Gambas Report

I've written Gambas report component to be able to cope with a maximum of the users needs. But it is definitively not like the common report generators.

It is not based on section design (Even if gb.reports has section named things, it does not have the same goal), but on Container/Object design, named boxed design for web page. So it follows the different constraints given by the Containers (parents) and the objects (children) to draw the page and define when generating a new page.

The ReportVBox Container

Most certainly the most important container of the Report family. It's the container that manages it's children vertically. If you put objects in it, it will set their Width to it's Content Width (=Container Width - Container.Padding Width - Container.Border Width) and take care of the object margin requirement too. Then it will arrange objects vertically in accordance to the height required by each of the objects. If an object does not have space to be drawn in the current Vertical space then a new page is generated with all the vBoxParents and so the drawing of children can continue until the end.

If an object does not fit in an entire container space (i mean only one object, like an image) it will be cropped.

The ReportHBox Container

This container arranges it's elements horizontally. It sets the height of it's children with the same rules as the ReportVBox. If all the elements do not fit inside, the remaining parts will be simply ignored.

The Objects arrangement properties

  • Property Expand : the objects height will be the remaining space.

    If more than one object of the ReportVBox has it's Expand option activated then the Object height will be the remaining space divided by the number of objects on the current page.

  • Property Ignore : this object is not arranged by the container and its Left and Top properties are used to place it relative to the container position.

  • Property Fixed : this object will be repeated each time it's container is repeated.

  • Property Margin : this property allows the object to define a minimal distance between the object and another one.

    The biggest value is taken into account between two objects. The margin is not fused with the container padding so the two values are accumulated.
    The margins can be set individually for each border of the objects.

The Containers arrangement properties

  • Property Arrangement : this property is currently present only on the panel container.

    You can define 4 different values: None, Fill, Vertical, Horizontal. Vertical and Horizontal act respectively like ReportVBox and ReportHBox.

  • Property Spacing : this property creates a distance between objects. It is different from the margin value as it puts spaces only between objects.

  • Property ForceNewPage : it's a quite special feature. Each time this container is repeated it forces a new page.

  • Property OnePiece : the content of this container must be shown on one page. All will be done to achieve this goal.