每个子报告一个excel Sheet(主报告中没有组)jaspersoft iReport [英] One excel Sheet for each subreport (No groups in the main report)jaspersoft iReport

查看:111
本文介绍了每个子报告一个excel Sheet(主报告中没有组)jaspersoft iReport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这真让我生气。我到处读书但仍然无法理解为什么我的工作不起作用

This is really driving me mad.. I read everywhere but still can't understand why mine isn't working

我有一份主报告(虚拟查询)在两个不同的细节带中找到两个子报告(每个都有自己的标题)。第二个子报表拆分为多个Excel工作表!

I have a main report( a dummy query returning me only one row) and 2 subreports(each with its own header) found in two different detail band. The second subreport splits into multiple excel sheets!

主报表不包含任何组..它只是一个虚拟查询,并且没有与子报表的链接。

The main report doesn't contain any groups.. its just a dummy query and has no links with the subreports.

这是我在主报告中所做的:

This is what i did in the main report:


  1. 加入属性:Name =net.sf.jasperreports.export.xls.one.page.per.sheet,其中Value =True

  1. Add in Properties : Name="net.sf.jasperreports.export.xls.one.page.per.sheet " with Value="True"

设置忽略分页=True

Set Ignore Pagination="True"

添加了一个Line元素并设置了Properties Expression:Name =net.sf.jasperreports.export.xls.break.after.row 和默认值=真

Added a Line element and set the Properties Expression: Name="net.sf.jasperreports.export.xls.break.after.row" and Default Value="True"

然后是第二个子报告:


  1. 设置Ignore Pagination =True

我只想要一张excel表格每个子报告。但是第二个子报告被拆分为多个表... :(

I just want one excel sheet for each subreports. But the second subreport is being split to multiple sheets... :(

有人知道问题是什么......?

Does anybody know what's the problem...?

我还在这里阅读了忽略分页和分页的问题:
http://community.jaspersoft.com/ireport-designer/issues/2575

I also read an issue with ignore pagination and page breaks here: http://community.jaspersoft.com/ireport-designer/issues/2575

我使用的是Jaspersoft iReport Designer 5.0.1

I am using the Jaspersoft iReport Designer 5.0.1

======================================
我的主要报告的jrxml:

====================================== My jrxml for the main report:

<?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="Sample_Report28022013" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="1808a381-4204-4662-9cc0-7d154bcc0890">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="ireport.jasperserver.reportUnit" value="/reports/Test/Subreports"/>
    <property name="ireport.jasperserver.url" value="http://192.168.17.114:8080/jasperserver/services/repository"/>
    <property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="True"/>
    <property name="net.sf.jasperreports.export.html.remove.emtpy.space.between.rows" value="True"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["C:\\Documents and Settings\\TreshmaC\\Desktop\\WCHY\\JasperSoft\\"]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[SELECT
     tableliste."ident" AS tableliste_ident
FROM
     "public"."tableliste" tableliste
LIMIT 1]]>
    </queryString>
    <field name="tableliste_ident" class="java.lang.Integer"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="7" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="5" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="7" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="97" splitType="Stretch">
            <subreport>
                <reportElement uuid="ea3a0ff6-f82f-43c0-8c7b-3d06e699f2f0" x="0" y="0" width="555" height="75"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["repo:Sample_Report28022013_subreport1.jrxml"]]></subreportExpression>
            </subreport>
            <break>
                <reportElement uuid="3568174b-2ea9-4973-8e12-adcb7f54685a" x="0" y="83" width="100" height="1"/>
            </break>
        </band>
        <band height="94" splitType="Prevent">
            <subreport>
                <reportElement uuid="b6ab1daa-122a-4a4b-8f60-f9fe2ba78204" x="0" y="13" width="555" height="72">
                    <property name="net.sf.jasperreports.export.xls.break.before.row" value="True"/>
                </reportElement>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["repo:Sample_Report28022013_subreport2.jrxml"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
    <columnFooter>
        <band height="7" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="7" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="203" splitType="Stretch">
            <componentElement>
                <reportElement uuid="2651da09-f5ff-45de-91cb-6d9f0a8af724" x="0" y="0" width="555" height="200"/>
                <mp:map xmlns:mp="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <mp:latitudeExpression><![CDATA[37.7750f]]></mp:latitudeExpression>
                    <mp:longitudeExpression><![CDATA[-122.4183f]]></mp:longitudeExpression>
                </mp:map>
            </componentElement>
        </band>
    </summary>
</jasperReport>

===================== =============================
第二个子报告的jrxml文件:

================================================== jrxml file for the second subreport:

<?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="Sample_Report28022013_subreport2" language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="5a86bc51-7425-4897-b74c-0dcf7016c666">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="ireport.jasperserver.reportUnit" value="/reports/Test/Subreports"/>
    <property name="ireport.jasperserver.url" value="http://192.168.17.114:8080/jasperserver/services/repository"/>
    <property name="net.sf.jasperreports.export.html.remove.emtpy.space.between.rows" value="True"/>
    <queryString>
        <![CDATA[SELECT
     ad_dcr."id_client" AS ad_dcr_id_client,
     ad_dcr."detail_obj_dem" AS ad_dcr_detail_obj_dem,
     ad_dcr."cre_mnt_octr" AS ad_dcr_cre_mnt_octr,
     ad_dcr."cre_mnt_deb" AS ad_dcr_cre_mnt_deb,
     ad_cli."id_client" AS ad_cli_id_client,
     ad_cli."num_port" AS ad_cli_num_port,
     ad_cli."pp_prenom" AS ad_cli_pp_prenom,
     ad_cli."pays" AS ad_cli_pays,
     ad_cli."email" AS ad_cli_email,
     ad_cli."pp_nom" AS ad_cli_pp_nom
FROM
     "public"."ad_cli" ad_cli LEFT JOIN "public"."ad_dcr" ad_dcr ON ad_cli."id_client" = ad_dcr."id_client"
ORDER BY ad_cli."id_client"]]>
    </queryString>
    <field name="ad_dcr_id_client" class="java.lang.Integer"/>
    <field name="ad_dcr_detail_obj_dem" class="java.lang.String"/>
    <field name="ad_dcr_cre_mnt_octr" class="java.math.BigDecimal"/>
    <field name="ad_dcr_cre_mnt_deb" class="java.math.BigDecimal"/>
    <field name="ad_cli_id_client" class="java.lang.Integer"/>
    <field name="ad_cli_num_port" class="java.lang.String"/>
    <field name="ad_cli_pp_prenom" class="java.lang.String"/>
    <field name="ad_cli_pays" class="java.lang.Integer"/>
    <field name="ad_cli_email" class="java.lang.String"/>
    <field name="ad_cli_pp_nom" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="23" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="43" splitType="Stretch">
            <staticText>
                <reportElement uuid="a071e7c5-1a11-497b-9eee-6b243a947965" x="378" y="0" width="177" height="39"/>
                <textElement textAlignment="Right">
                    <font fontName="Castellar" size="26"/>
                </textElement>
                <text><![CDATA[DCR ]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="22" splitType="Stretch">
            <frame>
                <reportElement uuid="12e8ca58-2196-4a8a-9137-c5104e63a485" mode="Opaque" x="0" y="0" width="555" height="20" backcolor="#006666"/>
            </frame>
            <staticText>
                <reportElement uuid="a1b68cab-e347-4a8f-87f8-01064a78854f" x="12" y="0" width="100" height="20" forecolor="#FFFFFF"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Client ID]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="8a1870d5-2682-45a1-bf8b-31a613028daf" x="312" y="0" width="143" height="20" forecolor="#FFFFFF"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Achat]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="df37206c-95bf-4d03-8add-3fc7ca1d07a9" x="455" y="0" width="100" height="20" forecolor="#FFFFFF"/>
                <textElement textAlignment="Center">
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Montant]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="40e2dded-de55-4692-8e8d-2e94127dd28e" x="112" y="0" width="100" height="20" forecolor="#FFFFFF"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Nom]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="45abf217-95a0-4ef4-963b-45c2915e5723" x="212" y="0" width="100" height="20" forecolor="#FFFFFF"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Pays]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="26" splitType="Stretch">
            <textField>
                <reportElement uuid="7f43f0d2-fcc2-45b3-865e-02d643954c1c" x="12" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{ad_dcr_id_client}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="c14584b6-c516-423a-ac17-bc4ffeb7d74c" x="312" y="0" width="143" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{ad_dcr_detail_obj_dem}]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00">
                <reportElement uuid="88cb8587-2e82-4ea6-9c1d-f53767ffb93c" x="455" y="0" width="100" height="20"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression><![CDATA[$F{ad_dcr_cre_mnt_deb}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="f4feb876-fbb5-4b7b-b9fb-f24528dfb762" x="112" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{ad_cli_pp_nom}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="5fed5609-a23b-4cbe-a4b2-a0ebf36e3cd5" x="212" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{ad_cli_pays}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement uuid="6eb43b44-1a3f-4b05-be37-4caeb35e5feb" x="0" y="20" width="555" height="1"/>
            </line>
        </band>
    </detail>
    <columnFooter>
        <band height="7" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="8" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="7" splitType="Stretch"/>
    </summary>
</jasperReport>


推荐答案

我认为您只需设置页面大小在主报告和子报告中报告一些非常大的值,例如999999,并在子报告之间插入来自托盘的分页符。
这种方式您应该在不同页面中获取每个子报表,但第二个不应跨越多个页面。

I think You can just set the size of a page in main and sub reports to some very large value, for example 999999 and insert "page break" from pallete between sub-reports. This way You should get each subreport in different page, but second one should not span across multiple pages.

这篇关于每个子报告一个excel Sheet(主报告中没有组)jaspersoft iReport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆