Jasperreport Excel (.xlsx) datasource

0

I am trying to generate a report using excel(.xlsx) datasource .I have been able to create the datasource in iReport. I add the Report Query by clicking the "Get Field from datasource" button.

And all the fields gets generated as needed. But when i click on preview data it throws an error:

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

The .xlsx file contains some column which have both integer and string values and I think this is the reason for exception.Is there any way to get all the column values as string or any other workaround?

 

I have tried  declaring in jrxml  <field name="InspectionFullNumber" class="java.lang.Object"> <fieldDescription><![CDATA[]]></fieldDescription>  but then too no help.

I really appreciate any pointer

I suspect there should be something to set the cell type to CELL_TYPE_FORMULA before reading the cell content.

cjasper's picture
63
Joined: Jul 24 2012 - 7:20am
Last seen: 1 year 5 months ago
Hi!
 
This type of error is because that Excel conversion try to convert every number column as one of base number types on Java.
 
Just, when you get the fields, try to change the type of each columns from default java.lang.String to java.lang.Integer, java.landg.Float, etc.; corresponding with the original data on columns.
 
You may define date types too. Using java.util.Date
 
With those changes, your problem must be solved.
tauroamp - 5 years 3 months ago

I have changed the fields to correspond t the type of data in the column on the spreadshhet but I am still receivng thie error - Cannot get a text value from a numeric cell

More assistance requested.

Jim P.

 

jkpalmer52 - 4 years 9 months ago

Hello Jim,

Did you got any solution for this,i am also stuck

 

viveknair1234 - 4 years 3 months ago
show 1 more...

Hi,

you need to change the type of the field from the field list in your report not int spreadsheet.

 

mcm - 1 year 3 weeks ago

0 Answers:

No answers yet
Feedback