Jump to content
Changes to the Jaspersoft community edition download ×

Retain Leading Zeros When Going to Excel


kjmerc5

Recommended Posts

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

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

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

  • 2 years later...

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

  • 2 weeks later...
  • 1 year later...

 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

  • 5 months later...

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 advance

Gobi

Link to comment
Share on other sites

  • 6 years later...
  • 1 year later...

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...