Jump to content

Excel report shows 0 although 0000 is reqd.


inditrozen

Recommended Posts

Hi All,

 

I recently started developing the reports using Jasper and experiencing a problem while showing 0000 String in excel export.

 

Requirement is some id should be shown in the report in four digits like 0000, 0001 and so on. I am passing this Field as a String in a map. It is printed correctly in pdf "0000" but same report in Excel shows it "0".

 

Can somebody help

 

Regards,

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This behaviour is caused by the IS_AUTO_DETECT_CELL_TYPE export flag, which used to be set to true by default for historical reasons. The use of this flag is now deprecated (IS_DETECT_CELL_TYPE can be used instead to achieve a reliable Excel cell type detection), and starting with JasperReports 2.0.3 IS_AUTO_DETECT_CELL_TYPE defaults to false.

 

You'll have to explicitly set IS_AUTO_DETECT_CELL_TYPE to false (or upgrade to >= 2.0.3) to avoid having String text fields interpreted as numbers.

 

HTH,

Lucian

Link to comment
Share on other sites

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