本文介绍了如何删除JasperReports中行之间的额外空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的jrxml代码:
It is my jrxml code:
<?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>
当我在我的应用程序中向已编译的报告添加数据集合时,我在行之间获得了额外的空间。如何删除这个额外的空间?
When I add collection of data to compiled report in my aplication I get extra space between rows. How to remove this extra space?
推荐答案
我认为这是因为你为每一行声明了125px:
I think that is because you declare 125px for each row:
<detail>
<band height="125" splitType="Stretch">
但只使用20px:
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="209" height="20"/>
尝试将细节带设为您使用的高度(20px):
Try to make detail band as height as you use (20px):
<detail>
<band height="20" splitType="Stretch">
我不确定,因为我几个月没有使用Jasper,但试试这个。
I'm not sure, because I didn't use Jasper for a few months, but try this.
这篇关于如何删除JasperReports中行之间的额外空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!