如何避免/阻止列标题和列页脚没有详细信息

时间:2012-10-01 15:52:48

标签: jasper-reports ireport

我收到了一份包含多份子报告的报告。

报告:

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 

BTW:我也尝试使用页眉/页脚而不是。但它也没有奏效。我也将帧放在 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>

0 个答案:

没有答案