Jsp 页面 导出 Word 报表

<%@ page contentType="application/vnd.ms-word; charset=utf-8"%>

<%@ page pageEncoding="utf-8"%>
 
<%  
    String fileName = "检测报告.doc";  
      //对中文文件名编码  
  // fileName = URLEncoder.encode(fileName, "utf-8");  
    byte[] yte = fileName.getBytes("GB2312");  
            String unicoStr = new String(yte, "ISO-8859-1");
   response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);  
%>
<html xmlns:v="urn:schemas-microsoft-com:vml"   
      xmlns:o="urn:schemas-microsoft-com:office:office"   
      xmlns:w="urn:schemas-microsoft-com:office:word"   
      xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"   
      xmlns:st1="urn:schemas-microsoft-com:office:smarttags"   
      xmlns="http://www.w3.org/TR/REC-html40">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<meta name="ProgId" content="Word.Document">  
<meta name="Generator" content="Microsoft Word 12">  
<meta name="Originator" content="Microsoft Word 12">   
<title>JSP页面导出为Word文档</title>  
<style type="text/css">
   body{ font-size:12px; }
    #Tilerifht{text-align:right;padding:0px;margin:0px;font-size: 18px;font-weight: bold;}
    #TB{ border:1px; text-align:center; border:0px; padding:0px; margin:0px;}
    #TB tr td{ border:0px; }
    #TrImg{ text-align:center}
    .bgtitle{ background:#666666;}
    .bgtd{ background:#CCCCCC;}
    #Logo{ text-align:left;padding:0px;margin:0px;font-size: 18px;font-weight: bold;}
</style>
</head>  
<body>
<table width="100%" border="1" id="TB">
  <tr>
    <td height="37" colspan="3" id="Logo"></td>
    <td id="Tilerifht">检测报告</td>
  </tr>
  <tr>
    <td width="293">报告日期</td>
    <td width="343">2013-5-31</td>
    <td width="30">&nbsp;</td>
    <td width="569">&nbsp;</td>
  </tr>
   <tr id="TrImg">
    <td height="207" colspan="2"> <img src="../../../../BRT20120530155830.jpg" height="200" width="320"></td>
    <td colspan="2"><img src="../../../../BRT20120530155830.jpg"  height="200" width="320"></td>
  </tr>
   <tr>
     <td height="26" colspan="2" class="bgtitle">红外图片</td>
     <td colspan="2" class="bgtitle">可见光图片</td>
   </tr>
   <tr>
     <td height="30">测温对象名称:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr class="bgtd">
     <td height="30">图像日期:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr >
     <td height="31">最高温度:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr class="bgtd">
     <td height="30">平均温度:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr>
     <td height="33">设备温度:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr class="bgtitle">
     <td height="29">说明:</td>
     <td colspan="3">&nbsp;</td>
   </tr>
   <tr class="bgtd">
    <td height="29">&nbsp;</td>
    <td colspan="3">&nbsp;</td>
  </tr>
</table>
</body>  
</html>

posted @ 2013-06-07 08:50  小小的小丸子  阅读(515)  评论(0编辑  收藏  举报