Jasper Report Column Format

I have a Jasper report that has one details section, and inside the details section is one field from the database that is being printed. Therefore, if my query returns 100 rows, I get 100 rows, which gives a report of 10 pages long, since 10 records fit on the page.

Is there a way to print this field in columns so that I can fit, say, 40 records per page, not just 10? (Having 4 columns out of 10)

+5
source share
1 answer

You can customize a report with multiple columns. If you are using iReport, right-click in the Report Inspector with the report name and select "Page Format". In the Columns section, increase the columns from 1to 4, adjust the space if necessary to determine the distance between the columns. If you click on a report, you can also select the print order in the Properties panel.

In the report designer, you drag a field in the first column in the details bar.

the added properties in JRXML are in the tag <jasperreports ...:

  • columnCount="4": 4 columns
  • printOrder="Horizontal": The filling order is horizontal.

Attached by JRXML for additional reference:

<?xml version="1.0" encoding="UTF-8"?>
<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="report8" language="groovy" columnCount="4" printOrder="Horizontal" pageWidth="595" pageHeight="842" columnWidth="138" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5e2835cc-bc36-4f77-8631-08a8deaa28d7">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <queryString>
        <![CDATA[select 'A' as field]]>
    </queryString>
    <field name="field" class="java.lang.String"/>
    <detail>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement uuid="76707cdd-7dbe-477e-b3a4-38f9ba3bd003" x="0" y="0" width="136" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{field}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>
+8
source

All Articles