做了一个jsp页面,页面就一个table
想导出数据
<% 
response.setHeader("Content-disposition","inline;filename=result.xls"); 
response.setContentType("application nd.ms-excel; charset=GB2312");  
%>table也设置了border
点导出按钮之后,如果直接打开,Excel是有边框的
如果下载到本地,然后打开,就没有边框
有什么办法处理?在线等.....

解决方案 »

  1.   

    无奈啊,今天刚学的一种方法将jsp页面呈现的表格导出到Excel,不知道还可用楼主这种方法。学习
      

  2.   

    JSP页面的边框跟 EXCEL没什么关系吧。
    你只要把 JSP里的单元格的内容填到 EXCEL就行了。
      

  3.   

    如果你想在excel中看到边框,你可以通过jxl或者poi来设置的。
      

  4.   

    应该是有边框的吧 我也做过这样的程序 也 没有发现没有边框啊 只要 table里面有border 应该会有的
      

  5.   

    你这个是直接把页面上的table转化为excel吧,在table style属性里设置边框属性试试。
      

  6.   

    用过你这种和jxl的方法转excel,如果要求不高就现在这种用用,要看到表格就把table属性的边框设为1就可以看到,如果有更多的格式要求,用jxl和poi比较好
      

  7.   

    加上下面的试试,放到head里面
        <!--[if gte mso 9]><xml>
     <x:ExcelWorkbook>
      <x:ExcelWorksheets>
       <x:ExcelWorksheet>
        <x:Name>Sheet1</x:Name>
        <x:WorksheetOptions>
         <x:DefaultRowHeight>285</x:DefaultRowHeight>
         <x:Print>
          <x:ValidPrinterInfo/>
          <x:PaperSizeIndex>9</x:PaperSizeIndex>
          <x:HorizontalResolution>200</x:HorizontalResolution>
          <x:VerticalResolution>200</x:VerticalResolution>
         </x:Print>
         <x:CodeName>Sheet1</x:CodeName>
         <x:Selected/>
         <x:Panes>
          <x:Pane>
           <x:Number>3</x:Number>
           <x:ActiveRow>8</x:ActiveRow>
          </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>4530</x:WindowHeight>
      <x:WindowWidth>8505</x:WindowWidth>
      <x:WindowTopX>480</x:WindowTopX>
      <x:WindowTopY>120</x:WindowTopY>
      <x:AcceptLabelsInFormulas/>
      <x:ProtectStructure>False</x:ProtectStructure>
      <x:ProtectWindows>False</x:ProtectWindows>
     </x:ExcelWorkbook>
    </xml><![endif]-->