kjmerc5 Posted July 26, 2006 Share Posted July 26, 2006 I have a model number that has a leading zero that I want retained when I export a report to excel using jasperreports. The problem is excel treats the value as a number and removes the leading zeros. How do I prevent this from happening? The field is of type String and the length of the model number is different from one to another. Thanks! Link to comment Share on other sites More sharing options...
teodord Posted July 26, 2006 Share Posted July 26, 2006 Hi, You should try the new IS_DETECT_CELL_TYPE exporter parameter that was introduced in JR 1.2.5.The former IS_AUTO_DETECT_CELL_TYPE exporter parameter si now deprecated.If your text field in the report template is of a numeric type, the XLS cell will be numeric too, if you set this new parameter to Boolean.TRUE.The String text fields will be left untouched and the leading zeros will be preserved. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
drallpradeep Posted May 30, 2009 Share Posted May 30, 2009 I am also facing the same problem. I have a field carried bank account no. and starting by zero like 007898765432, hide the zero in excel format but display in pdf format.Secondly formatting problem, the same field of account no. display like 1.722E+2 when I execute then I go to formatting cell option in Excel and choose number and decimal = 0, but it is only display the number like 7898765432 not 007898765432. Bank has refused accept my report.Third thing, what is the difference between excel and csv and which one is better. when I call the report throgh java code, it merge all the fields like personalno,name,accountno.amount etc. not display in tabular format.Please suggest.Regards,Pradeep Link to comment Share on other sites More sharing options...
drallpradeep Posted June 8, 2009 Share Posted June 8, 2009 Please reply. Regards,Pradeep Link to comment Share on other sites More sharing options...
lucianc Posted June 9, 2009 Share Posted June 9, 2009 For the leading zeros issue, see Teodor's reply above.Regarding the merged columns in Excel, see this FAQ.Regards,Lucian Link to comment Share on other sites More sharing options...
rrrrkkkk Posted February 4, 2011 Share Posted February 4, 2011 Dear all, i am having the same problem if it's number like 000999999. if it's like 000testtest then it's displaying correctly as 000testtest IS_DETECT_CELL_TYPE this is working fine when the data is 000testtest .it is not working incase of 00000999999 this it is not working. i have tried all the ways like Is_detect cell type and some export parameters also. but nothing is working fine. i am using jasper 2.0.4. pls help regarding this (post me the sample code) or suggest me the export parameters. pls help me regarding this.Post Edited by rrrrkkkk at 02/16/2011 05:21 Link to comment Share on other sites More sharing options...
sk_gobinath Posted July 21, 2011 Share Posted July 21, 2011 Hello All / rrrrkkkk,As rightly pointed by rrrrkkkk this solution IS_DETECT_CELL_TYPE works only for the 00ab324 type datas but it is not working for 000123456... (only numeric).Do let me know if anyone has any solution for this padding 0's for the numeric values.Thanks in advanceGobi Link to comment Share on other sites More sharing options...
shertage Posted July 25, 2011 Share Posted July 25, 2011 Hi,It would be very useful to post a report sample containing the problem here, in order to make it reproducible. Another good step is to specify the JR version that produced this issue.Thank you,sanda Link to comment Share on other sites More sharing options...
sh23195 Posted April 20, 2018 Share Posted April 20, 2018 use "t" + {field_name} in jaspersoft, to retain leading 0's Link to comment Share on other sites More sharing options...
sh23195 Posted April 20, 2018 Share Posted April 20, 2018 Use "t" + {field_name} in jaspersoft, to retain leading 0's Link to comment Share on other sites More sharing options...
sureshmgm92 Posted June 13, 2019 Share Posted June 13, 2019 Hi all ,Above solution ("t" + {field_name}) this is creating a tab space in csv file . can anyone help to retain leading 0's without creating tab space ? 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