jasperreport生成pdf_jasperreport 导出excel_jasperreport json(49)

电脑杂谈  发布时间:2017-02-04 10:28:36  来源:网络整理

height will not be adapted, because it will ruin the already created layout.

Suppressing Null Values Display

If the text field expression returns null, your text field will display the "null" text in the generated

document. A way to avoid this is to set the isBlankWhenNull attribute to "true". By doing

this, the text field will cease to display "null" and will display an empty string. This way nothing will

appear on your document if the text field value is null.

Formatting Output

Of course, when dealing with numeric or date/time values, you could use the Java API to format the

output of the text field expressions yourself. But there is a more convenient way to do it: by using the

pattern attribute available in the <textField> element.

The value you should supply to this attribute is the same that you would supply if it were for you to

format the value using either the java.text.DecimalFormat class or

java.text.SimpleDateFormat class, depending on the type of value to format.

In fact, what the engine does is to instantiate the java.text.DecimalFormat class if the text field

expression returns subclasses of the java.lang.Number class or to instantiate the

java.text.SimpleDataFormat if the text field expression return java.util.Date or

java.sql.Timestamp objects.

For more detail about the syntax of this pattern attribute, check the Java API documentation for those

two classes: java.text.DecimalFormat and java.text.SimpleDateFormat.

The JasperReports Ultimate Guide


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-30468-49.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...