jasper报告中的分页符 - 小组

时间:2017-04-26 11:06:21

标签: jasper-reports

我有一个组的报告:columnHeader,columnFooter以及标题和详细信息。

enter image description here

我希望它在新页面上。我尝试使用isStartNewPage="true"keepTogether然后尝试使用![CDATA[$V{PAGE_NUMBER}==...]]。我达到的最远的步骤是当我的 columnHeader 打印在几个新页面上时(取决于我的参数值)。

是否有任何关于分页符的建议?

    <group name="Categorii" isStartNewPage="true">
    <groupHeader>
        <band height="20">
            <textField evaluationTime="Group" evaluationGroup="Categorii" bookmarkLevel="1" isStretchWithOverflow="true">
                <reportElement x="0" y="5" width="208" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box leftPadding="10" topPadding="2">
                </box>
                <textElement verticalAlignment="Middle" textAlignment="Left">
                    <font isBold="true"/>
                </textElement> 
                <textFieldExpression class="java.lang.String">"Alte cheltuieli directe"</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="208" y="5" mode="Opaque" width="347" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                </box>
                <textElement verticalAlignment="Top" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
            </textField>
        </band>
    </groupHeader>
    <groupFooter>
        <band height="80">
            <staticText>
                <reportElement mode="Opaque" x="0" y="0" width="208" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Right"/>
                <text><![CDATA[]]></text>
            </staticText>  
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="0" y="0" width="208" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"TOTAL CHELT. DIRECTE "</textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="208" y="0" width="68" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Center"/>
                <text><![CDATA[Mo]]></text>
            </staticText>   
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="208" y="0" width="68" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_cat_material}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="276" y="0" width="68" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Center"/>
                <text><![CDATA[mo]]></text>
            </staticText>  
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="276" y="0" width="68" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_cat_manopera}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="344" y="0" width="68" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Center"/>
                <text><![CDATA[Uo]]></text>
            </staticText>  
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="344" y="0" width="68" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_cat_utilaj}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="412" y="0" width="68" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Center"/>
                <text><![CDATA[to]]></text>
            </staticText>  
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="412" y="0" width="68" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_cat_transport}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="480" y="0" width="68" height="25" style="TableHeader" backcolor="white"/>
                <textElement verticalAlignment="Middle" textAlignment="Center"/>
                <text><![CDATA[To]]></text>
            </staticText>  
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="480" y="0" width="75" height="35" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Right">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_cat_total}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="0" y="35" width="150" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"Cheltuieli indirecte "</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="180" y="35" width="280" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"Io = 5.000% x To"</textFieldExpression>
            </textField>

            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="450" y="35" width="105" height="15" mode="Opaque" style="TableData" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Top" textAlignment="Right">
                    <font isBold="true"/>
                </textElement> 
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_total}]]></textFieldExpression>
            </textField>

            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="0" y="50" width="180" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"Profit "</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="180" y="50" width="280" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"Po = 5.000% x (To+Io) "</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="450" y="50" width="105" height="15" mode="Opaque" style="TableData" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Top" textAlignment="Right">
                    <font isBold="true"/>
                </textElement> 
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{sub_total}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="0" y="65" width="180" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"TOTAL GENERAL pe categorie "</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="180" y="65" width="280" height="15" style="TableGroup" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Bottom" textAlignment="Left">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String">"Vo = To+Io+Po "</textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement x="450" y="65" width="105" height="15" mode="Opaque" style="TableData" stretchType="RelativeToTallestObject"/>
                <box padding="2">
                    <topPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement verticalAlignment="Top" textAlignment="Right">
                    <font isBold="true"/>
                </textElement> 
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$P{total_general}]]></textFieldExpression>
            </textField>
        </band>
    </groupFooter>
</group>

1 个答案:

答案 0 :(得分:0)

从你的JRXML图片中看:你错过了groupExpression

如果没有合适的(随着时间的推移而变化),你将永远不会有分组休息。