如何在指定格式生成的报表中隐藏textField? [英] How to hide textField in report generated in specified format?

查看:129
本文介绍了如何在指定格式生成的报表中隐藏textField?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JasperReports 4.7,
尝试在导出为pdf,xsl时隐藏文本字段。我尝试过使用
net.sf.jasperreports.export。{format} .exclude.origin。{suffix}。{arbitrary_name} property。

I am using the JasperReports 4.7, Trying to hide a text field while exporting to pdf,xsl. I've tried the using of net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name} property.

它不起作用。有什么建议?

It didn't work. Any suggestions?

推荐答案

你应该使用另一个属性: net.sf.jasperreports.export。{format } .exclude.key。{keyvalue} ,其中 keyvalue 是要排除的元素键。

You should use another property: net.sf.jasperreports.export.{format}.exclude.key.{keyvalue}, where the keyvalue is element's key to exclude.

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="exclude_textfield_sample" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5207ad85-202f-4b93-ba07-39185c10d443">
    <property name="net.sf.jasperreports.export.pdf.exclude.key.tfToHideInPDF"/>
    <title>
        <band height="79" splitType="Stretch">
            <textField>
                <reportElement uuid="11c36fdc-c1ff-4901-a2cc-f939439c83f2" x="87" y="30" width="150" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Text field not to exclude"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="8524232f-a769-478d-9a6d-643548e6555f" key="tfToHideInPDF" x="269" y="30" width="187" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Text field to exclude"]]></textFieldExpression>
            </textField>
        </band>
    </title>
</jasperReport>

在本报告中,我放置了两个 textFields :首先使用 key =tfToHideInPDF pdf 文件中排除,第二个以所有报告的格式显示。

In this report I've placed two textFields: first with key="tfToHideInPDF" to exclude in pdf file and the second for showing in all report's formats.

报告的设计(在 iReport 中):

iFport中使用 RTF预览生成的 rtf 文档是:

The rtf document generated with RTF Preview in iReport is:

iReport 中使用 PDF预览生成的 dpf 文档是:

And the dpf document generated with PDF Preview in iReport is:

例如,如果您想以 rtf 格式隐藏 textField ,您只需添加另一个属性: < property name =net.sf.jas perreports.export.rtf.exclude.key.tfToHideInPDF/> 即可。等等。

If you want to hide textField additionally in rtf format, for example, you should just add another property: <property name="net.sf.jasperreports.export.rtf.exclude.key.tfToHideInPDF"/>. And so on.

这篇关于如何在指定格式生成的报表中隐藏textField?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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