2016-04-20 57 views
2

使用JasperReports打印某些PDF報告時出現問題。這些報告基本上是多年來向特定客戶所做的所有銷售的細目。JRXML - 消除底部的重複標題

我們從數據庫中獲取信息,使用Java進行轉換,並以PDF格式打印報告。問題是,在某些罕見的情況下,一些頭出現重複在每個頁面的底部:

enter image description here

理想情況下,我們應該能夠省略鬆頭,並保持在新頁面上只有一個,但我似乎無法做到,至少通過TIBCO Jaspersoft Studio。

我實際上對這些報告並不瞭解,但您需要幫助的任何信息都可以隨時詢問。

在此先感謝。

編輯:繼Petter Friberg的評論,這裏是本報告中使用的JRXML的部分內容。我省略了一些遵循相同屬性的部分,但我認爲這應該足夠清楚。

<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="Historique" language="groovy" pageWidth="595" pageHeight="842" columnWidth="483" leftMargin="56" rightMargin="56" topMargin="43" bottomMargin="43" isSummaryWithPageHeaderAndFooter="true" resourceBundle="reportLabels" whenResourceMissingType="Empty" uuid="80db05e1-8ca3-483d-86cc-5947dc62296b"> 
    <property name="ireport.zoom" value="1.0"/> 
    <property name="ireport.x" value="0"/> 
    <property name="ireport.y" value="0"/> 
    <property name="com.jaspersoft.studio.unit." value="pixel"/> 
    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> 
    <property name="com.jaspersoft.studio.unit.topMargin" value="mm"/> 
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="mm"/> 
    <property name="com.jaspersoft.studio.unit.leftMargin" value="mm"/> 
    <property name="com.jaspersoft.studio.unit.rightMargin" value="mm"/> 
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> 
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> 
    <template><![CDATA["/jasper/styles_letter.jrtx"]]></template> 
    <style name="Table Group Header" mode="Opaque" forecolor="#000000" backcolor="#99CCFF" vTextAlign="Middle" fontName="Arial" fontSize="10" isBold="true" pdfFontName="Helvetica-Bold"/> 
    <!-- ... multiple styles --> 
    <parameter name="title" class="java.lang.String"/> 
     <!-- ... multiple parameters--> 
    <parameter name="addressCity" class="java.lang.String"/> 
    <field name="reduction" class="java.lang.String"> 
     <fieldDescription><![CDATA[reduction]]></fieldDescription> 
    </field> 
     <!-- ... multiple fields --> 
    <field name="year" class="java.lang.String"/> 
    <group name="DescriptionGroup"> 
     <groupExpression><![CDATA[$F{year}]]></groupExpression> 
     <groupHeader> 
      <band height="30"> 
       <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
       <textField evaluationTime="Group" evaluationGroup="DescriptionGroup" bookmarkLevel="2"> 
        <reportElement style="Table Group Header" mode="Opaque" x="0" y="0" width="483" height="15" printWhenGroupChanges="DescriptionGroup" backcolor="#B0B0B0" uuid="f626bb36-a919-48b9-98b3-756d1ce9812b"> 
         <property name="local_mesure_unitx" value="pixel"/> 
         <property name="com.jaspersoft.studio.unit.x" value="px"/> 
         <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
         <printWhenExpression><![CDATA[new Boolean($P{emptyList} != true)]]></printWhenExpression> 
        </reportElement> 
        <box leftPadding="10"> 
         <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
         <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
         <bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
         <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        </box> 
        <textElement markup="none"> 
         <font size="9" isBold="true"/> 
        </textElement> 
        <textFieldExpression><![CDATA[$F{year}]]></textFieldExpression> 
       </textField> 
       <!-- ... multiple text fields following the same principle --> 
      </band> 
     </groupHeader> 
    </group> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <!-- this only appears in the first page, has all the customer info --> 
    </title> 
    <columnHeader> 
     <band splitType="Stretch"/> 
    </columnHeader> 
    <detail> 
     <band height="25" splitType="Stretch"> 
      <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> 
      <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
      <textField pattern="" isBlankWhenNull="true"> 
       <reportElement style="Zebra" mode="Opaque" x="0" y="0" width="130" height="25" uuid="234d3832-bd30-40a0-b8e5-eac964158000"> 
        <property name="local_mesure_unitheight" value="pixel"/> 
        <property name="local_mesure_unitx" value="pixel"/> 
        <property name="com.jaspersoft.studio.unit.x" value="px"/> 
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
        <printWhenExpression><![CDATA[new Boolean($P{emptyList} != true)]]></printWhenExpression> 
       </reportElement> 
       <textElement> 
        <font size="8" isBold="false"/> 
        <paragraph leftIndent="3"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{article}]]></textFieldExpression> 
      </textField> 
      <!-- ... multiple fields following the same principle. this is the body of each sub-table, showing the info for each year --> 
     </band> 
    </detail> 
    <pageFooter> 
     <band height="25" splitType="Stretch"> 
      <!-- ... --> 
     </band> 
    </pageFooter> 
    <summary> 
     <band height="40" splitType="Stretch"> 
      <!-- ... shows a summary of all the info shown on each table --> 
     </band> 
    </summary> 
</jasperReport> 

在此先感謝。

回答

2

您正在使用一個組生成標題,因此您可以使用此屬性minHeightToStartNewPage來確定需要保留多少空間,否則會中斷到新頁面。

<group name="DescriptionGroup" minHeightToStartNewPage="60"> 

,或者如果你想迫使它總是新的一頁

<group name="DescriptionGroup" isStartNewPage="true"> 
+0

謝謝你這麼多的開始,這個工作。 – gilneto8