In Pentaho Reporting Classic, all Report-Elements are positioned somewhere on a canvas. Whenever an band is being printed, the layouting system jumps in an computes the final layout for the band and all child elements. After the layouting is complete, each element has some valid ‘bounds’, which describe where the painter would have to place the element on the canvas.
The table-generator’s work starts after all elements have a valid layout. For each visible element in the band, the layouter takes the bounds and generates a column or row break for each edge position. All bands of the report are added to a single table. Therefore the table’s column will be based on all generated column breaks of all bands.
Pentaho Reporting Classic has two table-export modes. In the ‘simple’ export mode, the table-generator ignores the right and bottom edge of the child elements (but not for the root-level band). If a ‘complex’ layout is requested, all boundary informations are taken into account.
Theory is dry, lets take a look at some numbers:
Lets assume we have a root-level band with a width of 500 point and a height of 200 points. The band has two childs, a label and a text-field. I’ll specify the bounds as absolute positions, (X1,Y1) denotes the upper-left corner, and (X2,Y2) denotes the lower right corner.
The bounds of all elements involved are:
- Band: X1=0, Y1=0, X2=500, Y2=200
- Label: X1=100, Y1=0, X2=300, Y2=100
- Textfield: X1=100, Y1=100, X2=250, Y2=200
Let’s follow the table-generator’s steps. We assume that the complex layouting is used.
- The Band gets added: As there are no column breaks yet, A column break will be added for X1=0 and X2=500. A rowbreak is added at Y1=0 and Y2=200.The first break always marks the start of the table, and the last break marks the end (and total-width) of the table. The table now consists of a single cell, that has a width of 500 points and a height of 200 points.
- The Label gets added: As there is no column break for X1=100, a new column break is inserted. The table’s only cell splits into two columns.
Label A column break for X2 gets inserted at position 300. The table now contains 3 columns.
Label The Label’s Y1 does not cause a row-break, as the band already caused one at this position. A row break for Y2 gets inserted at position 100. The table now consists of two rows.
Label - The text field is added to the table. X1 does not cause a column break, as there is already one at this position. X2 causes a new column break at position 250. Note that the label already occupies the cell from X=100 to X=300. This cell will now span two columns. There is already a column break for the text-field’s Y1 position (at Y=100, caused by the labels bottom edge) and for the Y2 position (at Y=200, caused by the band’s bottom edge).
Label TextField
If the table-generator uses the simple algorithm, the resulting table gets simplified in a second step. The column breaks at position 250 and 300 have been caused by a right edge of an report element. These breaks now get removed, so that the resulting table looks like this:
Label | |
TextField |
Now it should be clear, that the table-generator works best, if all elements are properly aligned. All elements that should go into one row or column have to start at the same X and y positions. If the strict layouting mode is used, they also must end at the same position. Elements that should go into neighbouring cells must share a common edge. And finally: Elements that do not start at position Zero will cause an empty column or row.
In the next post, I’ll cover how Pentaho Reporting Classic computes cell backgrounds and borders.
I am Executing SQL Server Stored Procedure with parameters in Pentaho Report .While preview i selected two/More string values (like ex: ‘XXXX,YYYY,ZZZZ’) it’s showing Failed at Query:Exec prco_Name ${parm_Name} if i select one value from parameter list it’s display output
Please Help me
Thanks ,
Suresh