生成的PDF格式,iReport中未显示任何数据

时间:2013-08-12 09:47:20

标签: jasper-reports ireport

我正在尝试使用三个行组在 iReport 中生成报告,这会导致从数据库中检索大量数据。我设置了足够的页面高度,以Excel和HTML格式将所有数据放在一张纸上,但生成的PDF格式为空白。正在生成5个页面,但它们未显示任何数据。当我将页面高度减少到四分之一时,会显示数据,但会显示更多的工作表报告。所以我无法弄清楚我的报告或某些属性是否存在问题,显然我需要解决这个问题。

我的模板:

<?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="fte_summary_main_link" language="groovy" pageWidth="4000" pageHeight="40000" whenNoDataType="AllSectionsNoDetail" columnWidth="4000" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="b36dcea3-b438-417d-a4b4-77de45543aa9">
    <property name="setContentLength" value="outputStream_.toByteArray().length"/>
    <parameter name="p_deal_detail_id" class="java.lang.String">
        <defaultValueExpression><![CDATA[]]></defaultValueExpression>
    </parameter>
    <parameter name="p_tower_id" class="java.lang.String">
        <defaultValueExpression><![CDATA[]]></defaultValueExpression>
    </parameter>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["D:\\report_suchita\\FTE Summary\\"]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[select * from dual]]>
    </queryString>
    <field name="DUMMY" class="java.lang.String"/>
    <detail>
        <band height="40000">
            <subreport>
                <reportElement uuid="f9f5259a-e52a-445f-b00e-0b0f03696447" x="0" y="0" width="4000" height="10000"/>
                <subreportParameter name="deal_Detail_Id">
                    <subreportParameterExpression><![CDATA[$P{p_deal_detail_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="tower_Id">
                    <subreportParameterExpression><![CDATA[$P{p_tower_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "FTE_SUMMAR_SUBTOWER_WISE.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="40000">
            <subreport>
                <reportElement uuid="febf5345-b2f8-4afe-b5ed-db283ef7464c" x="0" y="0" width="4000" height="10000"/>
                <subreportParameter name="p_deal_detai_id">
                    <subreportParameterExpression><![CDATA[$P{p_deal_detail_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="p_tower_id">
                    <subreportParameterExpression><![CDATA[$P{p_tower_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "report6.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="40000">
            <subreport>
                <reportElement uuid="11cec18f-675a-4a39-94bc-3fb584ae5c2a" x="0" y="0" width="4000" height="10000"/>
                <subreportParameter name="dealDetailId">
                    <subreportParameterExpression><![CDATA[$P{p_deal_detail_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="towerId">
                    <subreportParameterExpression><![CDATA[$P{p_tower_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "FTE Summary GNDM view.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="40000">
            <subreport>
                <reportElement uuid="23cd3095-0210-49e0-8659-60d7b16b7b5e" x="0" y="0" width="4000" height="10000"/>
                <subreportParameter name="dealDetailId">
                    <subreportParameterExpression><![CDATA[$P{p_deal_detail_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="towerId">
                    <subreportParameterExpression><![CDATA[$P{p_tower_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "FTE Summary Subtower-Location Type-LocationWise Report.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
    <summary>
        <band height="40000">
            <subreport>
                <reportElement uuid="01617f32-cc93-43ab-b155-c923a7cd0ae9" x="0" y="0" width="4000" height="10000"/>
                <subreportParameter name="towerId">
                    <subreportParameterExpression><![CDATA[$P{p_tower_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="dealDetailId">
                    <subreportParameterExpression><![CDATA[$P{p_deal_detail_id}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "FTE Summary-Location Type Location Type.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </summary>
</jasperReport>

1 个答案:

答案 0 :(得分:0)

您不需要将波段高度设置得太高。您只需将波段高度设置为尽可能小,以便在特定区域中添加所有手掌。您还需要为子报表设置positionType float,并且可以将其设置为15,20等任何大小。此外,您还可以在一个详细信息区域中添加多个子报表。

<detail>
<band>
<subreport>
            <reportElement uuid="de20448b-1374-42bd-a65c-85e71a50d30d" positionType="Float" x="170" y="180" width="345" height="15"/>

            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{ListName})]]></dataSourceExpression>
            <subreportExpression><![CDATA["path/to/subreport"]]></subreportExpression>
</subreport>
<subreport>
            <reportElement uuid="de20448b-1374-42bd-a65c-85e71a50d30d" positionType="Float" x="170" y="180" width="345" height="15"/>
            <subreportParameter name="imagePathInSubreport">
                <subreportParameterExpression><![CDATA[$P{imagePathInTemplate12}]]></subreportParameterExpression>
            </subreportParameter>
            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{resumeList})]]></dataSourceExpression>
            <subreportExpression><![CDATA["/home/jft/workspace/CvSurgeon/CvSurgeon/web-app/report/template12/profile.jasper"]]></subreportExpression>
        </subreport>
</band>
</detail>

希望它会对你有所帮助。