struts标签使用,生成word

【后台代码】

 

/***
  * 导出成word
  * @return
  * @throws Exception
  */
 public String exportWord() throws Exception{
  String nmId = super.servletRequest.getParameter("nmId");
  CityInfo cityInfo = this.cityInfoService.view(Long.parseLong(nmId));
  HashMap<String,Object> map = new LinkedHashMap<String,Object>();
  //所属国家/地区
  String nationCode = super.servletRequest.getParameter("nationCode");
  String stNationName = "";
  if("true".equals(nationCode)){
   stNationName = cityInfo.getNation().getStNationName();
   map.put("所属国家/地区",stNationName==null?"":stNationName);
  }
  //友好属性
  String friendshipProp = super.servletRequest.getParameter("friendshipProp");
  String stFriendshipProp = "";
  if("true".equals(friendshipProp)){
   stFriendshipProp = cityInfo.getCfFriendshipProp().getName();
   map.put("友好属性",stFriendshipProp==null?"":stFriendshipProp);
  }
  //城市名称(中文)
  String cityName = super.servletRequest.getParameter("cityName");
  String stCityName = "";
  if("true".equals(cityName)){
   stCityName = cityInfo.getStCityName();
   map.put("城市名称(中文)",stCityName==null?"":stCityName);
  }
  //城市名称(英文)
  String cityNameEn = super.servletRequest.getParameter("cityNameEn");
  String stCityNameEn = "";
  if("true".equals(cityNameEn)){
   stCityNameEn = cityInfo.getStCityNameEn();
   map.put("城市名称(英文)",stCityNameEn==null?"":stCityNameEn);
  }
  //友好关系种类
  String friendshipType = super.servletRequest.getParameter("friendshipType");
  String stFriendshipType = "";
  if("true".equals(friendshipType)){
   stFriendshipType = cityInfo.getCfFriendshipType().getName();
   map.put("友好关系种类",stFriendshipType==null?"":stFriendshipType);
  }
  //所属州/省
  String district = super.servletRequest.getParameter("district");
  String stDistrict = "";
  if("true".equals(district)){
   stDistrict = cityInfo.getStDistrict();
   map.put("所属州/省",stDistrict==null?"":stDistrict);
  }
  //友城级别
  String cityLevel = super.servletRequest.getParameter("cityLevel");
  String stCityLevel = "";
  if("true".equals(cityLevel)){
   stCityLevel = DictInfoAjaxAction.getStaticNameByCode(CommonConst.CITYLEVEL, cityInfo.getStCityLevel());
   map.put("友城级别",stCityLevel==null?"":stCityLevel);
  }
  //结好日期
  String niceDate = super.servletRequest.getParameter("niceDate");
  Date dtNiceDate = null;
  if("true".equals(niceDate)){
   dtNiceDate = cityInfo.getDtNiceDate();
   map.put("结好日期",dtNiceDate==null?"":dtNiceDate);
  }
  //相关网址
  String website = super.servletRequest.getParameter("website");
  String stWebsite = "";
  if("true".equals(website)){
   stWebsite = cityInfo.getStWebsite();
   map.put("相关网址",stWebsite==null?"":stWebsite);
  }
  CityInfoVo cityInfoVo = new CityInfoVo();
  // Bean复制
  BeanUtils.copyProperties(cityInfo, cityInfoVo);
  cityInfoVo.resetDetailStr();
  //城市简况
  String cityBriefingClob = super.servletRequest.getParameter("cityBriefingClob");
  String stCityBriefingClob = "";
  if("true".equals(cityBriefingClob)){
   stCityBriefingClob = cityInfoVo.getClCityBriefingClob();
   map.put("城市简况",stCityBriefingClob==null?"":stCityBriefingClob);
  }
  //结好经过
  String niceCourseClob = super.servletRequest.getParameter("niceCourseClob");
  String stNiceCourseClob = "";
  if("true".equals(niceCourseClob)){
   stNiceCourseClob = cityInfoVo.getClNiceCourseClob();
   map.put("结好经过",stNiceCourseClob==null?"":stNiceCourseClob);
  }
  //备 注
  String remark = super.servletRequest.getParameter("remark");
  String stRemark = "";
  if("true".equals(remark)){
   stRemark = cityInfoVo.getStRemark();
   map.put("备 注",stRemark);
  }
  this.servletRequest.setAttribute("map",map);
  //结好过程
  ShangHaiInfoVo shangHaiInfoVo = new ShangHaiInfoVo();
  shangHaiInfoVo.setNmCityId(Long.parseLong(nmId));
  shangHaiInfoVo.setStType("0");
  shangHaiInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<ShangHaiInfo> lstCourseInfo = shangHaiInfoService.findAll(shangHaiInfoVo, null);
  List<ShangHaiInfoVo> courseInfoVoLst = new ArrayList<ShangHaiInfoVo>();
  for(ShangHaiInfo info:lstCourseInfo){
   ShangHaiInfoVo shangHaiInfoNewVo = new ShangHaiInfoVo();
   BeanUtils.copyProperties(info, shangHaiInfoNewVo);
   if(null != (info.getCfShtype())){
    shangHaiInfoNewVo.setStShtype(info.getCfShtype().getName());
   }   
   courseInfoVoLst.add(shangHaiInfoNewVo);  
  }
  this.servletRequest.setAttribute("courseInfoVoLst",courseInfoVoLst);
  //与上海友城交流情况
  ShangHaiInfoVo ShangHaiInfoVo2 = new ShangHaiInfoVo();
  ShangHaiInfoVo2.setNmCityId(Long.parseLong(nmId));
  ShangHaiInfoVo2.setStType("1");
  ShangHaiInfoVo2.setStDeleted(CommonConst.UNREMOVE);
  
  List<ShangHaiInfo> lstShangHaiInfo = shangHaiInfoService.findAll(ShangHaiInfoVo2, null);
  List<ShangHaiInfoVo> shangHaiInfoVoLst = new ArrayList<ShangHaiInfoVo>();
  for(ShangHaiInfo info:lstShangHaiInfo){
   ShangHaiInfoVo shangHaiInfoNewVo2 = new ShangHaiInfoVo();
   BeanUtils.copyProperties(info, shangHaiInfoNewVo2);
   
   if(null != (info.getCfShtype())){
    shangHaiInfoNewVo2.setStShtype(info.getCfShtype().getName());
   }   
   shangHaiInfoVoLst.add(shangHaiInfoNewVo2);  
  }
  this.servletRequest.setAttribute("shangHaiInfoVoLst",shangHaiInfoVoLst);
  //与中国其他友城关系
  ChinaCityInfoVo chinaCityInfoVo = new ChinaCityInfoVo();
  chinaCityInfoVo.setNmSelectedCityId(Long.parseLong(nmId));
  chinaCityInfoVo.setStType("0");
  chinaCityInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<ChinaCityInfo> lstChinaCityInfo = this.chinaCityInfoService.findAll(chinaCityInfoVo, null);
  this.servletRequest.setAttribute("lstChinaCityInfo",lstChinaCityInfo);
  //与其他国家友城关系

  ChinaCityInfoVo countryInfoVo = new ChinaCityInfoVo();
  countryInfoVo.setNmSelectedCityId(Long.parseLong(nmId));
  countryInfoVo.setStType("1");
  countryInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<ChinaCityInfo> lstCountryInfo = this.chinaCityInfoService.findAll(countryInfoVo, null);
  this.servletRequest.setAttribute("lstCountryInfo",lstCountryInfo);
  //备忘录/协议书

  List<MemorandumInfoVo> memorandumInfoVoLst = new ArrayList<MemorandumInfoVo>();
  MemorandumInfoVo memorandumInfoVo = new MemorandumInfoVo();
  memorandumInfoVo.setNmCityId(Long.parseLong(nmId));
  memorandumInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<MemorandumInfo> lstMemorandumInfo = memorandumInfoService.findAll(memorandumInfoVo, null);
  for(MemorandumInfo memorandumInfo : lstMemorandumInfo){
   memorandumInfo.setBlExchangePrograms(null);
   memorandumInfo.setBlMemorandumContent(null);
   MemorandumInfoVo memorandumInfoNewVo = new MemorandumInfoVo();
   BeanUtils.copyProperties(memorandumInfo, memorandumInfoNewVo);
   memorandumInfoVoLst.add(memorandumInfoNewVo);  
  }
  this.servletRequest.setAttribute("memorandumInfoVoLst",memorandumInfoVoLst);
  //信件
  List<LetterInfoVo> letterInfoVoLst = new ArrayList<LetterInfoVo>();
  LetterInfoVo letterInfoVo = new LetterInfoVo();
  letterInfoVo.setNmCityId(Long.parseLong(nmId));
  letterInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<LetterInfo> lstLetterInfo = letterInfoService.findAll(letterInfoVo, null);
  for(LetterInfo letterInfo : lstLetterInfo){
   letterInfo.setBlCLetterContent(null);
   letterInfo.setBlCLetterContentE(null);
   letterInfo.setBlFLetterContent(null);
   letterInfo.setBlFLetterContentE(null);
   LetterInfoVo letterInfoNewVo = new LetterInfoVo();
   BeanUtils.copyProperties(letterInfo, letterInfoNewVo);
   letterInfoVoLst.add(letterInfoNewVo);  
  }
  this.servletRequest.setAttribute("letterInfoVoLst",letterInfoVoLst);
  //主要领导人
  MajorLeaderShipInfoVo majorLeaderShipInfoVo = new MajorLeaderShipInfoVo();
  majorLeaderShipInfoVo.setNmCityId(Long.parseLong(nmId));
  majorLeaderShipInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<MajorLeaderShipInfo> lstMajorLeaderShipInfo = this.majorLeaderShipInfoService.findAll(majorLeaderShipInfoVo,null);
  List<MajorLeaderShipInfoVo> majorLeaderShipInfoVoLst = new ArrayList<MajorLeaderShipInfoVo>();
  for(MajorLeaderShipInfo majorLeaderShipInfo : lstMajorLeaderShipInfo){
   MajorLeaderShipInfoVo majorLeaderShipInfoNewVo = new MajorLeaderShipInfoVo();
   BeanUtils.copyProperties(majorLeaderShipInfo, majorLeaderShipInfoNewVo);
   if (!StringUtil.isEmpty(majorLeaderShipInfoNewVo.getStSex())){
                String stSex = DictInfoAjaxAction.getStaticNameByCode(CommonConst.SEX, majorLeaderShipInfoNewVo.getStSex());
                if (!StringUtil.isEmpty(stSex))
                 majorLeaderShipInfoNewVo.setStSex(stSex);
         }
   majorLeaderShipInfoVoLst.add(majorLeaderShipInfoNewVo);
  }
  this.servletRequest.setAttribute("majorLeaderShipInfoVoLst",majorLeaderShipInfoVoLst);
  //联系人员
  ContactInfoVo contactInfoVo = new ContactInfoVo();
  contactInfoVo.setNmCityId(Long.parseLong(nmId));
  contactInfoVo.setStDeleted(CommonConst.UNREMOVE);
  List<ContactInfo> lstContactInfo = contactInfoService.findAll(contactInfoVo, null);
  this.servletRequest.setAttribute("lstContactInfo",lstContactInfo);
  //项目管理
  ProjectMgrInfoVo projectMgrInfoVo = new ProjectMgrInfoVo();
  projectMgrInfoVo.setNmCityId(Long.parseLong(nmId));
  projectMgrInfoVo.setStDelete(CommonConst.UNREMOVE);
  List<ProjectMgrInfo> lstProjectMgrInfo = this.projectMgrInfoService.findAll(projectMgrInfoVo, null);
  List<ProjectMgrInfoVo> ProjectMgrInfoVoLst = new ArrayList<ProjectMgrInfoVo>();
  for(ProjectMgrInfo projectMgrInfo : lstProjectMgrInfo){
   projectMgrInfo.getCityInfo().setNation(null);
   ProjectMgrInfoVo projectMgrInfoNewVo = new ProjectMgrInfoVo();
   BeanUtils.copyProperties(projectMgrInfo, projectMgrInfoNewVo);

   if(null != projectMgrInfo.getCfProType()){
    projectMgrInfoNewVo.setStProType(projectMgrInfo.getCfProType().getName());
   } 
   ProjectMgrInfoVoLst.add(projectMgrInfoNewVo);  
  }
  this.servletRequest.setAttribute("ProjectMgrInfoVoLst",ProjectMgrInfoVoLst);
  //出访
  VisitInfoVo visitInfoVo = new VisitInfoVo();
  visitInfoVo.setNmCityId(Long.parseLong(nmId));
  visitInfoVo.setStDeleted(CommonConst.UNREMOVE);
  visitInfoVo.setStType("0");
  List<VisitInfo> lstVisitInfo = visitInfoService.findAll(visitInfoVo, null);
  List<VisitInfoVo> VisitInfoVoLst = new ArrayList<VisitInfoVo>();
  for(VisitInfo visitInfo : lstVisitInfo){
   visitInfo.getCityInfo().setNation(null);
   VisitInfoVo visitInfoNewVo = new VisitInfoVo();
   BeanUtils.copyProperties(visitInfo, visitInfoNewVo);
   if (null != visitInfo.getCfHeadLevel()){
    visitInfoNewVo.setStHeadLevel(visitInfo.getCfHeadLevel().getName());
   }
   if (null != visitInfo.getCfVisitType()){
    visitInfoNewVo.setStVisitType(visitInfo.getCfVisitType().getName());
   }
   if (null != visitInfo.getCfShtype()){
    visitInfoNewVo.setStShtype(visitInfo.getCfShtype().getName());
   }
   VisitInfoVoLst.add(visitInfoNewVo);  
  }
  this.servletRequest.setAttribute("VisitInfoVoLst",VisitInfoVoLst);
  //来访
  VisitInfoVo visitInInfoVo = new VisitInfoVo();
  visitInInfoVo.setNmCityId(Long.parseLong(nmId));
  visitInInfoVo.setStDeleted(CommonConst.UNREMOVE);
  visitInInfoVo.setStType("1");
  List<VisitInfo> lstVisitInInfo = visitInfoService.findAll(visitInInfoVo, null);
  List<VisitInfoVo> VisitInInfoVoLst = new ArrayList<VisitInfoVo>();
  for(VisitInfo visitInfo : lstVisitInInfo){
   visitInfo.getCityInfo().setNation(null);
   VisitInfoVo visitInfoNewVo = new VisitInfoVo();
   BeanUtils.copyProperties(visitInfo, visitInfoNewVo);
   if (null != visitInfo.getCfHeadLevel()){
    visitInfoNewVo.setStHeadLevel(visitInfo.getCfHeadLevel().getName());
   }
   if (null != visitInfo.getCfVisitType()){
    visitInfoNewVo.setStVisitType(visitInfo.getCfVisitType().getName());
   }
   if (null != visitInfo.getCfShtype()){
    visitInfoNewVo.setStShtype(visitInfo.getCfShtype().getName());
   }
   VisitInInfoVoLst.add(visitInfoNewVo);  
  }
  this.servletRequest.setAttribute("VisitInInfoVoLst",VisitInInfoVoLst);
  //相关公文
  OaRelationInfoVo oaRelationInfoForm = new OaRelationInfoVo();
  oaRelationInfoForm.setStRelateType(CommonConst.OA_RELATE_TYPE_CITY);
  oaRelationInfoForm.setStRelateNo2(nmId);
  Page retPage = this.oaRelationInfoService.query2(oaRelationInfoForm, null,1,Integer.MAX_VALUE);
  //相关公文信息List
  List<OaDocumentInfoVo> lstResult = new ArrayList<OaDocumentInfoVo>();
  for(int iLoop = 0; iLoop < retPage.getResult().size(); iLoop++){
   // 取得关联信息
   OaRelationInfo oaRelationInfo = (OaRelationInfo) retPage.getResult().get(iLoop);
   // 创建公文VO对象
   OaDocumentInfoVo oaDocumentInfoVo = new OaDocumentInfoVo();
   // 取得公文信息
   OaDocumentInfo oaDocumentInfo = this.oaDocumentInfoService.view(oaRelationInfo.getNmDocumentId());
   // 设置公文ID
   oaDocumentInfoVo.setNmDocumentId(oaDocumentInfo.getNmDocumentId());
   // 设置公文文号
   oaDocumentInfoVo.setStSymbol(oaDocumentInfo.getStSymbol());
   // 设置公文标题
   oaDocumentInfoVo.setStDocumentName(oaDocumentInfo.getStDocumentName());
   // 设置公文来文单位
   if (oaDocumentInfo.getNmIncomeUnit() != null) {
    CodeInfo codeInfo = this.dictableService.loadCodeInfoById(oaDocumentInfo.getNmIncomeUnit());
    if (codeInfo != null) {
     oaDocumentInfoVo.setStIncomeUnit(codeInfo.getName());
    }
   }
   // 设置状态
   String stStatus = oaDocumentInfo.getStStatus();
   oaDocumentInfoVo.setStStatusName(DictInfoAjaxAction.getStaticNameByCode(CommonConst.OA_DOCUMENT_STATUS, stStatus));
   //备注
   oaDocumentInfoVo.setStDesc(oaRelationInfo.getStDesc());
   
   // 设置公文收文日期
   oaDocumentInfoVo.setDtReceiveStart(oaDocumentInfo.getDtReceive());
   
   lstResult.add(oaDocumentInfoVo);
  }
  this.servletRequest.setAttribute("lstResult",lstResult);
  
  
  String fileName = cityInfo.getStCityName() + "及其相关信息";
  fileName = new String(fileName.getBytes("gbk"),"iso8859-1");
  this.servletResponse.setHeader("Content-disposition","inline; filename=" + fileName + ".doc"); //线上浏览方式
  
  logger.info("进入城市基本情况信息一览画面");
  return SUCCESS;
 }

 

 

<%@ page contentType="application/msword;charset=gb2312" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <title>友城及其相关信息</title>
 <style>
  td{
   text-align:"left";
  }
  
  .title{
   text-align:"center";
  }
  
  .mid{
   text-align:"center";
  }
  
  h1{
   font-size:18px;
  }
 </style>
</head>
<body>
 <h1>城市基本情况</h1>
  <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
   <s:iterator value="#request.map" id="key">   
    <tr>
        <td width="15%"><s:property value="key"/></td>
     <td><s:property escape="false" value="value"/></td>
    </tr>
      </s:iterator>   
  </table>
 <h1>结好过程</h1>
  <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
   <tr>
    <td width="50" class="title">序 号</td>
    <td class="title">交流种类</td>
    <td class="title" width="100">结好日期</td>
    <td class="title">中方人员</td>
    <td class="title">外方人员</td>
   </tr>
   <s:iterator value="#request.courseInfoVoLst" id="courseInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
     <td><s:property value="stShtype"/></td>
     <td class="mid"><s:date name="dtNiceDate" format="yyyy-MM-dd"/></td>
     <td><s:property value="stChineseOfficialsName"/></td>
     <td><s:property value="stForeignWorkersName"/></td>
    </tr>
   </s:iterator>
  </table>
 <h1>与中国其他友城关系</h1>
  <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
   <tr>
    <td class="title" width="50">序 号</td>
    <td class="title">城市名称(中文)</td>
    <td class="title">城市名称(英文)</td>
    <td class="title" width="100">结好日期</td>
   </tr>
   <s:iterator value="#request.lstChinaCityInfo" id="lstChinaCityInfo" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stCityName"/></td>
              <td><s:property value="stCityNameEn"/></td>
              <td class="mid"><s:date name="dtNiceDate" format="yyyy-MM-dd"/></td>
          </tr>
         </s:iterator>
        </table>
    <h1>与其他国家友城关系</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">城市名称(中文)</td>
    <td class="title">城市名称(英文)</td>
    <td class="title">国家名称(中文)</td>
    <td class="title">国家名称(英文)</td>
    <td class="title" width="100">结好日期</td>
   </tr>
   <s:iterator value="#request.lstCountryInfo" id="lstCountryInfo" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stCityName"/></td>
              <td><s:property value="stCityNameEn"/></td>
              <td><s:property value="nationInfo.stNationName"/></td>
              <td><s:property value="nationInfo.stNationNameEn2"/></td>
              <td class="mid"><s:date name="dtNiceDate" format="yyyy-MM-dd"/></td>
          </tr>
         </s:iterator>
        </table>
 <h1>与上海友城交流情况</h1>
  <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
   <tr>
    <td class="title" width="50">序 号</td>
    <td class="title">交流种类</td>
    <td class="title" width="100">交流时间</td>
    <td class="title">中方人员</td>
    <td class="title">外方人员</td>
   </tr>
   <s:iterator value="#request.shangHaiInfoVoLst" id="shangHaiInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
     <td><s:property value="stShtype"/></td>
     <td class="mid"><s:date name="dtNiceDate" format="yyyy-MM-dd"/></td>
     <td><s:property value="stChineseOfficialsName"/></td>
     <td><s:property value="stForeignWorkersName"/></td>
    </tr>
   </s:iterator>
  </table>
 <h1>备忘录/协议书</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">备忘录标题</td>
    <td class="title" width="100">签署日期</td>
    <td class="title">备忘录</td>
    <td class="title">交流项目</td>
   </tr>
   <s:iterator value="#request.memorandumInfoVoLst" id="memorandumInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stMemorandumTitle"/></td>
              <td class="mid"><s:date name="dtSignData" format="yyyy-MM-dd"/></td>
              <td><s:property value="stMemorandumContentName"/></td>
              <td><s:property value="stExchangeProgramsName"/></td>
          </tr>
         </s:iterator>
        </table>
   <h1>信件</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td width="50">序 号</td>
    <td class="title">中方信件名称(中文)</td>
    <td class="title">中方信件名称(英文)</td>
    <td class="title">外方信件名称(中文)</td>
    <td class="title">外方信件名称(英文)</td>
   </tr>
   <s:iterator value="#request.letterInfoVoLst" id="letterInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stCLetterTitle"/></td>
              <td><s:property value="stCLetterTitleE"/></td>
              <td><s:property value="stFLetterTitle"/></td>
              <td><s:property value="stFLetterTitleE"/></td>
          </tr>
         </s:iterator>
        </table>
   <h1>主要领导人</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">领导人中文全名</td>
    <td class="title">领导人外文全名</td>
    <td class="title" width="50">性 别</td>
    <td class="title">职 务</td>
   </tr>
   <s:iterator value="#request.majorLeaderShipInfoVoLst" id="majorLeaderShipInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stLeaderName"/></td>
              <td><s:property value="stLeaderNameEn"/></td>
              <td class="mid"><s:property value="stSex"/></td>
              <td><s:property value="stPost"/></td>
          </tr>
         </s:iterator>
        </table>
  <h1>联系人员</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td width="50">序 号</td>
    <td class="title">联系人(中文全名)</td>
    <td class="title">联系人(外文全名)</td>
    <td class="title">联系人职务(中文)</td>
    <td class="title">联系人职务(外文)</td>
    <td class="title">电 话</td>
    <td class="title">手 机</td>
    <!--
    <td class="title">传 真</td>
    <td class="title">E-mail</td>
    <td class="title">地址(中文)</td>
    <td class="title">地址(外文)</td>
    -->
   </tr>
   <s:iterator value="#request.lstContactInfo" id="lstContactInfo" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stName"/></td>
              <td><s:property value="stNameEn"/></td>
              <td><s:property value="stPost"/></td>
              <td><s:property value="stPostEn"/></td>
              <td><s:property value="stRel"/></td>
              <td><s:property value="stPhoneNumbe"/></td>
              <!--
              <td><s:property value="stFax"/></td>
              <td><s:property value="stEmail"/></td>
              <td><s:property value="stAddress"/></td>
              <td><s:property value="stAddressEn"/></td>
              -->
          </tr>
         </s:iterator>
        </table>
  <h1>项目管理</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td width="50">序 号</td>
    <td class="title">项目名</td>
    <td class="title" width="100">起始日期</td>
    <td class="title" width="100">完成日期</td>
    <td class="title">中方联系人</td>
    <td class="title">外方联系人</td>
   </tr>
   <s:iterator value="#request.ProjectMgrInfoVoLst" id="ProjectMgrInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stProName"/></td>
              <td class="mid"><s:date name="dtStartData" format="yyyy-MM-dd"/></td>
              <td class="mid"><s:date name="dtEndData" format="yyyy-MM-dd"/></td>
              <td><s:property value="stChineseContacts"/></td>
              <td><s:property value="stForeignContacts"/></td>
          </tr>
         </s:iterator>
        </table>
   <h1>出访</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">代表团名称</td>
    <td class="title">团长姓名</td>
    <td class="title" width="50">人 数</td>
    <td class="title">交流种类</td>
    <td class="title" width="100">离沪日期</td>
    <td class="title" width="100">抵沪日期</td>
   </tr>
   <s:iterator value="#request.VisitInfoVoLst" id="VisitInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stDelegationName"/></td>
              <td><s:property value="stHeadName"/></td>
              <td class="mid"><s:property value="nmNum"/></td>
              <td><s:property value="stShtype"/></td>
              <td class="mid"><s:date name="dtLeaveData" format="yyyy-MM-dd"/></td>
              <td class="mid"><s:date name="dtArrivalData" format="yyyy-MM-dd"/></td>
          </tr>
         </s:iterator>
        </table>
   <h1>来访</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">代表团名称</td>
    <td class="title">团长姓名</td>
    <td class="title" width="50">人 数</td>
    <td class="title">交流种类</td>
    <td class="title" width="100">离沪日期</td>
    <td class="title" width="100">抵沪日期</td>
   </tr>
   <s:iterator value="#request.VisitInInfoVoLst" id="VisitInInfoVoLst" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stDelegationName"/></td>
              <td><s:property value="stHeadName"/></td>
              <td class="mid"><s:property value="nmNum"/></td>
              <td><s:property value="stShtype"/></td>
              <td class="mid"><s:date name="dtLeaveData" format="yyyy-MM-dd"/></td>
              <td class="mid"><s:date name="dtArrivalData" format="yyyy-MM-dd"/></td>
          </tr>
         </s:iterator>
        </table>
   <h1>相关公文</h1>
     <table width="100%"  border="1" bordercolor="#000000" cellspacing="0" rules="all" style="border:1px sold black;border-collapse:collapse;">
      <tr>
       <td class="title" width="50">序 号</td>
    <td class="title">文 号</td>
    <td class="title">标 题</td>
    <td class="title">来文单位</td>
    <td class="title">状 态</td>
    <td class="title">备 注</td>
   </tr>
   <s:iterator value="#request.lstResult" id="lstResult" status="dynamic">
    <tr>
     <td class="mid"><s:property value="#dynamic.index+1"/></td>
              <td><s:property value="stSymbol"/></td>
              <td><s:property value="stDocumentName"/></td>
              <td><s:property value="stIncomeUnit"/></td>
              <td><s:property value="stStatusName"/></td>
              <td><s:property value="stDesc"/></td>
          </tr>
         </s:iterator>
        </table>
</body>
</html>

 

 

 

 

在jsp中引用response.setContentType("application/msword");,打开的页面就是word样式。
1、实现word横打:
<style>
@page
 {mso-page-border-surround-header:no;
 mso-page-border-surround-footer:no;}
@page Section1
 {size:841.9pt 595.3pt;//纸张的大小
 mso-page-orientation:landscape;
 margin:89.85pt 72.0pt 89.85pt 72.0pt;
 mso-header-margin:42.55pt;//页眉
 mso-footer-margin:49.6pt;//页脚
 mso-paper-source:0;
 layout-grid:15.6pt;}
div.Section1
 {page:Section1;}
</style>
使用<div class="Section1"></div>即可实现
2、自定义纸张大小纵打
@page
 {mso-page-border-surround-header:no;
 mso-page-border-surround-footer:no;}
@page Section1
 {size: 21.5cm 14.00cm;
 margin-left:0.5cm;//左页边距
 margin-right:0.5cm;//右页边距
 margin-top:0.5cm;//上页边距
 margin-bottom:0.5cm//下页边距;
 mso-header-margin:0.5cm;
 mso-footer-margin:0.5cm;
 layout-grid:0.5pt;}
div.Section1
 {page:Section1;}

你可能感兴趣的:(struts,String,null,iterator,Class,border)