由于excel软件能识别table格式的数据,所以asp只需要输出table格式的html代码,同时设置好contenttype,增加保存为附件的响应头即可将输出的html代码保存为xls文件。asp导出excel文件源代码如下
<% Response.ContentType = "application/excel" Response.AddHeader "Content-Disposition", "attachment;filename=""名字.xls""" %> <table> <%for i=1 to 10%> <tr> <td>你的excel单元格内容,有多个自己增加td</td> </tr> <%next %> </table>
吉公网安备 22020202000301号