Jump to content
We've recently updated our Privacy Statement, available here ×

Reg: Decimal Precision in XLS


eraianbanc

Recommended Posts

Hi All,

When i try to generate a report in XLS format, the zeros in the resultset after decimal point is not displayed when it is exported to xls

Eg: Resultset

123.0000
123.2340

In Excel report im getting these values as

123
123.23

.We use JExcelApiExporter for eporting it to excel in the below code.

Please suggest me how to handle the decima precision in Excel.

I have this field as Double object.

Code:
Connection objDbCon = null;		Map mpDetailSp;        JasperPrint print = null;try		{mpDetailSp 	= new HashMap();mpDetailSp.put("A I Laing Id",new Integer ("1"));            objDbCon = getConnectionProcess("SERVERNAME","employees","devuser","devuser12$");mpDetailSp.put(JRParameter.IS_IGNORE_PAGINATION, true);print		= JasperFillManager.fillReport("D:\\iRepors3.5.1_WS\\1841006_1_0_1.jasper", mpDetailSp, objDbCon);JExcelApiExporter jExcelApiExporter = new JExcelApiExporter();            jExcelApiExporter.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);            jExcelApiExporter.setParameter(JExcelApiExporterParameter.IS_AUTO_DETECT_CELL_TYPE,Boolean.TRUE);jExcelApiExporter.setParameter(JRExporterParameter.JASPER_PRINT, print); jExcelApiExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "D:\\iRepors3.5.1_WS\\TEST_DECIMAL_PRECISION.xls"); jExcelApiExporter.exportReport();catch(Exception objException)            {                objException.printStackTrace();            }            finally            {                objDbCon.close();                objDbCon = null;            }
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Can any one please help us in gettting those Zeros also after the decimal pont when exported as excel. Only when i export the fiels as Double, i ll be able to calculate the sum,avg and all in the excel cells.

Do i need to set any other parameter, while exporting it to excel.??

Rgds,

Erai.

Link to comment
Share on other sites

  • 3 years 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...