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!

ColdFusion Excel Scientific Notation

Status
Not open for further replies.

Signit

MIS
Oct 17, 2003
114
US
When outputting a query to Excel several long numbers are being converted to scientific notation. Is there anyway to programmatically force Excel to not convert these numbers to scientific notation?

e.g.
Code:
1935489801623778
becomes
1.93549E+15

I've tried putting a ' in front of the number which works, but I don't like the way it looks on the sheet. Any help would be appreciated.
 
In Excel, highlight the cells, go to Format->Cells and in the 'Number' tab select 'Number' and 0 decimal places. This should make Excel show the full number.

Min
 
I appreciate the help, but while I am familiar with formatting in Excel my customer is not. They are willing to tolerate the scientific notation, but I was hoping for a way to force the cell to a particular from ColdFusion (probably wishful thinking I know). Any other ideas?
 
sorry for the many posts but i also found this


it seems like this is a limitation for cf.
if you do something like


<cfif isdefined('form.submit')>



<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=organicSearch.xls">
<cfoutput>
#LSNumberFormat(1935489801623778)#</cfoutput>



<cfelse>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
</cfif>

the excel displays 1,935,489,801,623,770

will this be useful enough?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top