【问题标题】:How to remove extra space between rows in JasperReports?如何删除 JasperReports 中行之间的额外空间?
【发布时间】:2016-04-06 19:51:59
【问题描述】:

这是我的 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="example_report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <field name="name" class="java.lang.String"/>
    <field name="test" class="java.lang.String"/>
    <field name="price" class="java.lang.Double"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="61" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="125" splitType="Stretch">
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="209" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="209" y="0" width="201" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{test}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="410" y="0" width="145" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.Double"><![CDATA[$F{price}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

当我在我的应用程序中将数据集合添加到已编译的报告中时,我会在行之间获得额外的空间。如何删除这个多余的空间?

【问题讨论】:

    标签: java jasper-reports ireport


    【解决方案1】:

    我认为这是因为您为每一行声明了 125px:

    <detail>
        <band height="125" splitType="Stretch">
    

    但只使用其中的 20 像素:

    <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="209" height="20"/>
    

    尽量使细节带与您使用的高度一样(20px):

    <detail>
        <band height="20" splitType="Stretch">
    

    我不确定,因为我有几个月没有使用 Jasper,但试试这个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-16
      • 2013-01-09
      • 1970-01-01
      • 2020-05-28
      • 2021-11-01
      • 2021-11-20
      • 1970-01-01
      相关资源
      最近更新 更多