At the moment I am working on the cross-tabbing code inside the Pentaho Reporting Engine. Ever since our old JFreeReport days this feature was on the list of things to do, but never quite made it up to the top of the heap.
While roaming through the existing and experimental cross-tab code, I found several easy ways to break the layout. Set a cell’s width or height wrong, and you are hosed. Dynamic height? Layout kaput! Null-values? Table goes down the drain.
We need something better!
Right now, we are using unrelated bands stacked together to get some appearance of a tabular structure. This works for the simple case, but anything complex causes trouble, similar to using CSS-styled DIVs in HTML to emulate tables. So we really need true tables to make it work.
Now, instead of building a one-off layout strategy, I am going to write this table-layout in a more general way. This way, you can apply it to groups or even ordinary sub-bands.
For groups, you will be able to set the group’s layout property to “table”. The group-body, the group-header, footers and other bands will automatically form a single cell in the table by default. So nothing breaks, nothing changes.
The magic starts when you apply the layouts “table-body”, “table-row” or “table-cell” to the various sub-bands. The bands then will be merged into a single flat table structure which shares borders and which synchronizes the layout.
There are several immediate advantages from the “true table layout”(tm):
- Your header now controls the width of all cells. Increase the width of the header, and the details band follows. Even in design mode.
- Borders merge properly, so that you get a proper grid rendered. No more double width borders then.
- absolutely no overlapping cells
- Table-exports can translate this structure directly into their documents. No more guessing why your cells have a empty cell here.
- Technically, if you are willing to pay the price, we can have a complete auto-layout where the width of cells is based on the content printed in them. As in web-browsers, this is slow and memory consuming. Might be just a nice to have for slick demos. You may not want to use that in real world reports.
The table-layout will come within the next few weeks, along with the missing pieces of the cross-tabbing. Stay tuned ..