jasperreports subreport with multiple columns does not print properly

0

I am new to Jasper reports. I have a master report that needs to print text in 3 columns. This text is dynamic and very long (about 2 pages). By set columnCount="3", the report is print as I expected (2 pages with 3 columns in each page). However I need to insert title on top of these 3 columns of first page only. If I just add textField on top of them. The title would be overlapped by text from 2nd column. So, I add subreport under title instead and set columnCount="3" in subreport instead. However, when I generate report this time it print everything in first column of every page. Please suggest what is wrong with my configuration. Thanks in advance.

master report

<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="Master" pageWidth="612" pageHeight="792" columnWidth="552" leftMargin="30" rightMargin="30" topMargin="0" bottomMargin="10">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="Title"/>
    <parameter name="Content"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <detail>
        <band height="782" splitType="Stretch">
          <textField>
            <reportElement x="0" y="20" width="180" height="25"/>
            <textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
          </textField>
          <subreport>
            <reportElement x="0" y="50" width="552" height="732"/>
            <subreportParameter name="Content">
              <subreportParameterExpression><![CDATA[$P{Content}]]></subreportParameterExpression>
            </subreportParameter>
            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
            <subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
         </subreport>
    </detail>
</jasperReport>

subreport

<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="Subreport" pageWidth="552" pageHeight="732" columnCount="3" columnSpacing="6" columnWidth="180" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"whenNoDataType="AllSectionsNoDetail">
    <parameter name="Content"/>
    <summary>
        <band height="732" splitType="Stretch">
          <textField textAdjust="StretchHeight">
            <reportElement x="0" y="0" width="180" height="20"/>
            <textFieldExpression><![CDATA[$P{Content}]]></textFieldExpression>
          </textField>     
    </summary>
</jasperReport>
somparb.t's picture
Joined: Aug 16 2020 - 3:42am
Last seen: 1 month 4 weeks ago

0 Answers:

No answers yet
Feedback
randomness