Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how export float value to excel 1

Status
Not open for further replies.

fuadhamidov

Programmer
Sep 22, 2003
98
TR
hi
i need to export float value to excel. i use code bellow. i have no problem to export any data type that i need except float. the problem i meet is that when i want to write for example "2.13" it returns to "Feb.13" in excel. you may offer to write "2,13" but i think it is not exact solution. in any excel that decimal separator setted as ',' it does not work.

request.setCharacterEncoding( "windows-1254" );
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename=" + "excel.xls" );
PrintWriter pw = response.getWriter();
pw.println("1,13");
pw.flush();
pw.close();
 
You can try to add a "blank" character before the float. eg " 2.13" instead of "2.13".
 
Make sure you write too many digits for it to be interpreted as a date; i.e.
2.13000 will do the trick,
as will
00002.13
 
thanks for hologram and johnburgess.
i have tried " 2.13" and "2.130". both are successful. i prefer "2.130" because excel define " 2.13" as text, not as number.
and thanks also idarke, but i didn't try it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top