I am trying to export the excel.when the value is 2.0 from object,in excel sheet it was displaying only 2 it just omit the decimal value.it is working fine when the value us 2.1 ,2.2 etc.
The problem is coming when it is 2.0,3.0.
StringBuffer sb= new StringBuffer();
sb.append("2.0");
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
.getResponse();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=Test.csv");
response.getOutputStream().write(sb.toString().getBytes(Charset.forName("UTF-8")));
response.getOutputStream().flush();
response.getOutputStream().close();
FacesContext.getCurrentInstance().responseComplete();
Please help me to resolve this problem
Aucun commentaire:
Enregistrer un commentaire