Jump to content
We've recently updated our Privacy Statement, available here ×

Alfanumeric cell in excel


bassi

Recommended Posts

I have this error in column C in this excel there is letter and number , i hope there is mode for bypass the problem

Caused by: net.sf.jasperreports.engine.JRException: Unable to get value for Excel field "COLUMN_2" of class java.lang.String.

                at net.sf.jasperreports.engine.data.AbstractPoiXlsDataSource.getFieldValue(AbstractPoiXlsDataSource.java:392)

                at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1489)

                at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1390)

                at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1366)

                at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1085)

                at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:117)

                at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)

                at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:123)

                at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.IllegalStateException: Cannot get a text value from a numeric cell

                at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:648)

                at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:725)

                at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:708)

                at net.sf.jasperreports.engine.data.AbstractPoiXlsDataSource.getFieldValue(AbstractPoiXlsDataSource.java:309

 

Thanks for help

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Jaspersoft Studio should be default read columns as String.

In your report, click the Dataset and Query Dialog icon. Select "Read Fields" if fields are not yet displayed.

Field Name and Class Type should appear at the bottom of the dialog. Double click on the Class Type of a field that should be a number. Select "java.lang.Integer" is that field should be an integer.

 

Link to comment
Share on other sites

Why don't you just make row 11 into a header band with a different set of fields from below rows 13? This way, row 11 fields can be made into a String and field 13 and below can be made into an Integer.

Another way is to preprocess your data and convert everything into a String. The downside of doing this is that you'll need to put numeric formatting in your preprocessor code instead of in JasperReports.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...