cjasper Posted June 12, 2014 Share Posted June 12, 2014 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. Link to comment Share on other sites More sharing options...
tauroamp Posted July 3, 2014 Share Posted July 3, 2014 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. Link to comment Share on other sites More sharing options...
jkpalmer52 Posted January 12, 2015 Share Posted January 12, 2015 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 cellMore assistance requested.Jim P. Link to comment Share on other sites More sharing options...
viveknair1234 Posted July 15, 2015 Share Posted July 15, 2015 Hello Jim,Did you got any solution for this,i am also stuck Link to comment Share on other sites More sharing options...
mcm Posted September 24, 2018 Share Posted September 24, 2018 Hi,you need to change the type of the field from the field list in your report not int spreadsheet. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now