2014-03-14 135 views
0

我有一個包含三個子報告的主報告,名爲「vehicleListSubReport.jrxml」,「locoSubreport.jrxml」和「crewSubreport.jrxml」它們的數據源分別是「vehicleReport」,「locoReport」和「crewReport」字段,它們都是JRDataSource類型的對象。如何防止子報表在其他元素上方渲染?

我有幾個問題,但我覺得他們可能有一個單一的根本原因,因此我爲什麼在同一個問題上詢問他們。首先,代碼:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Created with Jaspersoft Studio version last--> 
<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="X2010" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="25640552-4299-40b4-8655-a64e83b16458"> 
    <property name="com.jaspersoft.studio.unit." value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> 
    <style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/> 
    <style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/> 
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> 
    <style name="Detail" fontName="Arial" fontSize="12"/> 
    <style name="Row" mode="Transparent"> 
     <conditionalStyle> 
      <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression> 
      <style backcolor="#E6DAC3"/> 
     </conditionalStyle> 
    </style> 
    <queryString> 
     <![CDATA[]]> 
    </queryString> 
    <field name="trainNumber" class="java.lang.String"/> 
    <field name="crewReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="trainType" class="java.lang.String"/> 
    <field name="origin" class="java.lang.String"/> 
    <field name="dangerousGoods" class="java.lang.Boolean"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="outOfGauge" class="java.lang.Boolean"/> 
    <field name="trainDate" class="java.util.Date"/> 
    <field name="approvedLength" class="java.lang.Integer"/> 
    <field name="destination" class="java.lang.String"/> 
    <field name="specialLoad" class="java.lang.Boolean"/> 
    <field name="submittedBy" class="java.lang.String"/> 
    <field name="phone" class="java.lang.String"/> 
    <field name="submittedAtDateTime" class="java.util.Date"/> 
    <field name="fax" class="java.lang.String"/> 
    <field name="numberOfVehicles" class="java.lang.Integer"/> 
    <field name="tonnesHauled" class="java.lang.String"/> 
    <field name="tonnesGross" class="java.lang.String"/> 
    <field name="totalLength" class="java.lang.Double"/> 
    <field name="locoReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="vehicleReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="railOperatorName" class="java.lang.String"/> 
    <field name="submitter" class="java.lang.String"/> 
    <field name="consistLocation" class="java.lang.String"/> 
    <group name="Group1"> 
     <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/15)]]></groupExpression> 
     <groupFooter> 
      <band height="50" splitType="Stretch"> 
       <printWhenExpression><![CDATA[$F{vehicleReport} != null]]></printWhenExpression> 
      </band> 
     </groupFooter> 
    </group> 
    <group name="Group2"> 
     <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/5)]]></groupExpression> 
     <groupFooter> 
      <band height="107" splitType="Stretch"/> 
     </groupFooter> 
    </group> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <band height="65" splitType="Stretch"> 
      <staticText> 
       <reportElement style="Title" x="80" y="0" width="472" height="62" uuid="b89a83c9-c1a2-4ab6-85a2-88ba23795dd3"/> 
       <textElement verticalAlignment="Middle"> 
        <font pdfFontName="Times-Roman"/> 
       </textElement> 
       <text><![CDATA[X20.10 Report]]></text> 
      </staticText> 
     </band> 
    </title> 
    <pageHeader> 
     <band splitType="Stretch"/> 
    </pageHeader> 
    <columnHeader> 
     <band height="5" splitType="Stretch"> 
      <line> 
       <reportElement positionType="FixRelativeToBottom" x="1" y="1" width="552" height="2" uuid="f93f01ef-7224-41b8-a330-380bec4336d6"/> 
       <graphicElement> 
        <pen lineWidth="0.5" lineColor="#999999"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="400" splitType="Stretch"> 
      <staticText> 
       <reportElement x="0" y="120" width="90" height="20" uuid="20c60332-1cff-4218-bfce-57cec3e447dd"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Number:]]></text> 
      </staticText> 
      <subreport runToBottom="true"> 
       <reportElement isPrintRepeatedValues="false" x="-20" y="220" width="595" height="45" uuid="4f24664e-5df0-4326-9b95-9939f93c48d4"/> 
       <dataSourceExpression><![CDATA[$F{crewReport}]]></dataSourceExpression> 
       <subreportExpression><![CDATA["crewSubreport.jasper"]]></subreportExpression> 
      </subreport> 
      <textField> 
       <reportElement x="90" y="120" width="90" height="20" uuid="110c9328-d33c-4c0a-86e5-7f4ebe669b4f"/> 
       <textFieldExpression><![CDATA[$F{trainNumber}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="0" y="90" width="554" height="30" uuid="efaedffc-7d27-40f0-acc1-71797d91472c"/> 
       <box> 
        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Center"> 
        <font size="18"/> 
       </textElement> 
       <text><![CDATA[Train Details]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="140" width="90" height="20" uuid="91493735-ab12-4068-9583-9edbbac7ca35"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Type:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="160" width="90" height="20" uuid="a3e483b0-59c4-494c-ad36-1ea30eb4c5f5"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Origin]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="180" width="90" height="20" uuid="f5f23f73-3bdb-4b12-b9ec-d1946d1d249c"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Dangerous Goods:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="200" width="90" height="20" uuid="49aebc16-13db-4842-bb0f-23eac8f693a4"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Out of Gauge:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="90" y="140" width="90" height="20" uuid="ff7d87fc-1087-4edf-b1ed-454ff8ae94f8"/> 
       <textFieldExpression><![CDATA[$F{trainType}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="160" width="90" height="20" uuid="7f109b0f-f4f4-48af-9a13-909b766dbd3c"/> 
       <textFieldExpression><![CDATA[$F{origin}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="180" width="90" height="20" uuid="67f7fd28-1cee-402d-8a35-523058ab5061"/> 
       <textFieldExpression><![CDATA[$F{dangerousGoods} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="200" width="90" height="20" uuid="82586e0e-b6a7-43cf-9b1f-a12612396909"/> 
       <textFieldExpression><![CDATA[$F{outOfGauge} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="120" width="100" height="20" uuid="94651700-a070-400e-a206-fd09170cf797"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Date:]]></text> 
      </staticText> 
      <textField pattern="dd/MM/yyyy"> 
       <reportElement x="380" y="120" width="100" height="20" uuid="2ea29a18-1d85-4a23-b9f6-17459ceafe0d"/> 
       <textFieldExpression><![CDATA[$F{trainDate}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="140" width="100" height="20" uuid="3ffe5495-6b91-424b-b652-c48c72b39a8f"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Approved Length:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="160" width="100" height="20" uuid="68bcc4c2-d6c0-426b-979c-c70bbd1c550c"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Destination:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="180" width="100" height="20" uuid="83e83257-d581-4fdd-8955-ef281357aaae"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Special Load:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="380" y="140" width="100" height="20" uuid="0f1b2cf0-73a3-4106-904a-8a28b7717909"/> 
       <textFieldExpression><![CDATA[$F{approvedLength}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="380" y="160" width="100" height="20" uuid="7a006853-a10a-4759-889f-b9848a59d79b"/> 
       <textFieldExpression><![CDATA[$F{destination}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="380" y="180" width="100" height="20" uuid="521136d0-a51f-4ca1-bdce-6d0ed1cd5c76"/> 
       <textFieldExpression><![CDATA[$F{specialLoad} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="50" width="90" height="20" uuid="36b52f46-6f49-4c75-88d0-27a221bc62ec"/> 
       <textFieldExpression><![CDATA[$F{submittedBy}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="0" y="50" width="90" height="20" uuid="2cad93ef-d94f-4479-93e7-7a232023dace"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Submitted By:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="70" width="90" height="20" uuid="90474202-ce8b-4657-bad1-71edc8557335"/> 
       <text><![CDATA[Phone:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="90" y="70" width="90" height="20" uuid="20d6f136-62e4-4332-9098-3355896ff4af"/> 
       <textFieldExpression><![CDATA[$F{phone}]]></textFieldExpression> 
      </textField> 
      <textField pattern="dd/MM/yyyy HH:mm"> 
       <reportElement x="380" y="50" width="174" height="20" uuid="540bcba3-93ee-4877-b5a8-6f58db7c7398"/> 
       <textFieldExpression><![CDATA[$F{submittedAtDateTime}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="50" width="100" height="20" uuid="957ce926-9636-4625-b91f-78ecd3b8a200"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Submitted At:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="70" width="100" height="20" uuid="d8cf6e8b-9664-4012-b51d-6cdea49faf22"/> 
       <text><![CDATA[Fax:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="380" y="70" width="174" height="20" uuid="cc95ebda-f955-4eaf-9314-45e4a56c4fde"/> 
       <textFieldExpression><![CDATA[$F{fax}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="0" y="0" width="554" height="50" uuid="f7c297a9-e14e-44de-8769-5d483cfe4863"/> 
       <textElement textAlignment="Center"> 
        <font size="14" isBold="true"/> 
       </textElement> 
       <textFieldExpression><![CDATA["Consist for " + $F{railOperatorName} + " submitted by " + $F{submitter} + "\nConsist Location: " + $F{consistLocation}]]></textFieldExpression> 
      </textField> 
      <subreport runToBottom="true"> 
       <reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="50" y="330" width="130" height="20" uuid="4f470a33-ef93-425d-951e-e53642df7771"/> 
       <dataSourceExpression><![CDATA[$F{locoReport}]]></dataSourceExpression> 
       <subreportExpression><![CDATA["locoSubreport.jasper"]]></subreportExpression> 
      </subreport> 
      <textField pattern="#0.00#;(#0.00#-)"> 
       <reportElement isPrintRepeatedValues="false" x="460" y="310" width="80" height="20" uuid="f182c7db-f00f-4107-bc33-93b30faf11a9"/> 
       <textFieldExpression><![CDATA[$F{totalLength}]]></textFieldExpression> 
      </textField> 
      <textField pattern="#0.00#;(#0.00#-)"> 
       <reportElement isPrintRepeatedValues="false" x="280" y="310" width="80" height="20" uuid="c5f34099-ac0e-4634-9398-a96f93c052f6"/> 
       <textFieldExpression><![CDATA[$F{tonnesHauled}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="190" y="330" width="80" height="20" uuid="824478e7-fc00-4d16-8a39-6355baf4bc61"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Tonnes Gross:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="190" y="310" width="80" height="20" uuid="e0bc266a-56f2-4246-bea6-f31c4718046d"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Tonnes Hauled:]]></text> 
      </staticText> 
      <textField pattern="#0.00#;(#0.00#-)"> 
       <reportElement isPrintRepeatedValues="false" x="280" y="330" width="80" height="20" uuid="74e9ef61-e6e0-45fa-9966-9950c2f5a1e0"/> 
       <textFieldExpression><![CDATA[$F{tonnesGross}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement isPrintRepeatedValues="false" x="100" y="310" width="80" height="20" uuid="86833b59-3fe2-4c50-8d8e-18d80e082f75"/> 
       <textFieldExpression><![CDATA[$F{numberOfVehicles}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="0" y="330" width="40" height="20" uuid="c08f0b3c-0ddf-4cbb-b377-1f48b80fa383"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Locos:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="0" y="310" width="90" height="20" uuid="6a4a5d4b-5762-45d2-b54f-2167af8da5f8"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Number Vehicles:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="1" y="270" width="551" height="35" uuid="53e5c946-8e6d-44fa-8715-f193d224b489"/> 
       <box> 
        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Center"> 
        <font size="18"/> 
       </textElement> 
       <text><![CDATA[Train Summary]]></text> 
      </staticText> 
      <staticText> 
       <reportElement isPrintRepeatedValues="false" x="370" y="310" width="80" height="20" uuid="31012f66-602d-4892-82f4-d1187915046e"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Total Length:]]></text> 
      </staticText> 
      <subreport runToBottom="true"> 
       <reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="-20" y="360" width="595" height="20" printWhenGroupChanges="Group1" uuid="8e2dbcb5-3c3f-4bb5-a606-39f6f2e8656a"/> 
       <dataSourceExpression><![CDATA[$F{vehicleReport}]]></dataSourceExpression> 
       <subreportExpression><![CDATA["vehicleListSubreport.jasper"]]></subreportExpression> 
      </subreport> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="6" splitType="Stretch"> 
      <line> 
       <reportElement positionType="FixRelativeToBottom" x="0" y="0" width="554" height="2" uuid="447d20b2-f65e-42ee-b2a8-69632882c668"/> 
       <graphicElement> 
        <pen lineWidth="0.5" lineColor="#999999"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnFooter> 
    <pageFooter> 
     <band height="25" splitType="Stretch"> 
      <frame> 
       <reportElement mode="Opaque" x="-21" y="1" width="597" height="24" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="24b6cb4b-7cad-4abd-a159-cc5cc11896db"/> 
       <textField evaluationTime="Report"> 
        <reportElement style="Column header" x="533" y="0" width="40" height="20" forecolor="#736343" uuid="5463547b-d0a6-440d-baa9-9b1dcce760bf"/> 
        <textElement verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> 
       </textField> 
       <textField> 
        <reportElement style="Column header" x="453" y="0" width="80" height="20" forecolor="#736343" uuid="17310c63-a8e1-4f36-aad6-1b37346d27f6"/> 
        <textElement textAlignment="Right" verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> 
       </textField> 
       <textField pattern="EEEEE dd MMMMM yyyy"> 
        <reportElement style="Column header" x="22" y="1" width="197" height="20" forecolor="#736343" uuid="340aeee4-0582-45c2-9fbf-f1250cba3f8a"/> 
        <textElement verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> 
       </textField> 
      </frame> 
     </band> 
    </pageFooter> 
    <summary> 
     <band splitType="Stretch"/> 
    </summary> 
</jasperReport> 

第一個問題:crewSubreport在其下有其他報告元素,包括其他兩個子報告。如果此子報告中有多個記錄,則會在其下面的元素(包括其他子報告)之上呈現。

第二個問題:在crewSubreport下面的數據文本字段正在渲染(儘管子報表渲染在它們之上),但是,具有標籤「列車摘要」,「數量車輛:」,「噸Hauled:「,」Total Length:「,」Locos:「和」Tonnes Gross:「不是渲染,我還無法確定原因。

第三個問題:類似於第一個問題,locoSubreport正在渲染到vehicleListSubreport佔用的空間。

我該如何解決這些問題?

編輯:發佈以下說明我與迄今爲止唯一的答案有問題:

enter image description here

在內存佔用和CPU佔用率曲線圖,左邊的小峯是我運行我設計的報告。之後的圖表的其餘部分是我在回答中運行設計報表時發生的情況。它繼續這樣,直到垃圾收集器似乎放棄並殺死線程。生成此報告是該程序目前唯一正在執行的操作。使用VisualVM強制JVM執行完整垃圾回收不會回收任何內存。在我看來,使用positionType =「Float」時,Jasper Reports中存在問題,並且我需要一個不會觸發此問題的解決方案。

+0

我已經發布了同樣的問題在JasperSoft這個網站這裏:http://community.jaspersoft.com/questions/824696/how-do-i-prevent-subreport-rendering-over-top-other-elements#comment-806263。到目前爲止,有人建議將每個子報表放入其自己的細節樂隊作品中,除了我似乎只能在自己的頁面上設置每個細節樂隊之間進行選擇,或者在自己的頁面上沒有每條記錄之間進行選擇。我需要在自己的頁面上記錄每個記錄,並在一頁上記錄所有的細節(除非頁面太長)。 – Ogre

回答

1

試試這個代碼(一切belove第一個子報告是在一個框架,所以可能是CPU密集型將它們都移動起來以內):

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Created with Jaspersoft Studio version last--> 
<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="X2010" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="25640552-4299-40b4-8655-a64e83b16458"> 
    <property name="com.jaspersoft.studio.unit." value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> 
    <style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/> 
    <style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/> 
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> 
    <style name="Detail" fontName="Arial" fontSize="12"/> 
    <style name="Row" mode="Transparent"> 
     <conditionalStyle> 
      <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression> 
      <style backcolor="#E6DAC3"/> 
     </conditionalStyle> 
    </style> 
    <queryString> 
     <![CDATA[]]> 
    </queryString> 
    <field name="trainNumber" class="java.lang.String"/> 
    <field name="crewReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="trainType" class="java.lang.String"/> 
    <field name="origin" class="java.lang.String"/> 
    <field name="dangerousGoods" class="java.lang.Boolean"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="outOfGauge" class="java.lang.Boolean"/> 
    <field name="trainDate" class="java.util.Date"/> 
    <field name="approvedLength" class="java.lang.Integer"/> 
    <field name="destination" class="java.lang.String"/> 
    <field name="specialLoad" class="java.lang.Boolean"/> 
    <field name="submittedBy" class="java.lang.String"/> 
    <field name="phone" class="java.lang.String"/> 
    <field name="submittedAtDateTime" class="java.util.Date"/> 
    <field name="fax" class="java.lang.String"/> 
    <field name="numberOfVehicles" class="java.lang.Integer"/> 
    <field name="tonnesHauled" class="java.lang.String"/> 
    <field name="tonnesGross" class="java.lang.String"/> 
    <field name="totalLength" class="java.lang.Double"/> 
    <field name="locoReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="vehicleReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
    <field name="railOperatorName" class="java.lang.String"/> 
    <field name="submitter" class="java.lang.String"/> 
    <field name="consistLocation" class="java.lang.String"/> 
    <group name="Group1"> 
     <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/15)]]></groupExpression> 
     <groupFooter> 
      <band height="50" splitType="Stretch"> 
       <printWhenExpression><![CDATA[$F{vehicleReport} != null]]></printWhenExpression> 
      </band> 
     </groupFooter> 
    </group> 
    <group name="Group2"> 
     <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/5)]]></groupExpression> 
     <groupFooter> 
      <band height="107" splitType="Stretch"/> 
     </groupFooter> 
    </group> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <band height="65" splitType="Stretch"> 
      <staticText> 
       <reportElement style="Title" x="80" y="0" width="472" height="62" uuid="b89a83c9-c1a2-4ab6-85a2-88ba23795dd3"/> 
       <textElement verticalAlignment="Middle"> 
        <font pdfFontName="Times-Roman"/> 
       </textElement> 
       <text><![CDATA[X20.10 Report]]></text> 
      </staticText> 
     </band> 
    </title> 
    <pageHeader> 
     <band splitType="Stretch"/> 
    </pageHeader> 
    <columnHeader> 
     <band height="5" splitType="Stretch"> 
      <line> 
       <reportElement positionType="FixRelativeToBottom" x="1" y="1" width="552" height="2" uuid="f93f01ef-7224-41b8-a330-380bec4336d6"/> 
       <graphicElement> 
        <pen lineWidth="0.5" lineColor="#999999"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="400" splitType="Stretch"> 
      <property name="local_mesure_unitheight" value="pixel"/> 
      <property name="com.jaspersoft.studio.unit.height" value="px"/> 
      <staticText> 
       <reportElement x="0" y="120" width="90" height="20" uuid="20c60332-1cff-4218-bfce-57cec3e447dd"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Number:]]></text> 
      </staticText> 
      <subreport runToBottom="true"> 
       <reportElement isPrintRepeatedValues="false" x="-20" y="220" width="595" height="45" uuid="4f24664e-5df0-4326-9b95-9939f93c48d4"/> 
       <dataSourceExpression><![CDATA[$F{crewReport}]]></dataSourceExpression> 
       <subreportExpression><![CDATA["crewSubreport.jasper"]]></subreportExpression> 
      </subreport> 
      <textField> 
       <reportElement x="90" y="120" width="90" height="20" uuid="110c9328-d33c-4c0a-86e5-7f4ebe669b4f"/> 
       <textFieldExpression><![CDATA[$F{trainNumber}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="0" y="90" width="554" height="30" uuid="efaedffc-7d27-40f0-acc1-71797d91472c"/> 
       <box> 
        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Center"> 
        <font size="18"/> 
       </textElement> 
       <text><![CDATA[Train Details]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="140" width="90" height="20" uuid="91493735-ab12-4068-9583-9edbbac7ca35"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Type:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="160" width="90" height="20" uuid="a3e483b0-59c4-494c-ad36-1ea30eb4c5f5"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Origin]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="180" width="90" height="20" uuid="f5f23f73-3bdb-4b12-b9ec-d1946d1d249c"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Dangerous Goods:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="200" width="90" height="20" uuid="49aebc16-13db-4842-bb0f-23eac8f693a4"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Out of Gauge:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="90" y="140" width="90" height="20" uuid="ff7d87fc-1087-4edf-b1ed-454ff8ae94f8"/> 
       <textFieldExpression><![CDATA[$F{trainType}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="160" width="90" height="20" uuid="7f109b0f-f4f4-48af-9a13-909b766dbd3c"/> 
       <textFieldExpression><![CDATA[$F{origin}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="180" width="90" height="20" uuid="67f7fd28-1cee-402d-8a35-523058ab5061"/> 
       <textFieldExpression><![CDATA[$F{dangerousGoods} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="200" width="90" height="20" uuid="82586e0e-b6a7-43cf-9b1f-a12612396909"/> 
       <textFieldExpression><![CDATA[$F{outOfGauge} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="120" width="100" height="20" uuid="94651700-a070-400e-a206-fd09170cf797"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Train Date:]]></text> 
      </staticText> 
      <textField pattern="dd/MM/yyyy"> 
       <reportElement x="380" y="120" width="100" height="20" uuid="2ea29a18-1d85-4a23-b9f6-17459ceafe0d"/> 
       <textFieldExpression><![CDATA[$F{trainDate}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="140" width="100" height="20" uuid="3ffe5495-6b91-424b-b652-c48c72b39a8f"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Approved Length:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="160" width="100" height="20" uuid="68bcc4c2-d6c0-426b-979c-c70bbd1c550c"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Destination:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="180" width="100" height="20" uuid="83e83257-d581-4fdd-8955-ef281357aaae"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Special Load:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="380" y="140" width="100" height="20" uuid="0f1b2cf0-73a3-4106-904a-8a28b7717909"/> 
       <textFieldExpression><![CDATA[$F{approvedLength}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="380" y="160" width="100" height="20" uuid="7a006853-a10a-4759-889f-b9848a59d79b"/> 
       <textFieldExpression><![CDATA[$F{destination}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="380" y="180" width="100" height="20" uuid="521136d0-a51f-4ca1-bdce-6d0ed1cd5c76"/> 
       <textFieldExpression><![CDATA[$F{specialLoad} ? "Yes" : "No"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="90" y="50" width="90" height="20" uuid="36b52f46-6f49-4c75-88d0-27a221bc62ec"/> 
       <textFieldExpression><![CDATA[$F{submittedBy}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="0" y="50" width="90" height="20" uuid="2cad93ef-d94f-4479-93e7-7a232023dace"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Submitted By:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="0" y="70" width="90" height="20" uuid="90474202-ce8b-4657-bad1-71edc8557335"/> 
       <text><![CDATA[Phone:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="90" y="70" width="90" height="20" uuid="20d6f136-62e4-4332-9098-3355896ff4af"/> 
       <textFieldExpression><![CDATA[$F{phone}]]></textFieldExpression> 
      </textField> 
      <textField pattern="dd/MM/yyyy HH:mm"> 
       <reportElement x="380" y="50" width="174" height="20" uuid="540bcba3-93ee-4877-b5a8-6f58db7c7398"/> 
       <textFieldExpression><![CDATA[$F{submittedAtDateTime}]]></textFieldExpression> 
      </textField> 
      <staticText> 
       <reportElement x="280" y="50" width="100" height="20" uuid="957ce926-9636-4625-b91f-78ecd3b8a200"/> 
       <textElement> 
        <font isBold="true"/> 
       </textElement> 
       <text><![CDATA[Submitted At:]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="280" y="70" width="100" height="20" uuid="d8cf6e8b-9664-4012-b51d-6cdea49faf22"/> 
       <text><![CDATA[Fax:]]></text> 
      </staticText> 
      <textField> 
       <reportElement x="380" y="70" width="174" height="20" uuid="cc95ebda-f955-4eaf-9314-45e4a56c4fde"/> 
       <textFieldExpression><![CDATA[$F{fax}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="0" y="0" width="554" height="50" uuid="f7c297a9-e14e-44de-8769-5d483cfe4863"/> 
       <textElement textAlignment="Center"> 
        <font size="14" isBold="true"/> 
       </textElement> 
       <textFieldExpression><![CDATA["Consist for " + $F{railOperatorName} + " submitted by " + $F{submitter} + "\nConsist Location: " + $F{consistLocation}]]></textFieldExpression> 
      </textField> 
      <frame> 
       <reportElement positionType="Float" x="-20" y="270" width="596" height="110" uuid="18015311-a28e-4eee-9051-45b1790d24f7"> 
        <property name="local_mesure_unitx" value="pixel"/> 
        <property name="com.jaspersoft.studio.unit.x" value="px"/> 
        <property name="local_mesure_unity" value="pixel"/> 
        <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        <property name="local_mesure_unitheight" value="pixel"/> 
        <property name="com.jaspersoft.studio.unit.height" value="px"/> 
       </reportElement> 
       <subreport runToBottom="true"> 
        <reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="50" y="60" width="130" height="20" uuid="4f470a33-ef93-425d-951e-e53642df7771"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <dataSourceExpression><![CDATA[$F{locoReport}]]></dataSourceExpression> 
        <subreportExpression><![CDATA["locoSubreport.jasper"]]></subreportExpression> 
       </subreport> 
       <textField pattern="#0.00#;(#0.00#-)"> 
        <reportElement isPrintRepeatedValues="false" x="460" y="40" width="80" height="20" uuid="f182c7db-f00f-4107-bc33-93b30faf11a9"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textFieldExpression><![CDATA[$F{totalLength}]]></textFieldExpression> 
       </textField> 
       <textField pattern="#0.00#;(#0.00#-)"> 
        <reportElement isPrintRepeatedValues="false" x="280" y="40" width="80" height="20" uuid="c5f34099-ac0e-4634-9398-a96f93c052f6"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textFieldExpression><![CDATA[$F{tonnesHauled}]]></textFieldExpression> 
       </textField> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="190" y="60" width="80" height="20" uuid="824478e7-fc00-4d16-8a39-6355baf4bc61"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textElement> 
         <font isBold="true"/> 
        </textElement> 
        <text><![CDATA[Tonnes Gross:]]></text> 
       </staticText> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="190" y="40" width="80" height="20" uuid="e0bc266a-56f2-4246-bea6-f31c4718046d"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textElement> 
         <font isBold="true"/> 
        </textElement> 
        <text><![CDATA[Tonnes Hauled:]]></text> 
       </staticText> 
       <textField pattern="#0.00#;(#0.00#-)"> 
        <reportElement isPrintRepeatedValues="false" x="280" y="60" width="80" height="20" uuid="74e9ef61-e6e0-45fa-9966-9950c2f5a1e0"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textFieldExpression><![CDATA[$F{tonnesGross}]]></textFieldExpression> 
       </textField> 
       <textField> 
        <reportElement isPrintRepeatedValues="false" x="100" y="40" width="80" height="20" uuid="86833b59-3fe2-4c50-8d8e-18d80e082f75"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textFieldExpression><![CDATA[$F{numberOfVehicles}]]></textFieldExpression> 
       </textField> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="0" y="60" width="40" height="20" uuid="c08f0b3c-0ddf-4cbb-b377-1f48b80fa383"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textElement> 
         <font isBold="true"/> 
        </textElement> 
        <text><![CDATA[Locos:]]></text> 
       </staticText> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="0" y="40" width="90" height="20" uuid="6a4a5d4b-5762-45d2-b54f-2167af8da5f8"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textElement> 
         <font isBold="true"/> 
        </textElement> 
        <text><![CDATA[Number Vehicles:]]></text> 
       </staticText> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="1" y="0" width="551" height="35" uuid="53e5c946-8e6d-44fa-8715-f193d224b489"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <box> 
         <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
         <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
         <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
         <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
        </box> 
        <textElement textAlignment="Center"> 
         <font size="18"/> 
        </textElement> 
        <text><![CDATA[Train Summary]]></text> 
       </staticText> 
       <staticText> 
        <reportElement isPrintRepeatedValues="false" x="370" y="40" width="80" height="20" uuid="31012f66-602d-4892-82f4-d1187915046e"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
        </reportElement> 
        <textElement> 
         <font isBold="true"/> 
        </textElement> 
        <text><![CDATA[Total Length:]]></text> 
       </staticText> 
       <subreport runToBottom="true"> 
        <reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="0" y="90" width="595" height="20" printWhenGroupChanges="Group1" uuid="8e2dbcb5-3c3f-4bb5-a606-39f6f2e8656a"> 
         <property name="local_mesure_unity" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.y" value="px"/> 
         <property name="local_mesure_unitx" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.x" value="px"/> 
        </reportElement> 
        <dataSourceExpression><![CDATA[$F{vehicleReport}]]></dataSourceExpression> 
        <subreportExpression><![CDATA["vehicleListSubreport.jasper"]]></subreportExpression> 
       </subreport> 
      </frame> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="6" splitType="Stretch"> 
      <line> 
       <reportElement positionType="FixRelativeToBottom" x="0" y="0" width="554" height="2" uuid="447d20b2-f65e-42ee-b2a8-69632882c668"/> 
       <graphicElement> 
        <pen lineWidth="0.5" lineColor="#999999"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnFooter> 
    <pageFooter> 
     <band height="25" splitType="Stretch"> 
      <frame> 
       <reportElement mode="Opaque" x="-21" y="1" width="597" height="24" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="24b6cb4b-7cad-4abd-a159-cc5cc11896db"/> 
       <textField evaluationTime="Report"> 
        <reportElement style="Column header" x="533" y="0" width="40" height="20" forecolor="#736343" uuid="5463547b-d0a6-440d-baa9-9b1dcce760bf"/> 
        <textElement verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> 
       </textField> 
       <textField> 
        <reportElement style="Column header" x="453" y="0" width="80" height="20" forecolor="#736343" uuid="17310c63-a8e1-4f36-aad6-1b37346d27f6"/> 
        <textElement textAlignment="Right" verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> 
       </textField> 
       <textField pattern="EEEEE dd MMMMM yyyy"> 
        <reportElement style="Column header" x="22" y="1" width="197" height="20" forecolor="#736343" uuid="340aeee4-0582-45c2-9fbf-f1250cba3f8a"/> 
        <textElement verticalAlignment="Middle"> 
         <font size="10" isBold="false"/> 
        </textElement> 
        <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> 
       </textField> 
      </frame> 
     </band> 
    </pageFooter> 
    <summary> 
     <band splitType="Stretch"/> 
    </summary> 
</jasperReport> 
+0

我必須將最後一個子報表移出框架才能渲染,但這似乎解決了字段重疊的問題,並解決了問題通過user1791574的回答介紹。但是,最終的子報表現在出現在整個新頁面上,而不是跨頁面分割數據,但我認爲這是另一個問題。 – Ogre

0

試試看看這個代碼。

<?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="X2010" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="25640552-4299-40b4-8655-a64e83b16458"> 
<property name="com.jaspersoft.studio.unit." value="pixel"/> 
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> 
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> 
<style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/> 
<style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/> 
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> 
<style name="Detail" fontName="Arial" fontSize="12"/> 
<style name="Row" mode="Transparent"> 
    <conditionalStyle> 
     <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression> 
     <style backcolor="#E6DAC3"/> 
    </conditionalStyle> 
</style> 
<queryString> 
    <![CDATA[]]> 
</queryString> 
<field name="trainNumber" class="java.lang.String"/> 
<field name="crewReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
<field name="trainType" class="java.lang.String"/> 
<field name="origin" class="java.lang.String"/> 
<field name="dangerousGoods" class="java.lang.Boolean"> 
    <fieldDescription><![CDATA[]]></fieldDescription> 
</field> 
<field name="outOfGauge" class="java.lang.Boolean"/> 
<field name="trainDate" class="java.util.Date"/> 
<field name="approvedLength" class="java.lang.Integer"/> 
<field name="destination" class="java.lang.String"/> 
<field name="specialLoad" class="java.lang.Boolean"/> 
<field name="submittedBy" class="java.lang.String"/> 
<field name="phone" class="java.lang.String"/> 
<field name="submittedAtDateTime" class="java.util.Date"/> 
<field name="fax" class="java.lang.String"/> 
<field name="numberOfVehicles" class="java.lang.Integer"/> 
<field name="tonnesHauled" class="java.lang.String"/> 
<field name="tonnesGross" class="java.lang.String"/> 
<field name="totalLength" class="java.lang.Double"/> 
<field name="locoReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
<field name="vehicleReport" class="net.sf.jasperreports.engine.JRDataSource"/> 
<field name="railOperatorName" class="java.lang.String"/> 
<field name="submitter" class="java.lang.String"/> 
<field name="consistLocation" class="java.lang.String"/> 
<group name="Group1"> 
    <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/15)]]></groupExpression> 
    <groupFooter> 
     <band height="50" splitType="Stretch"> 
      <printWhenExpression><![CDATA[$F{vehicleReport} != null]]></printWhenExpression> 
     </band> 
    </groupFooter> 
</group> 
<group name="Group2"> 
    <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/5)]]></groupExpression> 
    <groupFooter> 
     <band height="107" splitType="Stretch"/> 
    </groupFooter> 
</group> 
<background> 
    <band splitType="Stretch"/> 
</background> 
<title> 
    <band height="65" splitType="Stretch"> 
     <staticText> 
      <reportElement style="Title" x="80" y="0" width="472" height="62" uuid="b89a83c9-c1a2-4ab6-85a2-88ba23795dd3"/> 
      <textElement verticalAlignment="Middle"> 
       <font pdfFontName="Times-Roman"/> 
      </textElement> 
      <text><![CDATA[X20.10 Report]]></text> 
     </staticText> 
    </band> 
</title> 
<pageHeader> 
    <band splitType="Stretch"/> 
</pageHeader> 
<columnHeader> 
    <band height="5" splitType="Stretch"> 
     <line> 
      <reportElement positionType="FixRelativeToBottom" x="1" y="1" width="552" height="2" uuid="f93f01ef-7224-41b8-a330-380bec4336d6"/> 
      <graphicElement> 
       <pen lineWidth="0.5" lineColor="#999999"/> 
      </graphicElement> 
     </line> 
    </band> 
</columnHeader> 
<detail> 
    <band height="400" splitType="Stretch"> 
     <staticText> 
      <reportElement x="0" y="120" width="90" height="20" uuid="20c60332-1cff-4218-bfce-57cec3e447dd"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Train Number:]]></text> 
     </staticText> 
     <subreport runToBottom="true"> 
      <reportElement isPrintRepeatedValues="false" x="-20" y="220" width="595" height="45" uuid="4f24664e-5df0-4326-9b95-9939f93c48d4"/> 
      <dataSourceExpression><![CDATA[$F{crewReport}]]></dataSourceExpression> 
      <subreportExpression><![CDATA["crewSubreport.jasper"]]></subreportExpression> 
     </subreport> 
     <textField> 
      <reportElement x="90" y="120" width="90" height="20" uuid="110c9328-d33c-4c0a-86e5-7f4ebe669b4f"/> 
      <textFieldExpression><![CDATA[$F{trainNumber}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement x="0" y="90" width="554" height="30" uuid="efaedffc-7d27-40f0-acc1-71797d91472c"/> 
      <box> 
       <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
      </box> 
      <textElement textAlignment="Center"> 
       <font size="18"/> 
      </textElement> 
      <text><![CDATA[Train Details]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="0" y="140" width="90" height="20" uuid="91493735-ab12-4068-9583-9edbbac7ca35"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Train Type:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="0" y="160" width="90" height="20" uuid="a3e483b0-59c4-494c-ad36-1ea30eb4c5f5"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Origin]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="0" y="180" width="90" height="20" uuid="f5f23f73-3bdb-4b12-b9ec-d1946d1d249c"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Dangerous Goods:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="0" y="200" width="90" height="20" uuid="49aebc16-13db-4842-bb0f-23eac8f693a4"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Out of Gauge:]]></text> 
     </staticText> 
     <textField> 
      <reportElement x="90" y="140" width="90" height="20" uuid="ff7d87fc-1087-4edf-b1ed-454ff8ae94f8"/> 
      <textFieldExpression><![CDATA[$F{trainType}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="90" y="160" width="90" height="20" uuid="7f109b0f-f4f4-48af-9a13-909b766dbd3c"/> 
      <textFieldExpression><![CDATA[$F{origin}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="90" y="180" width="90" height="20" uuid="67f7fd28-1cee-402d-8a35-523058ab5061"/> 
      <textFieldExpression><![CDATA[$F{dangerousGoods} ? "Yes" : "No"]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="90" y="200" width="90" height="20" uuid="82586e0e-b6a7-43cf-9b1f-a12612396909"/> 
      <textFieldExpression><![CDATA[$F{outOfGauge} ? "Yes" : "No"]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement x="280" y="120" width="100" height="20" uuid="94651700-a070-400e-a206-fd09170cf797"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Train Date:]]></text> 
     </staticText> 
     <textField pattern="dd/MM/yyyy"> 
      <reportElement x="380" y="120" width="100" height="20" uuid="2ea29a18-1d85-4a23-b9f6-17459ceafe0d"/> 
      <textFieldExpression><![CDATA[$F{trainDate}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement x="280" y="140" width="100" height="20" uuid="3ffe5495-6b91-424b-b652-c48c72b39a8f"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Approved Length:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="280" y="160" width="100" height="20" uuid="68bcc4c2-d6c0-426b-979c-c70bbd1c550c"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Destination:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="280" y="180" width="100" height="20" uuid="83e83257-d581-4fdd-8955-ef281357aaae"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Special Load:]]></text> 
     </staticText> 
     <textField> 
      <reportElement x="380" y="140" width="100" height="20" uuid="0f1b2cf0-73a3-4106-904a-8a28b7717909"/> 
      <textFieldExpression><![CDATA[$F{approvedLength}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="380" y="160" width="100" height="20" uuid="7a006853-a10a-4759-889f-b9848a59d79b"/> 
      <textFieldExpression><![CDATA[$F{destination}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="380" y="180" width="100" height="20" uuid="521136d0-a51f-4ca1-bdce-6d0ed1cd5c76"/> 
      <textFieldExpression><![CDATA[$F{specialLoad} ? "Yes" : "No"]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="90" y="50" width="90" height="20" uuid="36b52f46-6f49-4c75-88d0-27a221bc62ec"/> 
      <textFieldExpression><![CDATA[$F{submittedBy}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement x="0" y="50" width="90" height="20" uuid="2cad93ef-d94f-4479-93e7-7a232023dace"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Submitted By:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="0" y="70" width="90" height="20" uuid="90474202-ce8b-4657-bad1-71edc8557335"/> 
      <text><![CDATA[Phone:]]></text> 
     </staticText> 
     <textField> 
      <reportElement x="90" y="70" width="90" height="20" uuid="20d6f136-62e4-4332-9098-3355896ff4af"/> 
      <textFieldExpression><![CDATA[$F{phone}]]></textFieldExpression> 
     </textField> 
     <textField pattern="dd/MM/yyyy HH:mm"> 
      <reportElement x="380" y="50" width="174" height="20" uuid="540bcba3-93ee-4877-b5a8-6f58db7c7398"/> 
      <textFieldExpression><![CDATA[$F{submittedAtDateTime}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement x="280" y="50" width="100" height="20" uuid="957ce926-9636-4625-b91f-78ecd3b8a200"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Submitted At:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement x="280" y="70" width="100" height="20" uuid="d8cf6e8b-9664-4012-b51d-6cdea49faf22"/> 
      <text><![CDATA[Fax:]]></text> 
     </staticText> 
     <textField> 
      <reportElement x="380" y="70" width="174" height="20" uuid="cc95ebda-f955-4eaf-9314-45e4a56c4fde"/> 
      <textFieldExpression><![CDATA[$F{fax}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement x="0" y="0" width="554" height="50" uuid="f7c297a9-e14e-44de-8769-5d483cfe4863"/> 
      <textElement textAlignment="Center"> 
       <font size="14" isBold="true"/> 
      </textElement> 
      <textFieldExpression><![CDATA["Consist for " + $F{railOperatorName} + " submitted by " + $F{submitter} + "\nConsist Location: " + $F{consistLocation}]]></textFieldExpression> 
     </textField> 
     <subreport runToBottom="true"> 
      <reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="50" y="330" width="130" height="20" uuid="4f470a33-ef93-425d-951e-e53642df7771"/> 
      <dataSourceExpression><![CDATA[$F{locoReport}]]></dataSourceExpression> 
      <subreportExpression><![CDATA["locoSubreport.jasper"]]></subreportExpression> 
     </subreport> 
     <textField pattern="#0.00#;(#0.00#-)"> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="460" y="310" width="80" height="20" uuid="f182c7db-f00f-4107-bc33-93b30faf11a9"/> 
      <textFieldExpression><![CDATA[$F{totalLength}]]></textFieldExpression> 
     </textField> 
     <textField pattern="#0.00#;(#0.00#-)"> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="280" y="310" width="80" height="20" uuid="c5f34099-ac0e-4634-9398-a96f93c052f6"/> 
      <textFieldExpression><![CDATA[$F{tonnesHauled}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="190" y="330" width="80" height="20" uuid="824478e7-fc00-4d16-8a39-6355baf4bc61"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Tonnes Gross:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="190" y="310" width="80" height="20" uuid="e0bc266a-56f2-4246-bea6-f31c4718046d"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Tonnes Hauled:]]></text> 
     </staticText> 
     <textField pattern="#0.00#;(#0.00#-)"> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="280" y="330" width="80" height="20" uuid="74e9ef61-e6e0-45fa-9966-9950c2f5a1e0"/> 
      <textFieldExpression><![CDATA[$F{tonnesGross}]]></textFieldExpression> 
     </textField> 
     <textField> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="100" y="310" width="80" height="20" uuid="86833b59-3fe2-4c50-8d8e-18d80e082f75"/> 
      <textFieldExpression><![CDATA[$F{numberOfVehicles}]]></textFieldExpression> 
     </textField> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="330" width="40" height="20" uuid="c08f0b3c-0ddf-4cbb-b377-1f48b80fa383"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Locos:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="310" width="90" height="20" uuid="6a4a5d4b-5762-45d2-b54f-2167af8da5f8"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Number Vehicles:]]></text> 
     </staticText> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="1" y="270" width="551" height="35" uuid="53e5c946-8e6d-44fa-8715-f193d224b489"/> 
      <box> 
       <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
       <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
      </box> 
      <textElement textAlignment="Center"> 
       <font size="18"/> 
      </textElement> 
      <text><![CDATA[Train Summary]]></text> 
     </staticText> 
     <staticText> 
      <reportElement positionType="Float" isPrintRepeatedValues="false" x="370" y="310" width="80" height="20" uuid="31012f66-602d-4892-82f4-d1187915046e"/> 
      <textElement> 
       <font isBold="true"/> 
      </textElement> 
      <text><![CDATA[Total Length:]]></text> 
     </staticText> 
     <subreport runToBottom="true"> 
      <reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="-20" y="360" width="595" height="20" printWhenGroupChanges="Group1" uuid="8e2dbcb5-3c3f-4bb5-a606-39f6f2e8656a"/> 
      <dataSourceExpression><![CDATA[$F{vehicleReport}]]></dataSourceExpression> 
      <subreportExpression><![CDATA["vehicleListSubreport.jasper"]]></subreportExpression> 
     </subreport> 
    </band> 
</detail> 
<columnFooter> 
    <band height="6" splitType="Stretch"> 
     <line> 
      <reportElement positionType="FixRelativeToBottom" x="0" y="0" width="554" height="2" uuid="447d20b2-f65e-42ee-b2a8-69632882c668"/> 
      <graphicElement> 
       <pen lineWidth="0.5" lineColor="#999999"/> 
      </graphicElement> 
     </line> 
    </band> 
</columnFooter> 
<pageFooter> 
    <band height="25" splitType="Stretch"> 
     <frame> 
      <reportElement mode="Opaque" x="-21" y="1" width="597" height="24" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="24b6cb4b-7cad-4abd-a159-cc5cc11896db"/> 
      <textField evaluationTime="Report"> 
       <reportElement style="Column header" x="533" y="0" width="40" height="20" forecolor="#736343" uuid="5463547b-d0a6-440d-baa9-9b1dcce760bf"/> 
       <textElement verticalAlignment="Middle"> 
        <font size="10" isBold="false"/> 
       </textElement> 
       <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement style="Column header" x="453" y="0" width="80" height="20" forecolor="#736343" uuid="17310c63-a8e1-4f36-aad6-1b37346d27f6"/> 
       <textElement textAlignment="Right" verticalAlignment="Middle"> 
        <font size="10" isBold="false"/> 
       </textElement> 
       <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> 
      </textField> 
      <textField pattern="EEEEE dd MMMMM yyyy"> 
       <reportElement style="Column header" x="22" y="1" width="197" height="20" forecolor="#736343" uuid="340aeee4-0582-45c2-9fbf-f1250cba3f8a"/> 
       <textElement verticalAlignment="Middle"> 
        <font size="10" isBold="false"/> 
       </textElement> 
       <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> 
      </textField> 
     </frame> 
    </band> 
</pageFooter> 
<summary> 
    <band splitType="Stretch"/> 
</summary> 
</jasperReport> 
+0

不幸的是,當它嘗試生成第一條記錄時,這會引起OutOfMemoryError消息「超出GC開銷限制」。它沒有達到它在我的JRDataSource上調用next()方法的程度。當生成我的報告版本時,它會很快過去那個點(但當然,佈局已經破損)。 – Ogre

+0

您使用的是哪個版本的iReport和碧玉報告。 – user1791574

+0

我使用Jasper Reports版本5.2.0和JasperSoft Studio 5.5.0(不是iReport,因爲iReport似乎不再受支持)。 – Ogre