如何显示jasper报告页面,例如ODD: 1,3,5,7,9 .....
和EVEN :2,4,6,8,10,12......
?
我尝试在jasper中表达时设置print。我使用了$V{PAGE_NUMBER} % 2 == 1
,但它只是打破了第1页或第2页。
如何在单独的奇数和偶数序列中打印细节?
我试过这段代码:
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="null" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="927727f4-bbc3-4b13-bde4-00e4c9eff6b1">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString language="SQL">
<![CDATA[Select * from area1;]]>
</queryString>
<field name="AREA_NAME" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="304" y="14" width="100" height="20" uuid="4260d472-d804-440a-9af6-1c3298d2f58f"/>
<textElement>
<font size="13" isBold="true" isUnderline="true" isStrikeThrough="false"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} % 2 == 1]]></printWhenExpression>
</band>
</pageHeader>
<columnHeader>
<band height="40" splitType="Stretch">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} % 2 == 1]]></printWhenExpression>
<staticText>
<reportElement x="23" y="2" width="100" height="20" uuid="5e8b28a3-3518-46e4-a62f-dfa585fc0c1b"/>
<text><![CDATA[AREA_NAME]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="136" splitType="Stretch">
<printWhenExpression><![CDATA[$P{REPORT_PAGE}%2 == 0]]></printWhenExpression>
<textField>
<reportElement x="23" y="0" width="100" height="20" uuid="4b25e363-9dc8-47d4-8af4-3e6919e06020"/>
<textFieldExpression><![CDATA[$F{AREA_NAME}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<printWhenExpression><![CDATA[Boolean.valueOf( $V{PAGE_NUMBER}.intValue() % 2 == 1 )]]></printWhenExpression>
<textField>
<reportElement x="367" y="17" width="80" height="20" uuid="00d0dc34-6c9f-4265-83c8-b6778d349551"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="459" y="17" width="40" height="20" uuid="fb935dbc-39fb-4589-b6fa-0af65a3c41b9"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>