首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

导出成excel.解决思路

2013-01-05 
导出成excel.在用asp导出成excel文件如果某列导出到excel后,内容过长,..导出后让excel自动换行,,请问asp导

导出成excel.
在用asp导出成excel文件

如果某列导出到excel后,内容过长,..导出后让excel自动换行,,请问asp导出成excel,能做到吗??谢...
[解决办法]
输出个页面,设置contentType 好了

<%@ codepage="65001" language="vbscript"%>
<%

Response.ContentType "application/vnd.ms-excel"
Response.addHeader "Content-Disposition", "attachment; filename=abc.xls"

%>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<!--[if gte mso 9]><xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>285</x:DefaultRowHeight>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>2</x:ActiveRow>
       <x:ActiveCol>1</x:ActiveCol>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>9090</x:WindowHeight>
  <x:WindowWidth>11715</x:WindowWidth>
  <x:WindowTopX>240</x:WindowTopX>
  <x:WindowTopY>90</x:WindowTopY>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body>
<table border="1" cellspacing="1" cellpadding="1">  
     <tr><td colspan="5" align="center">WEB页面导出为EXCEL文档的方法</td></tr>
     <tr>
         <td>列标题1</td>
         <td>列标题2</td>
         <td>列标题3</td>
         <td>列标题4</td>
         <td>列标题5</td>
     </tr>
     <tr>
         <td>aaa</td>
         <td>bbb</td>
         <td>ccc</td>
         <td>ddd</td>
         <td>eee</td>
     </tr>
     <tr>


         <td>AAA</td>
         <td>BBB</td>
         <td>CCC</td>
         <td>DDD</td>
         <td>EEE</td>
     </tr>
     <tr>
         <td>FFF</td>
         <td>GGG</td>
         <td>HHH</td>
         <td>III</td>
         <td>JJJ</td>
     </tr>
</table>
</body>
</html>

热点排行
Bad Request.