1

我有一份包含几个子报告的报告。

报告:

Sub-Report 
Sub-Report 

为了将它们分开一点,我在子报告中的所有数据周围放置了一个框架。

分报告:

Column Header: 
- Frame (left,top,right) 
Group Header 1:
- Headings of data
Detail 1: 
- data 
- Frame (left,right) 
Group Footer 1: 
- summary of data 
- Frame (left,right) 
Column Footer: 
- Frame (left,bottom,right) 

所以当一侧剩余的地方不够大时,只会出现列的页眉和页脚。
-> 如何避免这种情况?

页面情况:

Column Header
Group Header 1
Detail 1 
Group Footer 1
Column Footer 

Column Header
-nothing else here-
Column Footer
-- next page --
Column Header
Group Header 1
Detail 1
Group Footer 1
Column Footer

我想要的页面:

Column Header 
Group Header 1 
Detail 1 
Group Footer 1
Column Footer 

-- next page --
Column Header 
Group Header 1 
Detail 1 
Group Footer 1 
Column Footer 

顺便说一句:我也尝试使用Page Header/Footer而不是Column。但它也没有奏效。我也将框架放在Group Header/Footer中,但是在这种情况下,当数据需要超过一页时,页面底部没有框架,因为组页脚位于组的末尾。

或者换句话说:我只会看到列/页脚/页眉,如果有数据详细信息带,数据可见。

我的jrxml文件:

<?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="Subreport" pageWidth="566" pageHeight="842" columnWidth="566" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="ReportResources" whenResourceMissingType="Key">
    <parameter name="JasperReportParm.FromMaster.PK" class="java.lang.Long"/>
    <parameter name="JasperReportParm.FromMaster.Name" class="java.lang.String"/>
    <parameter name="JasperReportParm.FromMaster.Datum" class="java.lang.String"/>
    <queryString>
        <![CDATA[SELECT * FROM ...]]>
    </queryString>
    <field name="PK" class="java.lang.Long">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="PK1" class="java.lang.Long">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="ZahlFormatted" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="zebra" class="java.lang.Boolean">
        <fieldDescription><![CDATA[false]]></fieldDescription>
    </field>
    <group name="FramesTopBottom" isReprintHeaderOnEachPage="true" minHeightToStartNewPage="79">
        <groupExpression><![CDATA[]]></groupExpression>
        <groupHeader>
            <band height="2"/>
        </groupHeader>
        <groupFooter>
            <band/>
        </groupFooter>
    </group>
    <group name="PK1" isReprintHeaderOnEachPage="true" minHeightToStartNewPage="40">
        <groupExpression><![CDATA[$F{PK1}]]></groupExpression>
        <groupHeader>
            <band height="29">
                <textField isStretchWithOverflow="true">
                    <reportElement stretchType="RelativeToTallestObject" x="487" y="6" width="74" height="10"/>
                    <textElement textAlignment="Right">
                        <font fontName="Helvetica" size="9" isItalic="false"/>
                    </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA[$P{JasperReportParm.FromMaster.Datum}]]></textFieldExpression>
                </textField>
                <rectangle>
                    <reportElement x="0" y="17" width="566" height="9" backcolor="#AFD9FF"/>
                    <graphicElement>
                        <pen lineWidth="0.0"/>
                    </graphicElement>
                </rectangle>
                <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                    <reportElement key="4" x="5" y="18" width="52" height="9"/>
                    <box>
                        <topPen lineWidth="0.0" lineColor="#000000"/>
                        <leftPen lineWidth="0.0" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineColor="#000000"/>
                        <rightPen lineWidth="0.0" lineColor="#000000"/>
                    </box>
                    <textElement>
                        <font fontName="Helvetica" size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA[$R{Global.Datum}]]></textFieldExpression>
                </textField>
                <frame>
                    <reportElement x="0" y="0" width="566" height="29"/>
                    <box>
                        <pen lineWidth="0.1" lineColor="#000000"/>
                        <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <rightPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    </box>
                </frame>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="24">
                <line>
                    <reportElement x="495" y="3" width="67" height="1" forecolor="#999999"/>
                    <graphicElement>
                        <pen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    </graphicElement>
                </line>
                <textField isStretchWithOverflow="true">
                    <reportElement stretchType="RelativeToTallestObject" x="496" y="7" width="65" height="10"/>
                    <textElement textAlignment="Right">
                        <font fontName="Helvetica" size="9" isBold="true" isItalic="false" pdfFontName="Helvetica-Bold"/>
                    </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{ZahlFormatted}]]></textFieldExpression>
                </textField>
                <frame>
                    <reportElement x="0" y="0" width="566" height="24"/>
                    <box>
                        <pen lineWidth="0.1" lineColor="#000000"/>
                        <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <rightPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    </box>
                </frame>
            </band>
        </groupFooter>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band splitType="Stretch"/>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="8" splitType="Stretch">
            <frame>
                <reportElement x="0" y="0" width="566" height="2"/>
                <box>
                    <pen lineWidth="0.1" lineColor="#000000"/>
                    <topPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                </box>
            </frame>
        </band>
    </columnHeader>
    <detail>
        <band height="11" splitType="Stretch">
            <rectangle>
                <reportElement key="2" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="566" height="11" isPrintWhenDetailOverflows="true" backcolor="#ECF4FF">
                    <printWhenExpression><![CDATA[$F{zebra}]]></printWhenExpression>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </graphicElement>
            </rectangle>
            <frame>
                <reportElement x="0" y="0" width="566" height="11"/>
                <box>
                    <pen lineWidth="0.1" lineColor="#000000"/>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                </box>
            </frame>
        </band>
    </detail>
    <columnFooter>
        <band height="8" splitType="Stretch">
            <frame>
                <reportElement x="0" y="0" width="566" height="8"/>
                <box>
                    <pen lineWidth="0.1" lineColor="#000000"/>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.1" lineStyle="Solid" lineColor="#000000"/>
                </box>
            </frame>
        </band>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>
4

0 回答 0