Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport with JRDataSource doesn't split properly on page


landowska.anna

Recommended Posts

Hi,

I've developed a document using few subreports (used by other documents). I have one, which get a list of objects, as a dataSourceExpression and should generate on document as many times, as there are obcjects.

Can I set some property which will help me to decide, that if the subreport page doesn't fit the page on document, it should be moved to another page? I know the band property splitType="Prevent", but as my subreport is calling another subreport and has to check a printWhenExpression only for this one, I can't put all data in one band. 

It looks something like this:

Main report:

<band height="20">            <subreport isUsingCache="false" runToBottom="false">                <reportElement isPrintRepeatedValues="false" x="-35" y="0" width="560" height="20" isPrintInFirstWholeBand="true" uuid="9e84599c-496e-4a3b-89f2-22f33fde1210">                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>                </reportElement>                <subreportParameter name="CurrentDate">                    <subreportParameterExpression><![CDATA[$P{CurrentDate}]]></subreportParameterExpression>                </subreportParameter>                <subreportParameter name="SUBREPORT_FORM_SUBREPORT_DETAILS2">                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_FORM_SUBREPORT_DETAILS2}]]></subreportParameterExpression>                </subreportParameter>                <dataSourceExpression><![CDATA[$P{Accounts}]]></dataSourceExpression>                <subreportExpression><![CDATA[$P{SUBREPORT_FORM_SUBREPORT_ACCOUNT}]]></subreportExpression>            </subreport></band>[/code]

And subreport (which will repeat as many times as there are obcjects on list):

<detail>        <band height="14">            <property name="com.jaspersoft.studio.layout"/>            <textField>                <reportElement mode="Opaque" x="15" y="0" width="510" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="1505fd52-6ff1-447f-8e4a-66ce1fe41f62">                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>                </reportElement>                <box leftPadding="3"/>                <textElement verticalAlignment="Middle" markup="html">                    <font fontName="Calibri" size="11" isBold="true" isItalic="false"/>                </textElement>                <textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>            </textField>        </band>        <band height="28">            <printWhenExpression><![CDATA[$F{DetailsList} != null]]></printWhenExpression>            <subreport>                <reportElement x="15" y="0" width="510" height="28" uuid="f9b1cbff-0b2c-4e24-96ac-5e01f6248211">                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>                </reportElement>                <dataSourceExpression><![CDATA[$F{DetailsList}]]></dataSourceExpression>                <subreportExpression><![CDATA[$P{SUBREPORT_FORM_SUBREPORT_DETAILS2}]]></subreportExpression>            </subreport>        </band>        <band height="14">            <textField>                <reportElement mode="Opaque" x="15" y="0" width="510" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="09ea9d8c-e652-4010-873e-290253a69300">                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>                </reportElement>                <box leftPadding="3">                    <topPen lineWidth="0.5" lineColor="#D9D9D9"/>                </box>                <textElement verticalAlignment="Middle" markup="html">                    <font fontName="Calibri" size="11" isBold="false" isItalic="false"/>                </textElement>                <textFieldExpression><![CDATA["$F{Number}]]></textFieldExpression>            </textField>        </band></detail>[/code]

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...