Jasper report groups when there is no data source

I understand that if you do not pass the JRDataSource to the JasperFillManager , then the resulting JasperReport will not contain any detailed ranges.

For reasons outside the context of this question, I want to place several components (histogram and table) on a small / simple JasperReport, and I want the data to come from the HashMap, which I will transfer So I do not need the JRDataSource implementation, which also means that I will not get any detailed ranges.

So my question is: and then, in which groups should I add my components? . A group of parts where I usually add components, but if I don't get parts, where do these orphan components go?

Edit: The tangent of this question would be obvious: how would I calculate the size (height) that this strip should use?

+4
source share
2 answers

You can pass JREmptyDatasource to JasperFillManager . You can even specify how many virtual records you want, that is, how many detailed ranges will be displayed using the constructor JREmptyDataSource#JREmptyDataSource(int count) .

+3
source

Put them in the Title or Summary strip.

In fact, your report will not have data. But since you are passing the map as a parameter with "data", then you are happy with the data without data. Make sure that the report is set to "All sections, no part" if there is no data.

With a chart, you simply set the height of the chart and the height of the strip, but you want to. The component of the table will expand ... but this is not a problem. It can expand the heading or summary area as needed.

+2
source

Source: https://habr.com/ru/post/1386407/


All Articles