自己封装的poi,itext报表导出代码

页面代码:

<! DOCTYPE HTML PUBLIC  " -//W3C//DTD HTML 4.01 Transitional//EN "   " http://www.w3.org/TR/html4/loose.dtd " >
<% @ page contentType = " text/html; charset=utf-8 "  isELIgnored = " false " %>
<% @ taglib prefix = " c "  uri = " http://java.sun.com/jsp/jstl/core "   %>
<%
    String path 
=  request.getContextPath();
%>
< html >
< head >
    
< meta http - equiv = " Content-Type "  content = " text/html; charset=UTF-8 " >
    
< link rel = " stylesheet "  type = " text/css "  href = " <%=path %>/css/style.css " >
    
< link rel = " stylesheet "  type = " text/css "  href = " <%=path %>/css/easyui.css " >
    
< link rel = " stylesheet "  type = " text/css "  href = " <%=path %>/css/icon.css " >
    
< script type = " text/javascript "  src = " <%=path %>/js/jquery.js " ></ script >
    
< script type = " text/javascript "  src = " <%=path %>/js/jquery.easyui.min.js " ></ script >
    
< script type = " text/javascript "  src = " <%=path %>/js/mouseEvnet.js " ></ script >
    
< script type = " text/javascript "  src = " <%=path %>/js/page.js " ></ script >
    
< script type = " text/javascript "  src = " <%=path %>/js/sorttable.js " ></ script >
    
< script type = " text/javascript " >
      function export_report(type,title)
{
          var tableHeader
= "" ;
          var tableBody
= "" ;
          
// 获取表格信息
          $( " #tableResult tr " ).each(function(i,_tr) {
              $(_tr).children().each(function(k,_td)
{
                  
if (i == 0 ) {
                      tableHeader
+= $.trim($(_td).text()) + " , " ;
                  }
else {
                      tableBody
+= $.trim($(_td).text()) + " ## " ;
                  }

              }
);
              
if (i > 0 ) {
                   tableBody
+= " @@ " ;
              }

          }
);
          
if (tableHeader == "" ) {
              alert(
" 表头未初始化! " );
              
return   false ;
          }

          
if (tableBody == "" ) {
              alert(
" 表格体没内容! " );
              
return   false ;
          }

          $(
" #report_title " ).val(title);
          $(
" #report_type " ).val(type);
          $(
" #report_tableHeader " ).val(tableHeader);
          $(
" #report_tableBody " ).val(tableBody);
          $(
" #report_form " ).submit();
             
      }

    
</ script >
</ head >
    
< body >
< form action = " # "  method = " post "  target = " _self "  name = " naturalPerson "  id = " naturalPerson " >
< c: if  test = " ${list==null||empty list} "  var = " val " >
    
< center >< font color = ' red '  size = 3 > 对不起,没有你要查询的记录 !!!</ font ></ center >
</ c: if >
< c: if  test = " ${!val} " >
    
< div  class = " dispaly-div "   >
    
< table id = " tableResult "  width = " 100% "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 "  style = " border-collapse: collapse; "   class = " sortable " >
      
< thead >
          
< tr style = " cursor: pointer; " >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 户人编号 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 户编号 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 姓名 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 性别 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 现居住地 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 户籍所在地 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 公民身份证号码 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 出生日期 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 民族 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 文化程度 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 户口性质 </ td >
        
< td  height = " 28 "  align = " center "   class = " td_LTBG " > 婚姻状况 </ td >
      
</ tr >
      
</ thead >
      
< c:forEach items = " ${list} "  var = " naturalPerson " >
           
< tr >
               
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.hrbh} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.hbh} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.xm} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.xb} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.xjzd} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.hjszd} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.gmsfzhm} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.csrq} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.mz} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.whcd} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.kuxz} " /></ td >
            
< td  height = " 28 "  align = " center "   class = " td_TRB " >< c:out value = " ${naturalPerson.hyzk} " /></ td >
           
</ tr >
      
</ c:forEach >
     
</ table >
     
</ div >
    
< table width = " 100% "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 " >
        
< tr >
            
< td height = " 25 "  align = " right "   class = " td_RB " >
             
< span style = " margin-right: 20%; " ></sp
分享到:
评论

你可能感兴趣的:(JavaScript,C++,c,css,C#)