日期:2014-05-17  浏览次数:20868 次

导出成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&l