versha Posted October 23, 2015 Share Posted October 23, 2015 I am usingJasperReport 5.6.1java 1.8Ms-office 2007Exporting to MS excelI have set exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);Patternn used --> #,##0.000Cell display --> 1.700Formula Bar display --> 1.70000004768371But it should show --> 1.700Float data type is used in java.Excel file extension used--> ".xls"content type --> "application/vnd.ms-excel"I have also tried --> ".xlsx" and content type --> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"What's wrong? Link to comment Share on other sites More sharing options...
zh3ntil Posted October 23, 2015 Share Posted October 23, 2015 Actually nothing seems wrong about that. The actual value is 1.70000004768371 on report and report show that value 1.700 because of the pattern you use. So exported excel has the same behavior. actual value ise 1700...71 and formula bar shows that value but in cell, it shows 1.700 like there is a pattern. Everyting seems perfect to me :) Link to comment Share on other sites More sharing options...
versha Posted October 23, 2015 Author Share Posted October 23, 2015 Thanks for quick reply.But report is for customer who wants same data on formula bar as in cell content to avoid any confusion.There should be some way to get out of it. Link to comment Share on other sites More sharing options...
zh3ntil Posted October 23, 2015 Share Posted October 23, 2015 Then you have to scale this value in textfield expression editor. Use sth like $F{field}.setScale(int newScale, RoundingMode roundingMode) Link to comment Share on other sites More sharing options...
versha Posted October 24, 2015 Author Share Posted October 24, 2015 Thanks.It worked fine. 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