Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

jasper reports - JasperReports: How to format numeric data with Excel exporter

I'm using iReport 2.0.2. I have a problem with formatting numeric data after generating report with help of Excel exporter.

For example, the 85110057689 string is showing as 8.51100e+10 in Excel file (as result of using "preview in Excel" button in iReport).

Please suggest how to change the format to the simple (not scientific).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

We can use net.sf.jasperreports.export.xls.detect.cell.type property for solving issue.

The quote from documentation:

net.sf.jasperreports.export.xls.detect.cell.type

Property whose value is used as default state of the IS_DETECT_CELL_TYPE export flag.

Specifies whether the exporter should take into consideration the type of the original text field expressions and set the cell types and values accordingly.

For example we can set this property for the whole report:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" ...>
    <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...