String 中的indexOf方法介绍

一个到出excel的模板,记录下来备用

<%@page import="com.itextpdf.text.log.SysoCounter"%>
<%@ page contentType="application/x-msexcel; charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="com.sinosoft.dboperate.common.CommonOP"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ include file="/jsp/common/taglibs.jsp"%>
<jsp:directive.page import="com.sinosoft.util.tool.JDateToolkit"/>
<jsp:directive.page import="com.sinosoft.util.tool.ParamUtils"/>
<%
    String nowDate = JDateToolkit.getDate4(JDateToolkit.getNowDate2());
    String model_id = ParamUtils.getParameter(request, "model_id");
    String page_id = ParamUtils.getParameter(request, "page_id");
    String userID = ParamUtils.getSession(session, "userID");//得到用户ID
    String companyId = ParamUtils.getSession(session, "companyId");//公司id
    String sql=new String();
    sql+="select substr(i.credate, 1, 10) as cre_date, i.title,i.code,i.yzhperson_name, i.yzhdate, w.nowwfevename,w.nowusername,i.chapter_id,i.subflag,i.banjie_username,i.code_num, i.creusername,to_number(i.yzhname) as yzhname from yz_chapter i left join yz_workflow w on i.chapter_id = w.id  where i.company_id = '"+companyId+"' order by i.code desc";        
    String sql2=new String();
    sql2+="select yz.name,yz.id from yz_chapter_stamp yz";
    Vector vector=CommonOP.getOperateTable().findAll(sql);
    Vector vector2=CommonOP.getOperateTable().findAll(sql2);
    System.out.print(vector);
    String printType = ParamUtils.getParameter(request, "printtype");
    if("quangongsiyongzhang".equals(printType)){
        printType = "全公司用章";
    }
    String fileName = printType+nowDate+".xls";  
    byte[] yte = fileName.getBytes("GBK");  
    String unicoStr = new String(yte, "ISO-8859-1");
    response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);
    request.setAttribute("vect",vector);
    
%>
<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=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="archives_yblist_print.files/filelist.xml">
<link rel=Edit-Time-Data href="archives_yblist_print.files/editdata.mso">
<link rel=OLE-Object-Data href="archives_yblist_print.files/oledata.mso">
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:LastAuthor>奚望</o:LastAuthor>
  <o:LastSaved>2012-11-02T01:36:53Z</o:LastSaved>
  <o:Version>11.5606</o:Version>
 </o:DocumentProperties>
</xml><![endif]-->
<style>
<!--table
    {mso-displayed-decimal-separator:"\.";
    mso-displayed-thousand-separator:"\,";}
@page
    {margin:1.0in .75in 1.0in .75in;
    mso-header-margin:.5in;
    mso-footer-margin:.5in;}
tr
    {mso-height-source:auto;
    mso-ruby-visibility:none;}
col
    {mso-width-source:auto;
    mso-ruby-visibility:none;}
br
    {mso-data-placement:same-cell;}
.style0
    {mso-number-format:General;
    text-align:general;
    vertical-align:middle;
    white-space:nowrap;
    mso-rotate:0;
    mso-background-source:auto;
    mso-pattern:auto;
    color:windowtext;
    font-size:12.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    border:none;
    mso-protection:locked visible;
    mso-style-name:常规;
    mso-style-id:0;}
td
    {mso-style-parent:style0;
    padding-top:1px;
    padding-right:1px;
    padding-left:1px;
    mso-ignore:padding;
    color:windowtext;
    font-size:12.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-number-format:General;
    text-align:general;
    vertical-align:middle;
    border:none;
    mso-background-source:auto;
    mso-pattern:auto;
    mso-protection:locked visible;
    white-space:nowrap;
    mso-rotate:0;}
.xl24
    {mso-style-parent:style0;
    mso-number-format:"\@";}
.xl25
    {mso-style-parent:style0;
    white-space:normal;}
.xl26
    {mso-style-parent:style0;
    mso-number-format:"\@";
    white-space:normal;}
.xl27
    {mso-style-parent:style0;
    text-align:center;
    white-space:normal;}
ruby
    {ruby-align:left;}
rt
    {color:windowtext;
    font-size:9.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-char-type:none;
    display:none;}
-->
</style>
<!--[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:ActiveCol>5</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:ExcelWorksheet>
    <x:Name>Sheet2</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>285</x:DefaultRowHeight>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet3</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>285</x:DefaultRowHeight>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>8445</x:WindowHeight>
  <x:WindowWidth>11715</x:WindowWidth>
  <x:WindowTopX>240</x:WindowTopX>
  <x:WindowTopY>15</x:WindowTopY>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>
</xml><![endif]-->
</head>

<body link=blue vlink=purple>

<table x:str border=0 cellpadding=0 cellspacing=0 width=1273 style='border-collapse:
 collapse;table-layout:fixed;width:956pt'>
 <col width=44 style='mso-width-source:userset;mso-width-alt:1408;width:33pt'>
 <col width=113 style='mso-width-source:userset;mso-width-alt:3616;width:85pt'>
 <col width=174 style='mso-width-source:userset;mso-width-alt:5568;width:131pt'>
 <col width=160 style='mso-width-source:userset;mso-width-alt:5120;width:120pt'>
 <col class=xl24 width=301 style='mso-width-source:userset;mso-width-alt:9632;
 width:226pt'>
 <col width=177 style='mso-width-source:userset;mso-width-alt:5664;width:133pt'>
 <col width=171 style='mso-width-source:userset;mso-width-alt:5472;width:128pt'>
 <col width=133 style='mso-width-source:userset;mso-width-alt:4256;width:100pt'>
 <tr height=19 style='height:14.25pt'>

      <td height=19 class=xl25 width=44 style='height:14.25pt;width:33pt'>序号</td>
      <td class=xl25 width=160 style='width:120pt'>编号</td>
      <td class=xl26 width=301 style='width:226pt'>标题</td>
       <td class=xl25 width=177 style='width:133pt'>用章人</td>
      <td class=xl25 width=171 style='width:128pt'>印章名称</td>
      <td class=xl25 width=177 style='width:133pt'>用章日期</td>
      <td class=xl25 width=171 style='width:128pt'>处理状态</td>
      <td class=xl25 width=133 style='width:100pt'>当前处理人</td>
 </tr>

 <c:forEach var="out" varStatus="s" items="${vect}">
 <tr height=19 style='height:14.25pt'>
         <td height=19 class=xl27 width=44 style='height:14.25pt;width:33pt'><c:out value="${s.index+1}"/></td>
        <td class=xl27 width=113 style='width:85pt'><c:out value="${out.CODE}"/></td>
        <td class=xl25 width=174 style='width:131pt'><c:out value="${out.TITLE}"/></td>
        <td class=xl25 width=160 style='width:120pt'><c:out value="${out.YZHPERSON_NAME }"/></td>
        <td class=xl26 width=301 style='width:226pt'><c:out value="${out.YZHNAME}"/></td>
        <td class=xl25 width=171 style='width:128pt'><c:out value="${out.YZHDATE}"/></td>
    <c:choose>
       <c:when test="${out.SUBFLAG=='00'}">
      <td class=xl25 width=177 style='width:133pt'><c:out value="草稿"/></td>
      <td class=xl25 width=171 style='width:128pt'><c:out value="${out.YZHPERSON_NAME}"/></td>
       </c:when>
       <c:when test="${out.SUBFLAG=='02'}">
      <td class=xl25 width=177 style='width:133pt'><c:out value="办结"/></td>
      <td class=xl25 width=171 style='width:128pt'><c:out value="${out.YZHPERSON_NAME}"/></td>
       </c:when>
      <c:otherwise>
      <td class=xl25 width=177 style='width:133pt'><c:out value="${out.NOWWFEVENAME}"/></td>
      <td class=xl25 width=171 style='width:128pt'><c:out value="${out.NOWUSERNAME}"/></td>
      </c:otherwise>
     </c:choose>    
 </tr>
 </c:forEach>
 <![if supportMisalignedColumns]>
 <tr height=0 style='display:none'>
  <td width=44 style='width:33pt'></td>
  <td width=113 style='width:85pt'></td>
  <td width=174 style='width:131pt'></td>
  <td width=160 style='width:120pt'></td>
  <td width=301 style='width:226pt'></td>
  <td width=177 style='width:133pt'></td>
  <td width=171 style='width:128pt'></td>
  <td width=133 style='width:100pt'></td>
 </tr>
 <![endif]>
</table>

</body>

</html>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值