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
>should work:
>
><td style="mso-number-format:'\@'">00001</td>
>
>
>
>zeroes from disappearing
>
>When I export a file into Excel, the leading zeroes disappear. How do
>you force Excel to treat the codes as text, and leave the zeroes? I need
>something that would act the way the Excel text import wizard does. I've
>tried enclosing the variable with single or double quotes, which sorta
>work, except that the quotes show up in Excel along with the zeroes. 
>
>I have used a couple of custom tags, but they are not preserving the
>leading zeroes so the text is importing into Excel with no leading
>zeroes. 
>
>For example (From CF: 0000 Import into Excel: 0)
>
>FYI: I read an answer using the mso-number-format:\@ style, but I am 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:298080
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to