Report Design

Let's create a report representing pilots in a table. The table will have 2 fields: "Name" and "Points". The fields should be defined like this:

<field name="Name" class="java.lang.String"/>

<field name="Points" class="java.lang.Integer"/>

The field values - $F{Name} and $F{Points} - can be used in the table part of the report:

<detail>

   <band height="15">

    <textField bookmarkLevel="2">

      <reportElement x="150" y="0" width="175" height="15"/>

      <box leftBorder="Thin" bottomBorder="Thin" leftPadding="10" rightPadding="10"/>

      <textElement textAlignment="Left"/>

      <textFieldExpression class="java.lang.String">$F{Name}</textFieldExpression>

      <anchorNameExpression>$F{Name} + " (" + $F{Points} + ")"</anchorNameExpression>

    </textField>

    <textField isStretchWithOverflow="true">

      <reportElement positionType="Float" x="325" y="0" width="50" height="15"/>

      <box leftBorder="Thin" bottomBorder="Thin" rightBorder="Thin" leftPadding="10" rightPadding="10"/>

      <textElement textAlignment="Right"/>

      <textFieldExpression class="java.lang.Integer">$F{Points}</textFieldExpression>

    </textField>

</band>

</detail>

The full report design can be downloaded from the-pilot-report.jrxml.