You might want to try saving the info you want in Excel as a variable using <cfsavecontent>
Then after the <cfheader> output the variable. <cfsavecontent variable="data"> <table> <cfoutput query="Q_ref_table" startrow="#startrow#" maxrows="#maxrows#"> <tr> <cfloop index="i" list="#colList#" delimiters=","> <td style="mso-number-format:\@" OR class="text"> #trim(Q_ref_table[i][currentrow])#</td> </cfloop> </tr> </table> </cfsavecontent> <CFCONTENT type="application/vnd.ms-excel" > <cfheader name="Content-Disposition" value="Attachment; filename=pas_data_ref_report.xls" > <cfoutput> #variables.data# </cfoutput> -----Original Message----- From: Deetra Whatley [mailto:[EMAIL PROTECTED] Sent: Monday, February 04, 2008 1:09 PM To: CF-Talk Subject: Re: How do I export numerical data into Excel and keep the leading zeroes from disappearing But, when I actually import the following code into Excel, the HTML tag and style is imported into the Excel spreadsheet also. <CFCONTENT type="application/vnd.ms-excel" > <cfheader name="Content-Disposition" value="Attachment; filename=pas_data_ref_report.xls" > <cfoutput query="Q_ref_table" startrow="#startrow#" maxrows="#maxrows#"> <tr> <cfloop index="i" list="#colList#" delimiters=","> <td style="mso-number-format:\@" OR class="text"> #trim(Q_ref_table[i][currentrow])#</td> </cfloop> </tr> </cfoutput> >The way I actually do it is to create a class. > ><style type="text/css"> > td.text {mso-number-format:"\@";} ></style> > ><td class="text">00001</td> > >I think you're problem is that the format needs to be quoted. Try the >above. > > > >leading zeroes from disappearing > >I have used that. Here is the code. ><CFCONTENT type="application/vnd.ms-excel" > ><cfheader name="Content-Disposition" value="Attachment; >filename=pas_data_ref_report.xls" > ><cfelseif (exportType IS 'currentpage')> ><cfoutput query="Q_ref_table" startrow="#startrow#" >maxrows="#maxrows#"> ><!--- BEGIN THIS DISPLAYS ACTUAL REFERENCE DATA RESULTS ---> ><tr> ><cfloop index="i" list="#colList#" delimiters=","> ><cfif ListFindNoCase(variables.dateColList,i)> >#DateFormat(Q_ref_table[i][currentrow],"MM/DD/YYYY")# ><cfelse > ><td style="mso-number-format:\@" >>#trim(Q_ref_table[i][currentrow])#</td> </cfif> ></cfloop> ></tr> ><!--- END THIS DISPLAYS ACTUAL REFERENCE DATA RESULTS ---> ></cfoutput> ></cfif> > >It appears in Excel as: ><tr> ><td style="mso-number-format:\@">FBRM</td> ><td style="mso-number-format:\@">1</td> ><td style="mso-number-format:\@">10</td> ><td style="mso-number-format:\@">0000</td> ></tr> > >I am at wits end on this one. > >Thanks. > >You apply that as a style to the specific cells. Something like this >need >>something that would act the way the Excel text import wizard does. >I've >not >>sure how/where to apply this style in my coldfusion code so that the >>Excel spreadsheet reads 0000 instead of 0. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298099 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

