【问题标题】:Gap between detail and column footer bands even after setting "Float Column Footer" to true即使在将“Float Column Footer”设置为 true 之后,细节和列脚带之间的间隙也是如此
【发布时间】:2017-04-23 03:28:08
【问题描述】:

我正在创建一个显示一些人名的碧玉报告。我需要在底部的列表中显示人数。

我面临的问题是人员列表和“候选人总数”标签之间的差距很小。

参考请看下图:

一开始,页脚显示在页面末尾,留下了很多空白。然后我发现了一些好的 StackOverflow 链接:

1) Issue with Column footer and Summary bands
2) Jasper Reports - how to get column footer to appear directly below details band

建议将“Float Column Footer”设置为true。这样做之后,差距缩小了,我的列页脚几乎低于细节带。但是,如图所示,还有一些空隙,我不知道如何消除。

编辑:这是我的 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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="b7718df8-d1d7-46e7-9a66-7d3fe24c720c">
    <parameter name="ReportName" class="java.lang.String"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="firstName" class="java.lang.String">
        <fieldDescription><![CDATA[firstName]]></fieldDescription>
    </field>
    <field name="id" class="java.lang.String">
        <fieldDescription><![CDATA[id]]></fieldDescription>
    </field>
    <field name="lastName" class="java.lang.String">
        <fieldDescription><![CDATA[lastName]]></fieldDescription>
    </field>
    <field name="middleName" class="java.lang.String">
        <fieldDescription><![CDATA[middleName]]></fieldDescription>
    </field>
    <title>
        <band height="42" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="555" height="42" uuid="b6eaae95-75f5-4b33-978b-8afd7f9ecfee"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="20"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <columnHeader>
        <band height="20" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="32" height="20" uuid="3dfe1b88-b77c-465e-bc1d-d96223c69692"/>
                <text><![CDATA[Sr. No.]]></text>
            </staticText>
            <staticText>
                <reportElement x="32" y="0" width="188" height="20" uuid="96add808-7f90-405d-93fc-ae64596df9e3"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[First Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="220" y="0" width="188" height="20" uuid="dd5aa422-a23c-4a4c-a464-9e927503c342"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Middle Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="408" y="0" width="147" height="20" uuid="e7894574-4f95-4a04-b54b-16f636dc453c"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Last Name]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="32" height="20" uuid="b0a9a50f-f275-4802-ba80-04559e57c75e"/>
                <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="32" y="0" width="188" height="20" uuid="4ea4f73b-06bb-4553-848b-eecdc6be51b2"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="220" y="0" width="188" height="20" uuid="d2ea4610-7ee7-4921-babe-6d9040592843"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression><![CDATA[$F{middleName}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="408" y="0" width="147" height="20" uuid="045272ac-1387-49c6-a4e1-237725e08269"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="20" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="79" height="20" uuid="5a71d074-89c3-4b70-ae90-840cb37b45e8"/>
                <text><![CDATA[Total Candidates:]]></text>
            </staticText>
        </band>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

任何建议将不胜感激!

【问题讨论】:

  • 也许你有一些空的组页脚,没有看到jrxml很难说...,你也可以考虑使用组页脚,并将你的总候选人放在那里。
  • @PetterFriberg 我会尝试使用组页脚。感谢 Petter 的建议。
  • //是的,你的答案在这里:stackoverflow.com/questions/12377178/…

标签: jasper-reports


【解决方案1】:
<summary>
    <band height="0" splitType="Stretch"/>
</summary>

或完全删除标签。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-02
    • 2011-01-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多