JasperReports create two columns and two rows
I am trying to get my way around JasperReports but I can seem to understand the simple tutorials that I am getting from the net.
Here's what I want. I wanted to generate a 2 columns 2 rows report wherein I will send the data in the jrxml file. But I cant seem to get past the compiler. It says element bottom reaches outside band area
. I thought I already set the height to 100 and the height of the reportelement is only 24.
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="Report" pageWidth="612" pageHeight="792" topMargin="0" bottomMargin="0" leftMargin="0" rightMargin="0">
<detail>
<band height="100">
<staticText>
<reportElement x="0" y="0" width="69" height="24" />
<textElement/>
<text>
<![CDATA[Column Number 1: ]]>
</text>
</staticText>
<staticText>
<reportElement x="140" y="0" width="79" height="24" />
<text&g开发者_JAVA技巧t;
<![CDATA[Column Number 2: ]]>
</text>
</staticText>
</band>
<band height="100">
<staticText>
<reportElement x="0" y="200" width="69" height="24" />
<textElement/>
<text>
<![CDATA[Column Number 3: ]]>
</text>
</staticText>
<staticText>
<reportElement x="140" y="200" width="79" height="24" />
<text>
<![CDATA[Column Number 4: ]]>
</text>
</staticText>
</band>
</detail>
</jasperReport>
I am not sure is it considered illegal to have two band tag in one detail tag?
I would suggest downloading iReport and use it to build your report.
It is a full functioning application for designing jasper reports.
If you in fact open your existing jrxml file it should highlight in red where you're out of bounds in your bands.
Edit:
The reason you are getting the error is the x and y coordinates in the jasper report are relative to the band not the page. So a value y 200 put it outside the band.
If you use the same values that are used in your first band it should work fine, e.g.
<reportElement x="0" y="0" width="69" height="24" />
for both.
or jasperAssisstant, if you are using Eclipse. They are perfect tools for Jasper Design, else, modifying directly on the jrxml, remembering all the tags, is very tedious.
精彩评论