---
UPDATE 19/1/2011:
I looked into the exporter code to see if I can override something to get this behavior.
I found out that at the export stage all the data is neatly organized in pages/rows and there is no way to distinguish between column headers and other data.
So a exporter parameter will not solve the problem.
So I took a step back and looked at the fill report code.
At this stage the fillers (horizontal/vertical) have a "fillColumnHeaders" method that gets a evaluation object and decides if the column headers should be printed according to it.
A new jasper report parameter can be introduced here to ignore printing the headers after the first page.
Then we could set this parameter programmatically according to what export type was chosen.
---
I'm using jasperreports (and ireport) 3.7.1
A lot of reports are just plain tabular data with column headers.
It is a common requirement to be able to export this report in two ways:
1.pdf: just to view data.
The desired layout for pdf is usually having as many rows of data on each page and headers for each column.
2.csv/excel : so clients can "mess around" with the data, create charts based on it and whatever.
The desired layout is usually having a row of headers followed by endless rows of data.
for 2 - One way to achieve this is to use "ignore pagination" BUT the drawback is that if there a lot of data the exporter will run out of memory - even with file virtualizer since exported only dump their memory content to file after each page.
for 2 and 1 - Another way to achieve this is to use the "Print When Expression" with the column header band (telling it to print only on first page).
Using this method pdf export will also lack headers on following pages and this is not desired. just csv/excel should behave like this.
On the server side it is possible to fill some report parameter to determine weather this behavior should fire according to what export type was chosen but it makes code kinda ugly.
I believe that an introduction of a "print-column-headers-on-first-page-only" kind of parameter would be greatly appreciated and very useful.
NOTE:
I noticed that on 3.7.6 there is a Table element. I haven't tried it out yet and don't know how it works but if it spans multiple pages and prints its headers on each page it could also support this kind of parameter.
Recommended Comments