我在ASP中创建了一个excel文件:
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=excel.xls"
Response.ContentType = "application/download"
可以在服务器上保存xls文件 - 下载下载吗?
另一个问题 - 当我在excel上打开xls文件时,我收到有关文件格式的错误。为什么呢?
代码:
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<style>
<!--
@page
{
mso-header-data:"&CDate\: &D\000A<%=strHeader%>";
mso-footer-data:"&CPage &P";
mso-page-orientation:landscape;
margin:1in .3in .6in .4in;
}
br
{
mso-data-placement:same-cell;
mso-width-source:auto;
}
.wborder {
border-color: #FFF;
}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>EXCEL</x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
<x:Panes>
<x:Pane>
<x:Number>3</x:Number>
</x:Pane>
</x:Panes>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<table border="1">
<tr>
<td class="wborder" width="100"></td>
</tr>
</table>
</body>
</html>
tks!!