What is the best free or low-cost Java reporting library (e.g. BIRT, JasperReports, etc.) for making
Posted
by Max3000
on Stack Overflow
See other posts from Stack Overflow
or by Max3000
Published on 2009-04-02T06:56:07Z
Indexed on
2010/05/13
7:34 UTC
Read the original article
Hit count: 204
I want to print, email and write to PDF very simple reports. The reports are basically a list of items, divided in various sections/columns. The sections are not necessarily identical. Think newspaper.
I just wasted a solid 2 days of work trying to make this kind of reports using JasperReports. I find that Jasper is great for outputing "normalized" data. The kind that would come out of a database for instance, each row neatly describing an item and each item printed on a line. I'm simplifying a bit but that's the idea.
However, given what I want to do I always ended up completely lost. Data not being displayed for no apparent reason, columns of texts never the correct size, column positioning always ending up incorrect, pagination not sanely possible (I was never able to figure it out; the FAQ gives an obscure workaround), etc.
I came to the conclusion that Jasper is really not built to make the kind of reports I want. Am I missing something?
I'm ready to pay for a tool, as long as the price is reasonable. By reasonable I mean a few $100s.
Thanks.
EDIT: To answer cetus, here is more information about the report I made in Jasper.
What I want is something like this:
text text
text text
-------------------
text | text
text |----------
text | text
text | text
--------| text
text |----------
text | text
What I made in jasper is this:
(detail band)
subreport | subreport
------------------------------------
subreport | subreport
------------------------------------
subreport | subreport
The subreports are all the same actual report. This report has one field (called "field") and basically just prints this field in a detail band. Hence, running a single subreport simply lists all items from the datasource. The datasource itself is a simple custom JRDatasource containing a collection of strings in the field "field". The datasource iterates over the collection until there are no more strings. Each subreport has its own datasource.
I tried many different variations of the above, with all sorts of different properties for the report, subreports, etc.
IMO, this is fairly simple stuff. However, the problems I encounter are as follows:
- Subreports starting from the 3rd don't show up when their position type is 'float'. They do show up when they have 'fix relative to top'. However, I don't want to do this because the first two subreports can be of any length.
- I can't make each subreport to stretch according to its own length. Instead, they either don't stretch at all (which is not desirable because they have different lenghts) or they stretch according to the longest subreport. This makes a weird layout for sure.
- Pagination doesn't happen. If some subreports fall outside the page, they simple don't show. One alternative is to increase the 'page height' considerably and the 'detail band height' accordingly. However, in this case it is not really possibly to know the total height in advance. So I'm stuck with calculating/guessing it myself, before the report is even generated. More importantly, long reports end up on one page and this is not acceptable (the printout text is too small, it's ugly/non-professional to have different reports with different PDF page lengths, etc.).
BTW, I used iReport so it's possibly limitations of iReport I'm listing here and not of Jasper itself. That's one of the things I'm trying to find out asking this question here. One alternative would be to generate the jrxml myself with just static text but I'm afraid I'll encounter the very same limitations. Anyway, I just generally wasted so much time getting anything done with Jasper that I can't help thinking its not the right tool for the job. (Not to say that Jasper doesn't excel in what it's good at).
© Stack Overflow or respective owner