Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:47:17+00:00 2026-06-08T09:47:17+00:00

I’m using iReport 2.0.4 to export some data to excel from a java application.

  • 0

I’m using iReport 2.0.4 to export some data to excel from a java application.

My problem is my subreports are grouping under the top level report but I want them to be discrete reports. Currently it looks like this

Order

   -Order Line 1

    Receipts

       -Receipt Line 1

       -Receipt Line 2

    Invoices

       -Invoice Line 1

       -Invoice Line 2

Order

   -Order Line 2

    Receipts

       -Receipt Line 1

       ……..

I want it to be 3 separate reports in one spreadsheet. Like this

Order

    all Order lines

Receipts

    all Receipt lines

Invoices

    all Invoice lines

Currently I have the Orders as the master report and the Receipts and Invoices as subreports, dropped into the detail band Orders.

What is the best way to get this layout, if it’s possible at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:47:18+00:00Added an answer on June 8, 2026 at 9:47 am
    • First way. Using JasperReports API

    You can fill and compile three separate reports and then use JRPdfExporterParameter.JASPER_PRINT_LIST parameter for building the single report using code like this:

    JasperReport ordersReport = JasperCompileManager.compileReport(srcOrdersReport);
    JasperPrint jpOrdersReport = JasperFillManager.fillReport(ordersReport, ordersParamsMap, ordersDataSource);
    
    JasperReport receiptsReport = JasperCompileManager.compileReport(srcReceiptsReport);
    JasperPrint jpReceiptsReport = JasperFillManager.fillReport(receiptsReport, receiptsParamsMap, receiptsDataSource);
    
    JasperReport invoicesReport = JasperCompileManager.compileReport(srcInvoicesReport);
    JasperPrint jpInvoicesReport = JasperFillManager.fillReport(invoicesReport, invoicesParamsMap, invoicesDataSource);
    
    List<JasperPrint> printList = new ArrayList<JasperPrint>();
    
    printList.add(jpOrdersReport);
    printList.add(receiptsReport);
    printList.add(invoicesReport);
    
    JRExporter exporter = new JRPdfExporter();
    exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, printList);
    
    exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, output);
    exporter.exportReport();
    

    You can look at this sample for your JR version – 2.0.4 for more details.

    • Second way. Using several datasets and list components

    You can add several datasets in iReport 4.x version to the single report. Every dataset may contain its own query. The list component can use its own dataset.

    In this sample (build with iReport 4.5.1) I’ve placed 3 list components to the Title band:

    <?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="several_queries" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <subDataset name="OrdersDataset">
            <queryString>
                <![CDATA[SELECT TOP 5 ORDERID AS orderId, SHIPNAME AS orderShipName, SHIPCOUNTRY AS orderShipCounty, SHIPCITY  AS orderShipCity
    FROM orders]]>
            </queryString>
            <field name="ORDERID" class="java.lang.Integer"/>
            <field name="ORDERSHIPNAME" class="java.lang.String"/>
            <field name="ORDERSHIPCOUNTY" class="java.lang.String"/>
            <field name="ORDERSHIPCITY" class="java.lang.String"/>
        </subDataset>
        <subDataset name="ReceiptsDataset">
            <queryString>
                <![CDATA[SELECT TOP 10 ID AS receiptId, CITY AS receiptCity FROM receipts]]>
            </queryString>
            <field name="RECEIPTID" class="java.lang.Integer"/>
            <field name="RECEIPTCITY" class="java.lang.String"/>
        </subDataset>
        <subDataset name="InvoicesDataset">
            <queryString>
                <![CDATA[SELECT TOP 7 ID AS invoiceId, TOTAL AS invoiceSum FROM invoices]]>
            </queryString>
            <field name="INVOICEID" class="java.lang.Integer"/>
            <field name="INVOICESUM" class="java.math.BigDecimal"/>
        </subDataset>
        <subDataset name="dataset1"/>
        <queryString>
            <![CDATA[SELECT 1 as t FROM dual WHERE 1=2]]>
        </queryString>
        <field name="t" class="java.lang.String"/>
        <background>
            <band splitType="Stretch"/>
        </background>
        <title>
            <band height="243" splitType="Stretch">
                <componentElement>
                    <reportElement positionType="Float" x="0" y="44" width="555" height="19"/>
                    <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                        <datasetRun subDataset="OrdersDataset">
                            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        </datasetRun>
                        <jr:listContents height="19" width="555">
                            <textField>
                                <reportElement x="0" y="0" width="100" height="19"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{ORDERID}]]></textFieldExpression>
                            </textField>
                            <textField>
                                <reportElement x="100" y="0" width="100" height="19"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{ORDERSHIPNAME}]]></textFieldExpression>
                            </textField>
                            <textField>
                                <reportElement x="200" y="0" width="100" height="19"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{ORDERSHIPCOUNTY}]]></textFieldExpression>
                            </textField>
                            <textField>
                                <reportElement x="300" y="0" width="100" height="19"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{ORDERSHIPCITY}]]></textFieldExpression>
                            </textField>
                        </jr:listContents>
                    </jr:list>
                </componentElement>
                <componentElement>
                    <reportElement positionType="Float" x="0" y="130" width="400" height="18"/>
                    <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                        <datasetRun subDataset="ReceiptsDataset">
                            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        </datasetRun>
                        <jr:listContents height="18" width="400">
                            <textField>
                                <reportElement positionType="Float" x="100" y="0" width="100" height="18"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{RECEIPTCITY}]]></textFieldExpression>
                            </textField>
                            <textField>
                                <reportElement positionType="Float" x="0" y="0" width="100" height="18"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{RECEIPTID}]]></textFieldExpression>
                            </textField>
                        </jr:listContents>
                    </jr:list>
                </componentElement>
                <staticText>
                    <reportElement positionType="Float" x="0" y="4" width="400" height="20"/>
                    <box topPadding="1" leftPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isBold="true" isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Orders]]></text>
                </staticText>
                <staticText>
                    <reportElement x="0" y="24" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[ID]]></text>
                </staticText>
                <staticText>
                    <reportElement x="100" y="24" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Customer name]]></text>
                </staticText>
                <staticText>
                    <reportElement x="200" y="24" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Customer country]]></text>
                </staticText>
                <staticText>
                    <reportElement x="300" y="24" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Customer city]]></text>
                </staticText>
                <staticText>
                    <reportElement positionType="Float" x="0" y="109" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[ID]]></text>
                </staticText>
                <staticText>
                    <reportElement positionType="Float" x="100" y="109" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[City]]></text>
                </staticText>
                <staticText>
                    <reportElement positionType="Float" x="0" y="89" width="200" height="20"/>
                    <box topPadding="1" leftPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isBold="true" isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Receipts]]></text>
                </staticText>
                <componentElement>
                    <reportElement positionType="Float" x="0" y="201" width="400" height="18"/>
                    <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                        <datasetRun subDataset="InvoicesDataset">
                            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        </datasetRun>
                        <jr:listContents height="18" width="400">
                            <textField pattern="###0.00;-###0.00">
                                <reportElement positionType="Float" x="100" y="0" width="100" height="18"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{INVOICESUM}]]></textFieldExpression>
                            </textField>
                            <textField>
                                <reportElement positionType="Float" x="0" y="0" width="100" height="18"/>
                                <box leftPadding="10" rightPadding="10">
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                    <rightPen lineWidth="1.0"/>
                                </box>
                                <textElement/>
                                <textFieldExpression><![CDATA[$F{INVOICEID}]]></textFieldExpression>
                            </textField>
                        </jr:listContents>
                    </jr:list>
                </componentElement>
                <staticText>
                    <reportElement positionType="Float" x="0" y="161" width="200" height="20"/>
                    <box topPadding="1" leftPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isBold="true" isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Invoices]]></text>
                </staticText>
                <staticText>
                    <reportElement positionType="Float" x="100" y="181" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[Sum]]></text>
                </staticText>
                <staticText>
                    <reportElement positionType="Float" x="0" y="181" width="100" height="20"/>
                    <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Center">
                        <font isItalic="true"/>
                    </textElement>
                    <text><![CDATA[ID]]></text>
                </staticText>
            </band>
        </title>
    </jasperReport>
    

    The report’s design is:

    The report's design in iReport

    The result will be (via iReport preview):

    The report's result

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.