导出到Excel中的ASP改变的12345.678901.0100格式123,456,789,010,100
问题描述:
我们在传统的ASP应用程序(Active Server Pages的)导出到Excel中的ASP改变的12345.678901.0100格式123,456,789,010,100
我们有以下的源代码的数据导出到Excel
<% Response.ContentType="application/vnd.ms-excel"
sqlString = Trim(Request("hiddensqlstring"))
If sqlString <> "" then
set result = cn.execute(sqlString)
%>
<table border="1" style="width:300px;" align="center">
<tr>
<td align="left">ContractNo</b></td>
<td align="left">TotalNo</td>
</tr>
<% do while not result.EOF %>
<tr>
<td align="left"><%=result("ContractNo")%></td>
<td align="right"><%=result("TotalNo")%></td>
</tr>
<% result.MoveNext
loop
%>
</table>
<%Else
Response.Write("<BR> <BR> <P ALIGN=CENTER CLASS=PAGETITLE> Error </P>")
End If%>
导出值后,必须为"12345.678901.0100"
的ContractNo的值才能导出为"123,456,789,010,100"
或有时"12,34,56,78,90,10,100"
。特别是在使用葡萄牙语配置Excel的系统上。
是否有任何设置或格式变化,我必须作出?
答
变化
<td align="left"><%=result("ContractNo")%></td>
要
<td align="left">=<%=result("ContractNo")%></td>
的=告知Excel不要试图改变格式,并把它作为一个设定值
这有什么好做出口,我通过将'Response.ContentType =“application/vnd.ms-excel”'切换到'Response.ContentType =“text/html”''来测试它的值会正确显示,在这种情况下问题出在本地Mac上的区域设置希望开放出口。你可以通过传递'mso-number-format'或类似的东西来覆盖默认值。 – Lankymart
尝试在Excel中使用NumberFormat文本:' –
[Export to Excel使用ASP](http://*.com/questions/584863/export-to-excel-using-asp) – Lankymart