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

Jasper Reports - Splitting element between pages


andreas_kc

Recommended Posts

 

I am new to JasperReports and have a long staticText element that could partially fit on page 1, but does not and instead waits to start on page 2. In Crystal Reports this behaves like the "Keep Together" option on the element.

How can I get JasperReports to split the staticText element and print what is possible on the first page and then print the remainder on the second?

 

<?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="Blank Letter" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d1490564-ccd1-4f35-a07a-3a4d15a9cdbd">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="HUD XML"/>    <property name="ireport.callouts" value="callouts.1.fg=0,0,0  callouts.1.bg=255,255,0  "/>    <property name="ireport.zoom" value="1.0"/>    <property name="ireport.x" value="0"/>    <property name="ireport.y" value="551"/>    <queryString language="XPath">        CDATA[/form/mortgage]]>    queryString>    <field name="amountTyped" class="java.lang.String">        <fieldDescription>CDATA[amountTyped]]>fieldDescription>    field>    <field name="amountNumber" class="java.lang.String">        <fieldDescription>CDATA[amountNumber]]>fieldDescription>    field>    <field name="loan-223" class="java.lang.String">        <fieldDescription>CDATA[loan-223]]>fieldDescription>    field>    <field name="loan-221" class="java.lang.String">        <fieldDescription>CDATA[loan-221]]>fieldDescription>    field>    <field name="project" class="java.lang.String">        <fieldDescription>CDATA[project]]>fieldDescription>    field>    <field name="housingAct" class="java.lang.String">        <fieldDescription>CDATA[housingAct]]>fieldDescription>    field>    <field name="firmCommitment" class="java.lang.String">        <fieldDescription>CDATA[firmCommitment]]>fieldDescription>    field>    <field name="constructionLoan" class="java.lang.String">        <fieldDescription>CDATA[constructionLoan]]>fieldDescription>    field>    <field name="constructionInterestTyped" class="java.lang.String">        <fieldDescription>CDATA[constructionInterestTyped]]>fieldDescription>    field>    <field name="constructionInterestNumber" class="java.lang.String">        <fieldDescription>CDATA[constructionInterestNumber]]>fieldDescription>    field>    <field name="constructionEnd" class="java.lang.String">        <fieldDescription>CDATA[constructionEnd]]>fieldDescription>    field>    <field name="premInterestTyped" class="java.lang.String">        <fieldDescription>CDATA[premInterestTyped]]>fieldDescription>    field>    <field name="permInterestNumber" class="java.lang.String">        <fieldDescription>CDATA[permInterestNumber]]>fieldDescription>    field>    <field name="paymentStart" class="java.lang.String">        <fieldDescription>CDATA[paymentStart]]>fieldDescription>    field>    <field name="lastInterestOnly" class="java.lang.String">        <fieldDescription>CDATA[lastInterestOnly]]>fieldDescription>    field>    <field name="monthlyInstallments" class="java.lang.String">        <fieldDescription>CDATA[monthlyInstallments]]>fieldDescription>    field>    <field name="monthlyInstallmentsNumber" class="java.lang.String">        <fieldDescription>CDATA[monthlyInstallmentsNumber]]>fieldDescription>    field>    <field name="commencementDate" class="java.lang.String">        <fieldDescription>CDATA[commencementDate]]>fieldDescription>    field>    <field name="maturityDate" class="java.lang.String">        <fieldDescription>CDATA[maturityDate]]>fieldDescription>    field>    <field name="lateChargeInterest" class="java.lang.String">        <fieldDescription>CDATA[lateChargeInterest]]>fieldDescription>    field>    <field name="lenderName" class="java.lang.String">        <fieldDescription>CDATA[/form/lender/lenderName]]>fieldDescription>    field>    <field name="lenderEntity" class="java.lang.String">        <fieldDescription>CDATA[/form/lender/lenderEntity]]>fieldDescription>    field>    <field name="lenderState" class="java.lang.String">        <fieldDescription>CDATA[/form/lender/lenderState]]>fieldDescription>    field>    <field name="lenderPayment" class="java.lang.String">        <fieldDescription>CDATA[/form/lender/lenderPayment]]>fieldDescription>    field>    <field name="prepayBy" class="java.lang.String">        <fieldDescription>CDATA[/form/prepayment/prepayBy]]>fieldDescription>    field>    <field name="prepaymentDescribe" class="java.lang.String">        <fieldDescription>CDATA[/form/prepayment/prepaymentDescribe]]>fieldDescription>    field>    <field name="daysBeforeMaturity" class="java.lang.String">        <fieldDescription>CDATA[/form/prepayment/daysBeforeMaturity]]>fieldDescription>    field>    <field name="prepaymentCloseOfDay" class="java.lang.String">        <fieldDescription>CDATA[/form/prepayment/prepaymentCloseOfDay]]>fieldDescription>    field>    <field name="loanGNMA" class="java.lang.String">        <fieldDescription>CDATA[/form/prepayment/loanGNMA]]>fieldDescription>    field>    <field name="propertyJurisdictionExplain" class="java.lang.String">        <fieldDescription>CDATA[/form/jurisdiction/propertyJurisdictionExplain]]>fieldDescription>    field>    <field name="riderIndication" class="java.lang.String">        <fieldDescription>CDATA[/form/rider/riderIndication]]>fieldDescription>    field>    <field name="fullName" class="java.lang.String">        <fieldDescription>CDATA[/form/borrower/fullName]]>fieldDescription>    field>    <field name="capacity" class="java.lang.String">        <fieldDescription>CDATA[/form/borrower/capacity]]>fieldDescription>    field>    <background>        <band splitType="Stretch"/>    background>    <title>        <band splitType="Stretch"/>    title>    <pageHeader>        <band height="41" splitType="Stretch">            <textField>                <reportElement uuid="72291927-bac0-4ecc-8787-7f1c1b59d8e8" x="452" y="0" width="120" height="30"/>                <textElement textAlignment="Right"/>                <textFieldExpression>CDATA[$V{PAGE_NUMBER}]]>textFieldExpression>            textField>        band>    pageHeader>    <detail>        <band height="303" splitType="Stretch">            <rectangle>                <reportElement uuid="5edc2cac-4a1d-4945-9a51-b1f81c2a4494" x="0" y="8" width="559" height="100"/>            rectangle>            <staticText>                <reportElement uuid="402b4359-67ca-448c-b1f1-58b437794419" x="-1" y="120" width="560" height="29"/>                <textElement textAlignment="Center"/>                <text>CDATA[NOTE(MULTISTATE)]]>text>            staticText>            <staticText>                <reportElement uuid="8ff016b9-44b7-462c-9186-42b6bf9bedc5" x="350" y="180" width="90" height="20"/>                <textElement/>                <text>CDATA[Project Name:]]>text>            staticText>            <textField>                <reportElement uuid="1e9c3f0d-026b-4642-9971-28d8f8065a48" x="449" y="179" width="100" height="30"/>                <textElement/>                <textFieldExpression>CDATA["Project Name"]]>textFieldExpression>            textField>            <textField>                <reportElement uuid="9ff019a0-266c-4b65-82b6-5aa1804bbf9d" x="21" y="216" width="259" height="30"/>                <textElement/>                <textFieldExpression>CDATA["US" + $F{amountNumber}]]>textFieldExpression>            textField>            <textField>                <reportElement uuid="62059358-5dd8-41c4-8af9-3f11c384a9ff" x="289" y="216" width="163" height="27"/>                <textElement textAlignment="Right"/>                <textFieldExpression>CDATA["January 12, 2013"]]>textFieldExpression>            textField>            <textField isStretchWithOverflow="true">                <reportElement uuid="267d3044-f463-44ce-aecc-4bb0e50a2485" x="23" y="258" width="526" height="32"/>                <textElement/>                <textFieldExpression>CDATA[" FOR VALUE RECEIVED, the undersigned (“Borrower”) jointly and severally (if more than one) promises to pay to the order of "+$F{lenderName}+", a "+$F{lenderState}+" "+ $F{lenderEntity}+", the principal sum of "+$F{amountTyped}+" Dollars (US "+$F{amountNumber}+") (“Loan”), with interest on the unpaid principal balance at the Interest Rate.*"]]>textFieldExpression>            textField>        band>        <band height="50">            <printWhenExpression>CDATA[$F{constructionLoan}=="yes"]]>printWhenExpression>            <textField isStretchWithOverflow="true">                <reportElement uuid="566f9712-13f9-48fd-9114-ec1570d45f2a" x="24" y="8" width="525" height="30"/>                <textElement/>                <textFieldExpression>CDATA["As used herein, “Interest Rate” means, as applicable, (i) the annual rate of "+$F{constructionInterestTyped}+"per centum ("+$F{constructionInterestNumber}+"%) (“Construction Rate”) payable through and including "+$F{constructionEnd}+" [month before first amortized payment] and (ii) thereafter at the annual rate of "+$F{premInterestTyped}+" per centum ("+$F{permInterestNumber}+"%) (“Permanent Rate”).∗"]]>textFieldExpression>            textField>        band>        <band height="611" splitType="Stretch">            <staticText>                <reportElement uuid="02d2bd7d-4950-49c9-9b0a-9400d3fb4e99" isPrintRepeatedValues="false" x="23" y="0" width="526" height="360"/>                <textElement markup="none"/>                <text>CDATA[Testasdfdsafsadfasdfsdafdsafdsafasdfsafasdfasdfsadfasdfasdfasdfsdafdasfasdfasdffsadfwqasfdafqwewerfdsvzcxasdffewqfasdfzsx]]>text>            staticText>        band>    detail>    <columnFooter>        <band height="45" splitType="Stretch"/>    columnFooter>    <pageFooter>        <band height="54" splitType="Stretch"/>    pageFooter>    <summary>        <band height="61" splitType="Stretch"/>    summary>jasperReport>[/code]

 

 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Don't know why the text editor isn't showinq question?

 

Here it is.. I am new to JasperReports and have a long staticText element that could partially fit on page 1, but does not and instead waits to start on page 2. In Crystal Reports this behaves like the "Keep Together" option on the element.

 

How can I get JasperReports to split the staticText element and print what is possible on the first page and then print the remainder on the second?

Link to comment
Share on other sites

Anyone? I've been beating my face into this problem now for a few days... Is there any way to have a staticText element or regular text element split between pages? Or will an element only behave with "Keep Together" and move to the next page if long enough?
Link to comment
Share on other sites

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...