这句话是告诉浏览器接下来的代码是EXCEL格式的,然后浏览器会提示你SAVE OR OPEN 该文件,然后你就可以打开了或保存它了。
看一个例子先:
<%
Response.ContentType = "application/vnd.ms-excel"
%>
由ASP页面转换成EXCEL报表
<%for i=1 to 8%>
<%=1*i%>
<%=2*i%>
<%=3*i%>
<%=4*i%>
<%=5*i%>
<%=6*i%>
<%=7*i%>
<%=8*i%>
<%=9*i%>
<%=10*i%>
<%=11*i%>
<%=12*i%>
<%next%>
=sum(a2:a9)
=sum(b2:b9)
=sum(c2:c9)
=sum(d2:d9)
=sum(e2:e9)
=sum(f2:f9)
=sum(g2:g9)
=sum(h2:h9)
=sum(i2:i9)
=sum(j2:j9)
=sum(k2:k9)
=sum(l2:l9)
把此代码搞到你的机器上,看看效果如何,哈哈,你就偷着乐去吧
等等,还有个小问题:
Microsoft has acknowledged a BUG in IE (3.02, 4.0, 4.01, 4.01sp1) which causes it to misinterpret Excel output, particularly when generated by ASP, ISAPI, or CGI. You can read more about it at http://support.microsoft.com/support/kb/articles/q185/9/78.asp. To summarize: When Internet Explorer connects to a Web server resource that dynamically generates Word, Excel, or other Active Documents, Internet Explorer may send two GET requests for the resource. The second GET usually does not have session state information, temporary cookies, or authentication information that may have already been specified for the client. This bug can affect any local server (EXE) Active Document application hosted inside the Internet Explorer frame window. It occurs most frequently with ISAPI, ASP, or CGI applications that adjust the HTTP "Content Type" header to identify the installed application.
查看所有0条评论>>