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

  • SEARCH
  • Home
  • 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 8591711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:35:18+00:00 2026-06-11T23:35:18+00:00

I would like to create a report with iReport for MS Excel . My

  • 0

I would like to create a report with iReport for MS Excel.

My report includes two subreports. I need each subreport in a separate Excel sheet, but the generated export file has all data in one sheet.

I don’t know which settings for this option required is.

  • 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-11T23:35:18+00:00Added an answer on June 11, 2026 at 11:35 pm

    You can solve this issue with help of net.sf.jasperreports.export.xls.break.after.row property.

    You can set this net.sf.jasperreports.export.xls.break.after.row property for the "sheets break" element in report (for example, line or staticText element).

    In my sample below I’ve put line element to the Group Footer band for generating new sheet in Excel for a new group.

    Here is my sample, master report:

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport ..>
        <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
            <defaultValueExpression><![CDATA["path_to_subreport"]]></defaultValueExpression>
        </parameter>
        <queryString>
            <![CDATA[SELECT id, addressId FROM document ORDER BY addressId]]>
        </queryString>
        <field name="ID" class="java.lang.Integer"/>
        <field name="ADDRESSID" class="java.lang.Integer"/>
        <group name="addressGroup">
            <groupExpression><![CDATA[$F{ADDRESSID}]]></groupExpression>
            <groupHeader>
                <band height="53">
                    <subreport>
                        <reportElement x="189" y="0" width="200" height="31"/>
                        <subreportParameter name="addressId">
                            <subreportParameterExpression><![CDATA[$F{ADDRESSID}]]></subreportParameterExpression>
                        </subreportParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "subreport_new_sheet_for_excel.jasper"]]></subreportExpression>
                    </subreport>
                    <staticText>
                        <reportElement x="0" y="33" width="100" height="20"/>
                        <textElement textAlignment="Center" verticalAlignment="Middle">
                            <font isItalic="true"/>
                        </textElement>
                        <text><![CDATA[ID]]></text>
                    </staticText>
                </band>
            </groupHeader>
            <groupFooter>
                <band height="9">
                    <line>
                        <reportElement x="1" y="5" width="100" height="1">
                            <property name="net.sf.jasperreports.export.xls.break.after.row" value="true"/>
                        </reportElement>
                        <graphicElement>
                            <pen lineWidth="0.0"/>
                        </graphicElement>
                    </line>
                </band>
            </groupFooter>
        </group>
        <detail>
            <band height="20" splitType="Stretch">
                <textField>
                    <reportElement x="0" y="0" width="100" height="20"/>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
    </jasperReport>
    

    My subreport:

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport ...>
        <parameter name="addressId" class="java.lang.Integer" isForPrompting="false"/>
        <queryString>
            <![CDATA[SELECT city, street FROM address WHERE id = $P{addressId}]]>
        </queryString>
        <field name="CITY" class="java.lang.String"/>
        <field name="STREET" class="java.lang.String"/>
        <detail>
            <band height="20" splitType="Stretch">
                <textField>
                    <reportElement x="0" y="0" width="258" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA["City: " + $F{CITY}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="258" y="0" width="297" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA["Street: " + $F{STREET}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
    </jasperReport>
    

    The result will be:

    The generated report in MS Excel, case of using net.sf.jasperreports.export.xls.break.after.row

    The result without using of "break" element (I removed the line with net.sf.jasperreports.export.xls.break.after.row property) will be:

    The generated report in MS Excel


    You can find more about info in Advanced Excel Features post.

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

Sidebar

Related Questions

I would like to create a virtual host in apache2, but I want it
I use iReport to create reports, and I would like to know if there
I would like to create a report with a custom class as follows: public
I have a stock table and I would like to create a report that
I would like to create junit report programmatically using ant. I've seen that this
I would like to know how to create a shared DataSet programmatically in Report
I would like to create a report that will display a variable amount of
We would like to create test report specific to user who fired the request
I would like to create a report from a project management system that has
I would like to create a powershell script generating a report showing all compressed

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.