简体   繁体   中英

Subreport in jasper 2.0.5 is not showing in main report pdf

I'm setting up a subreport in my main report jrmxl for my java application. I'm currently developing using iReports 2.0.5 and I can't use a further version.

When I run the test in order to generate a pdf whith my report, in the log it seems recognize it and run the stringquery and set the parameteres in the output, but in the pdf only appears the main report data.

This is the main report subreport tag

<jasperReport
         name="triageSummary"
         columnCount="1"
         printOrder="Vertical"
         orientation="Portrait"
         pageWidth="595"
         pageHeight="842"
         columnWidth="519"
         columnSpacing="0"
         leftMargin="51"
         rightMargin="25"
         topMargin="20"
         bottomMargin="20"
         whenNoDataType="NoPages"
         isTitleNewPage="false"
         isSummaryNewPage="false">
    <property name="ireport.scriptlethandling" value="0" />
    <property name="ireport.encoding" value="UTF-8" />
    <import value="java.util.*" />
    <import value="net.sf.jasperreports.engine.*" />
    <import value="net.sf.jasperreports.engine.data.*" />

    <parameter name="SubRel_Cabecalho" isForPrompting="false" class="java.net.URL"/>

    <subreport  isUsingCache="true">
        <reportElement
            x="1"
            y="3"
            width="481"
            height="18"
            key="subreport-1"/>
        <subreportParameter  name="I_LANG">
            <subreportParameterExpression><![CDATA[$P{ID_LANGUAGE}]]></subreportParameterExpression>
        </subreportParameter>
        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
        <subreportExpression  class="java.net.URL"><![CDATA[$P{SubRel_Cabecalho}]]></subreportExpression>
    </subreport>

</jasperReport>

In my java I configure an Hibertante connection in order to generate the report and pass the parameter as a resource

this.putParameterResource("SubRel_Cabecalho", "/reports/audit/edis_audit_cabecalho_analise.jasper");

My main problem Is when I generate the report, only show the data of the main report and doesn't print the subreport. I am missing some configuration in order to show the subreport?

try with this,

defined SubRel_Cabecalho as a parameter with data type `class="java.lang.String"

<parameter name="SubRel_Cabecalho" isForPrompting="false" class="java.lang.String/>

then use it to pass the sub report file path

HashMap<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("SubRel_Cabecalho", "/reports/audit/edis_audit_cabecalho_analise.jasper");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM