只有当它的细节带是页面上的最后一个时才可以打印元素吗? [英] is it possible print element only when its detail band is the last on page?

查看:70
本文介绍了只有当它的细节带是页面上的最后一个时才可以打印元素吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了获得条件,是否有可能只在其细节带是Jasper Reports中的最后一页时才能打印元素?

Is it possible, to get a condition, that I can print an element only when its detail band is the last on page in Jasper Reports?

我们可以在页面上有变量说记录编号。但是我们如何在每个页面上得到计算的总记录?

We can have variable saying record number on the page. But how we get the calculated total record on each page?

推荐答案

这是通过对变量<的重置类型来完成的/ p>

This is done with the "reset type" on a variable

<?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="612" pageHeight="792" columnWidth="612" leftMargin="0" rightMargin="0" topMargin="10" bottomMargin="10" uuid="39852bd8-6125-4359-8d76-06927e7be492">
    <queryString>
        <![CDATA[SELECT ROWNUM N FROM dual  CONNECT BY LEVEL <= 200 ]]>
    </queryString>
    <field name="N" class="java.math.BigDecimal"/>
    <variable name="N_count_page" class="java.lang.Integer" resetType="Page" calculation="Count">
        <variableExpression><![CDATA[$F{N}]]></variableExpression>
    </variable>
    <variable name="N_count_report" class="java.lang.Integer" calculation="Count">
        <variableExpression><![CDATA[$F{N}]]></variableExpression>
    </variable>
    <title>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement uuid="93284d9f-1ee0-4a15-b227-31b55aa2e48b" x="0" y="0" width="376" height="20"/>
                <textElement textAlignment="Center">
                    <font size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Page Count"]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <columnHeader>
        <band height="20">
            <staticText>
                <reportElement uuid="a7113fdd-591b-4fee-9123-981ab75c6fa6" mode="Opaque" x="0" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#000000"/>
                <textElement/>
                <text><![CDATA[N]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="20">
            <textField>
                <reportElement uuid="54bac746-4efb-4412-81bc-b4ba807c60fd" x="0" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{N}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="50">
            <staticText>
                <reportElement uuid="4c685263-0ef7-4a68-a328-39901ef2806f" x="0" y="0" width="100" height="20"/>
                <textElement textAlignment="Right"/>
                <text><![CDATA[Rows on page :]]></text>
            </staticText>
            <textField>
                <reportElement uuid="c65214f1-82dc-476a-8439-087854bbc5c6" x="100" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$V{N_count_page}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="48b37aff-b169-4ca2-b9dd-30c026988f68" x="289" y="30" width="80" height="20"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement uuid="983ccfed-d783-429e-bc6c-3fa488b2e106" x="369" y="30" width="40" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
    <lastPageFooter>
        <band height="64">
            <staticText>
                <reportElement uuid="240e2f86-991a-4fc1-941b-56cc43b28c25" x="0" y="24" width="100" height="20"/>
                <textElement textAlignment="Right"/>
                <text><![CDATA[Rows on report :]]></text>
            </staticText>
            <textField>
                <reportElement uuid="718d4481-4716-4071-9989-27d5119fb428" x="100" y="24" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$V{N_count_report}]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement uuid="f03359be-3bbe-4da8-9bd8-ac024aa6f289" x="369" y="44" width="40" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="ad4aa2c0-9ad8-4892-a16f-0bb584c93916" x="289" y="44" width="80" height="20"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement uuid="b4bdd29a-4ef9-46cc-a57a-df7577bdd73f" x="0" y="0" width="100" height="20"/>
                <textElement textAlignment="Right"/>
                <text><![CDATA[Rows on page :]]></text>
            </staticText>
            <textField>
                <reportElement uuid="39952747-170c-4747-8e2c-0e12ab608ae9" x="100" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$V{N_count_page}]]></textFieldExpression>
            </textField>
        </band>
    </lastPageFooter>
</jasperReport>

这篇关于只有当它的细节带是页面上的最后一个时才可以打印元素吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆