1.EXCEL(由于excel软件能识别table格式的数据,所以asp只需要输出table格式的html代码,同时设置好contenttype,增加保存为附件的响应头即可将输出的html代码保存为xls文件
)
<%
Response.ContentType ="application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=表格.xls"
%>
或者
<%
Response.ContentType = "application/excel"
Response.AddHeader "Content-Disposition", "attachment;filename=""xxxx.xls"""
%>
2.WORD
<%
Response.ContentType ="application/vnd.ms-word"
Response.AddHeader "Content-Disposition", "attachment; filename=文档.doc"
%>