分页后如何在标题和正文之间填充空白行?

时间:2019-05-07 02:15:23

标签: jasper-reports export-to-excel

我在用jasperreport创建Excel工作表时遇到麻烦。 我设置分页符后每5行。但是在2页的标题和正文之间会出现空白行。

像波纹管一样

首页正常工作如下:

first page is working properly like this

第二页不能这样工作: second page doesn't work like this

下面是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="運転者" pageWidth="1200" pageHeight="842" columnWidth="1100" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="623644de-c1a7-4f9b-a0b8-6cd49534177b">
	<property name="net.sf.jasperreports.data.adapter" value="data/ExcelXlsQeDataAdapter.xml"/>
	<property name="net.sf.jasperreports.xls.column.names" value="city,id,name,address,state,date"/>
	<property name="net.sf.jasperreports.xls.column.indexes" value="0,2,3,4,5,6"/>
	<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
	<queryString>
		<![CDATA[SELECT id,company_id,key,value,category
FROM m_config 
WHERE id BETWEEN 0 ANd 100]]>
	</queryString>
	<field name="id" class="java.lang.Integer"/>
	<field name="company_id" class="java.lang.Integer"/>
	<field name="key" class="java.lang.String"/>
	<field name="value" class="java.lang.String"/>
	<field name="category" class="java.lang.String"/>
	<sortField name="value"/>
	<group name="rowGroup" minHeightToStartNewPage="60">
		<groupExpression><![CDATA[$F{value}]]></groupExpression>
	</group>
	<pageHeader>
		<band height="20">
			<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
			<staticText>
				<reportElement x="0" y="0" width="150" height="20" uuid="86c5d829-e5b0-435c-9f79-12d585382321"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[営業所]]></text>
			</staticText>
			<staticText>
				<reportElement x="150" y="0" width="150" height="20" uuid="23fca646-c315-4949-a66b-8d40392a6228"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[統括運行管理者]]></text>
			</staticText>
			<staticText>
				<reportElement x="300" y="0" width="150" height="20" uuid="9983bee3-80f3-43d5-9577-c88b0ef008ce"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[運行管理者]]></text>
			</staticText>
			<staticText>
				<reportElement x="450" y="0" width="150" height="20" uuid="aafd49c7-1cd0-4e37-9b32-b8681e2d71f5"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[運行管理者補助者]]></text>
			</staticText>
			<staticText>
				<reportElement x="600" y="0" width="150" height="20" uuid="c92c9bd7-0b5d-478b-a24f-12b0381f0530"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[整備管理者]]></text>
			</staticText>
			<staticText>
				<reportElement x="750" y="0" width="150" height="20" uuid="838efc19-a11d-41c2-a44c-e8d31c40d18d"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[整備管理者補助者]]></text>
			</staticText>
			<staticText>
				<reportElement x="900" y="0" width="150" height="20" uuid="4f2b0adf-38d1-4b20-b66d-ff9c18bc7454"/>
				<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0">
					<pen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Center"/>
				<text><![CDATA[運転者]]></text>
			</staticText>
		</band>
	</pageHeader>
	<detail>
		<band height="100" splitType="Stretch">
			<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.spreadsheet.SpreadsheetLayout"/>
			<textField bookmarkLevel="2">
				<reportElement x="0" y="0" width="150" height="100" uuid="e41ff9bb-b1a9-4eda-93b7-aae064c7fe29"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Right"/>
				<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="150" y="0" width="150" height="100" uuid="883b220c-70b0-42b0-9e71-0ce7ed55bcda"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="300" y="0" width="150" height="100" uuid="42c3482d-8ba1-4f58-b5ad-d1c201e1884b"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="450" y="0" width="150" height="100" uuid="f7192b71-43ed-479e-bec1-15828ef0e2c6"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="600" y="0" width="150" height="100" uuid="1a168d62-b0ae-4852-830f-a79514c79902"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="750" y="0" width="150" height="100" uuid="faa9f611-7544-47ae-bac2-5b04256e1d1f"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="900" y="0" width="150" height="100" uuid="a74101ab-56f9-48e7-861b-04ee12de95cb"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
			</textField>
			<break type="Column">
				<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="0" y="0" width="100" height="1" isPrintWhenDetailOverflows="true" uuid="55de0f75-ebb0-4a2c-b17d-d81ab6d4fb8c">
					<printWhenExpression><![CDATA[$V{REPORT_COUNT}%5==0]]></printWhenExpression>
				</reportElement>
			</break>
		</band>
	</detail>
</jasperReport>

我不知道为什么只从第二页开始。

如果您知道此问题以及如何解决,请帮助我。

0 个答案:

没有答案