Johannes
Johannes

Reputation: 133

Displaying tables below each other in JasperReports

I have to create a report where several tables are diplayed below each other. Each table gets its data from a SubDataset and contains none, one or more rows.

For the first version of the report, I've simply ignored the possibility of a table having no rows and put all tables below each other, each with the height of 1 row. The idea was, that if there is more than one row, the table will grow in height, which seems to work fine. I've given the first table a fixed position and set all subsequent ones to float. In iReport it looks like this:

enter image description here



But when I create a report, only the first table is at the expected position. The rest is displayed too low and overlaps:

enter image description here



Any idea how to fix this? I can't use subreports, because the report is stored in a database so I can't reference other reports. Is there maybe another alternative to subreports or tables?

Upvotes: 6

Views: 8252

Answers (2)

Navin Kondayur
Navin Kondayur

Reputation: 1

Try looking into using subreports. I do create table followed by another (datasource is XML).

  1. create subreport using xPath
  2. Use Data Source Expression property of the subreport to set the datasource for subreport ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/FUND_STATEMENT/FUNDS/FUND")

Upvotes: 0

mdahlman
mdahlman

Reputation: 9390

You have the "Position Type" property set to "Fix Relative to Top". Change it to "Float".

Upvotes: 7

Related Questions