`
wengsibo
  • 浏览: 83147 次
  • 性别: Icon_minigender_1
  • 来自: 福建
社区版块
存档分类
最新评论

jsp页面导出保存word或Excel几种方法及个人总结

    博客分类:
  • jsp
阅读更多
以下是本人在做EXCEL/WORLD中在网上找的方法及个人总结:

方法1:

<%@ page contentType="application/msword; charset=GBK" %>  //或者vnd.ms-word
<%@ page contentType="application/msexcel; charset=GBK" %> //或者vnd.ms-excel
通过设置可以使原来页面的内容在word或者excel中表现出来。

如果需要把word或者excel文档下载下来,只需在jsp页面上面加上如下代码:
<%
//线上浏览的方式:
response.setHeader("Content-disposition","inline; filename=test1.xls");
//下载的方式:
response.setHeader("Content-disposition","attachment; filename=test2.xls");
//以上这行设定传送到前端浏览器时的档名为test1.xls
//就是靠这一行,让前端浏览器以为接收到一个excel档
%>


方法2:
通过jxl等第三方来操作excel,这种网上资料丰富,
但这种又分两个方法:下面会介绍
1)在服务器端生成文件
String download_path = request.getSession().getServletContext().getRealPath("/") + "***.excel";
	    File file = new File(download_path);  //生成个应的文件

	    WritableWorkbook book = Workbook.createWorkbook(file);
	    WritableSheet sheet = book.createSheet("sheet", 0);
//配置第一行的头	    
  Label cardNoLabel = new Label(0, 0, "卡号");
	    Label cardTypeLabel = new Label(1, 0, "ICCID");
	    Label iccIdLabel = new Label(2, 0, "卡类型");
	    Label version = new Label(3, 0, "版本号");
	    Label m1NoLabel = new Label(4,0,"M1编号");
	    Label errorLabel = new Label(5, 0, "错误原因");
	    sheet.addCell(cardTypeLabel);
	    sheet.addCell(cardNoLabel);
	    sheet.addCell(iccIdLabel);
	    sheet.addCell(errorLabel);
	    sheet.addCell(version);
	    sheet.addCell(m1NoLabel);

//遍历生成相应数据
  for (int i = 0; i < size; i++) {
		String[] objects = cardList.get(i);
		String cardType = objects[0];
		String cardNo = objects[1].startsWith("0000") ? objects[1].substring(4) : objects[1];
		String iccId = objects[2];
		String m1No = objects[3];
		Object cardNoExists = existsQuery.setString(0, cardNo).uniqueResult();
		Object iccIdExists = iccIdQuery.setString(0, iccId).uniqueResult();
		if (cardNoExists != null) {
		    sheet.addCell(new Label(0, i - successNum + 1, cardNo));
		    sheet.addCell(new Label(1, i - successNum + 1, iccId));
		    sheet.addCell(new Label(2, i - successNum + 1, cardType));
		    sheet.addCell(new Label(3, i - successNum + 1, apVersion));
		    sheet.addCell(new Label(4, i - successNum + 1, m1No));
		    sheet.addCell(new Label(5, i - successNum + 1, "卡号已存在"));
		} else if (iccIdExists != null) {
		    sheet.addCell(new Label(0, i - successNum + 1, cardNo));
		    sheet.addCell(new Label(1, i - successNum + 1, iccId));
		    sheet.addCell(new Label(2, i - successNum + 1, cardType));
		    sheet.addCell(new Label(3, i - successNum + 1, apVersion));
		    sheet.addCell(new Label(4, i - successNum + 1, m1No));
		    sheet.addCell(new Label(5, i - successNum + 1, "iccid已存在"));
		} 
	    }
	    book.write();
	    book.close();


2)服务端不生成文件
 // 1.设定好response的相关属性:
	    response.setContentType("application/vnd.ms-excel");
	    // URLEncoder.encode(qList.get("FUNCTION_NAME").toString(), "gbk")
	    String downloadFileName = new String(qList.get("FUNCTION_NAME").toString().getBytes("GBK"), "ISO-8859-1");
	    response.setHeader("Content-Disposition", "attachment;   filename=\"" + downloadFileName + ".xls" + "\"");

	    // 2.取到response的OutputStream实例,并用这个实例化一个WritableWorkbook对象
	    OutputStream os = response.getOutputStream();
	    WritableWorkbook wwb = Workbook.createWorkbook(os);

	    int ncout = resultList.size();
	    int maxnum = 50000; // 一次最多写入量
	    int times = (ncout + maxnum - 1) / maxnum;

	    // 大循环
	    for (int t = 0; t < times; t++) {

		// 新建一张表
		WritableSheet wsheet = wwb.createSheet("members_" + (t + 1), t);
		// 设置表头
		Map<String, Object> tableNameMap = null;
		Label label;
		for (int i = 0; i < tableNameList.size(); i++) {
		    tableNameMap = tableNameList.get(i);
		    label = new Label(i, 0, tableNameMap.get("COLUMN_CHIN").toString());
		    wsheet.addCell(label);
		}

		// 读出数据,往表里加数据行
		int base = (t * maxnum);
		for (int i = 0; i < ncout; i++) {
		    if (i == base + maxnum)
			break;
		    Map<String, Object> resultMap = resultList.get(base + i);
		    int size = 0;
		    Iterator it = resultMap.entrySet().iterator();
		    while (it.hasNext()) {
			Map.Entry entry = (Map.Entry) it.next();
			String value;
			value = entry.getValue() == null ? "" : entry.getValue().toString();
			label = new Label(size, (i + 1), value);
			wsheet.addCell(label);
			size++;
			if (size == tableNameList.size())
			    break;
		    }
		}

	    }// 结束大循环

	    wwb.write();
	    wwb.close();
	    os.close();
	    // 把生成的excel数据输出到response的OutputStream
	    response.flushBuffer();


方法3:

1.用word编辑一个模板,然后另存为HTML
2.在java类里面写velocity 语言代码
String path =getRequest().getSession().getServletContext().getRealPath("/");
	
		String filePath = path+"interview/management/exambatch/";
		VelocityEngine ve = getVelocityEngine(filePath);		//文件模板的路径
		VelocityContext context = new VelocityContext();		
		context.put("list", examineeGroupInfoList);					//把数据加到入context中.这数据可以是list,可以是map,也可以是别的数据类型
		context.put("eximineeGroupInfoCount", eximineeGroupInfoCount);
		int size = examineeGroupInfoList.size();
		context.put("size", size);
		String srcFilename = "examineeGroupInfo_toWord.htm";		//模板文件
		String destFilename = "examineeGroupInfo_toWord.doc";		//通过模板,生成的doc文件名
		Template template;
		try {
			Velocity.init();
			template = ve.getTemplate(srcFilename, "GBK");		
			BufferedWriter writer =
				new BufferedWriter(new FileWriter(filePath+destFilename));	//把生成的文件写到路径中去
			template.merge(context, writer);
			writer.flush();
			writer.close();	
			System.out.println("finish!!");
		} catch (ResourceNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseErrorException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


3.在模板上编辑context中的数据,以下内容主要是velocity语言的for及el表达式来取值的
<!--=================================================================================================-->
<%@ page contentType="application/msword; charset=gb2312" %>
<%@include file="/sys/common/taglibs.jsp"%>
<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="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv="Content-Type" content="application/msword; charset=gb2312" />
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="examineeGroupInfo_toWord.files/filelist.xml">
<title>考生分组情况</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>wsb</o:Author>
  <o:LastAuthor>wsb</o:LastAuthor>
  <o:Revision>2</o:Revision>
  <o:TotalTime>13</o:TotalTime>
  <o:Created>2009-09-07T06:45:00Z</o:Created>
  <o:LastSaved>2009-09-07T06:45:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>19</o:Words>
  <o:Characters>112</o:Characters>
  <o:Company>www.wsb.com</o:Company>
  <o:Lines>1</o:Lines>
  <o:Paragraphs>1</o:Paragraphs>
  <o:CharactersWithSpaces>130</o:CharactersWithSpaces>
  <o:Version>11.9999</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:PunctuationKerning/>
  <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:宋体;
	mso-font-kerning:1.0pt;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:42.55pt;
	mso-footer-margin:49.6pt;
	mso-paper-source:0;
	layout-grid:15.6pt;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:普通表格;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=ZH-CN style='tab-interval:21.0pt;text-justify-trim:punctuation'>

<div class=Section1 style='layout-grid:15.6pt'>

<p class=MsoNormal align=center style='text-align:center'><span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>考生分组情况</span></p>

<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<div align=center>
<!-- 定义一个变量 -->
#set( $task =1 )
<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=660
 style='width:495.0pt;margin-left:-39.6pt;border-collapse:collapse;border:none;
 mso-border-alt:solid windowtext .5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-border-insideh:.5pt solid windowtext;mso-border-insidev:.5pt solid windowtext'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:25.1pt'>
  <td width=180 valign=top style='width:135.0pt;border:solid windowtext 1.0pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>批次名称:</span></b></p>
  </td>
  <td width=480 colspan=3 valign=top style='width:360.0pt;border:solid windowtext 1.0pt;
  border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal><span style='font-family:宋体;mso-ascii-font-family:"Times New Roman";
  mso-hansi-font-family:"Times New Roman"'>
 #set( $task =1 )
  #foreach ($list2 in $list ) 
  #foreach ($list3 in $list2 ) 
  	#if($task==1)
  	$list3.BATCH_NAME 
  	#end
  	#set( $task =$task+1 )
  #end
  #end
  </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1;height:25.1pt'>
  <td width=180 valign=top style='width:135.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>面试开始时间:</span></b></p>
  </td>
  <td width=480 colspan=3 valign=top style='width:360.0pt;border-top:none;
  border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal><span lang=EN-US> 
  #set( $task =1 )
  #foreach ($list2 in $list ) 
  #foreach ($list3 in $list2 ) 
  	#if($task==1)
  		#if ($list3.START_TIME ) <!-- 判断是否为空 -->
  			$list3.START_TIME 
  		#end
  	#end
  	#set( $task =$task+1 )
  #end 
  #end</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:2;height:25.1pt'>
  <td width=180 valign=top style='width:135.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>批次说明:</span></b></p>
  </td>
  <td width=480 colspan=3 valign=top style='width:360.0pt;border-top:none;
  border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal><span style='font-family:宋体;mso-ascii-font-family:"Times New Roman";
  mso-hansi-font-family:"Times New Roman"'>
  #set( $task =1 )
  #foreach ($list2 in $list ) 
  #foreach ($list3 in $list2 ) 
  	#if($task==1)
  		#if ($list3.REMARK) 
  			$list3.REMARK
  		#end
  	#end
  	#set( $task =$task+1 )
  #end
  #end</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3;mso-yfti-lastrow:yes;height:25.15pt'>
  <td width=180 valign=top style='width:135.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>小组数量:</span></b></p>
  </td>
  <td width=168 valign=top style='width:126.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal><span lang=EN-US>$size</span></p>
  </td>
  <td width=84 valign=top style='width:63.0pt;border-top:none;border-left:none;
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>总人数:</span></b></p>
  </td>
  <td width=228 valign=top style='width:171.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal><span lang=EN-US>$eximineeGroupInfoCount</span></p>
  </td>
 </tr>
</table>

</div>

<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<div align=center>
 #foreach ($list2 in $list ) 
<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=660
 style='width:495.0pt;margin-left:-39.6pt;border-collapse:collapse;border:none;
 mso-border-alt:solid windowtext .5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-border-insideh:.5pt solid windowtext;mso-border-insidev:.5pt solid windowtext'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:25.1pt'>
  <td width=120 valign=top style='width:90.0pt;border:solid windowtext 1.0pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>小组名称:</span></b></p>
  </td>
  <td width=540 colspan=4 valign=top style='width:405.0pt;border:solid windowtext 1.0pt;
  border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal><span lang=EN-US>
  #foreach ($list3 in $list2 ) 
  	${list3.GROUP_NAME}
  #end
 </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1;height:25.1pt'>
  <td width=120 valign=top style='width:90.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>姓名</span></b></p>
  </td>
  <td width=156 valign=top style='width:117.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>报考单位部门</span></b></p>
  </td>
  <td width=156 valign=top style='width:117.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>报考单位部门代码</span></b></p>
  </td>
  <td width=120 valign=top style='width:90.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>报考职务</span></b></p>
  </td>
  <td width=108 valign=top style='width:81.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>报考职务代码</span></b></p>
  </td>
 </tr>
 <%--==========================内循坏=============================--%>
 #set($popleNumber = 0)
 #foreach ($list3 in $list2 ) 
 <tr style='mso-yfti-irow:2;height:25.1pt'>
  <td width=120 valign=top style='width:90.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><span
  style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
  "Times New Roman"'>${list3.EXAMINEE_NAME}</span></p>
  </td>
  <td width=156 valign=top style='width:117.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US>${list3.SIGNCOMPANY}</span></p>
  </td>
  <td width=156 valign=top style='width:117.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US>${list3.SIGNCOMPANY_CODE}</span></p>
  </td>
  <td width=120 valign=top style='width:90.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US>${list3.SIGNPOSITION}</span></p>
  </td>
  <td width=108 valign=top style='width:81.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.1pt'>
  <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US>${list3.SIGNPOSITION_CODE}</span></p>
  </td>
 </tr>
 #set($popleNumber = $popleNumber+1)
 #end
 <tr style='mso-yfti-irow:3;mso-yfti-lastrow:yes;height:25.15pt'>
  <td width=120 valign=top style='width:90.0pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><span
  style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#555555'>人数:</span></b></p>
  </td>
  <td width=540 colspan=4 valign=top style='width:405.0pt;border-top:none;
  border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:25.15pt'>
  <p class=MsoNormal><span lang=EN-US>$popleNumber</span></p>
  </td>
 </tr>
</table>
<br>
#end
</div>

<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>
<!--=================================================================================================-->


如有不对的地方,请指出。
2
0
分享到:
评论
1 楼 ws512098112 2012-08-15  
前台怎么跳到后台啊。

相关推荐

    jsp页面中显示word/excel格式的文档的方法

    当你需要在JSP页面上显示或处理Word或Excel这类Office文档时,通常有几种不同的方法可以实现。以下将详细介绍如何在JSP中显示Word和Excel格式的文档。 首先,要让浏览器直接下载Word或Excel文件,而不是在页面上...

    java导出生成word的简单方法

    首先,我们来了解几种常见的Java导出Word文档的解决方案: 1. **Jacob**:Java-COM Bridge,允许Java调用COM组件,如Microsoft Word。但此方法仅适用于Windows平台,有一定的局限性。 2. **Apache POI**:这是一个...

    JAVA动态生成word和pdf

    以下是对几种常用技术的深入分析: ### JAVA动态生成Word文档技术及其优缺点 #### Jacob - **优点**:功能强大,能实现复杂文档的生成与编辑。提供了丰富的API来控制Word文档的各个方面,如文本样式、表格、图像...

    JAVA动态生成word和pdf.doc

    JAVA动态生成Word和PDF是JAVA开发中的一种常见需求,这里将详细介绍JAVA动态生成Word和PDF的几种方案。 生成Word 1. Jacob方案:Jacob是Java-COM Bridge的缩写,在Java与微软的COM组件之间构建了一座桥梁。使用...

    freemarker生成复杂word

    如流程审批单,在流程处理完成后将处理过程按照流程单的要求导出,有时程序中需要实现生成标准Word文档,要求能够打印,并且保持页面样式不变,常见的方案有POI、iText、JACOB、JSP几种方式,POI读取Word文档比较...

    ReadService.7z

    对于Excel文件,Apache POI提供了HSSF和XSSF两个API,分别用于处理.xls(Excel 97-2003格式)和.xlsx(Excel 2007及以上版本的OpenXML格式)文件。在这个项目中,我们可能需要使用到XSSFWorkbook和SXSSFWorkbook类,...

    java实现在线预览,仿百度文库

    在IT行业中,尤其是在Web开发领域,提供在线预览功能是一个常见的需求,比如用户可以在不下载文件的情况下查看Word、Excel或PPT文档。本项目“java实现在线预览,仿百度文库”旨在利用Java技术栈,模拟百度文库的...

    好用的jar包包括sqlsql2000连接数据库包、上传下载包、poi、jxl、jstl

    综上所述,这些jar包在Java开发中扮演着重要的角色,它们分别负责数据库连接、文件上传下载、Excel操作以及JSP页面的简化。了解并掌握这些库的使用,对于提升Java应用程序的功能和性能具有极大的帮助。在实际项目中...

    poi-3.16.zip

    Apache POI是一个开源项目,主要用于处理Microsoft Office格式的文件,如Word(.doc/.docx)、Excel(.xls/.xlsx)和PowerPoint(.ppt/.pptx)等。标题中的"poi-3.16.zip"表明这是一个包含Apache POI 3.16版本的...

    2021-2022计算机二级等级考试试题及答案No.3994.docx

    题目中的选项给出了几种可能的分类,正确的答案是 **C. 数据库应用系统**。Access 不仅是一种数据库管理系统(DBMS),更是一套完整的解决方案,包括了创建数据库表格、设计查询、报表以及开发应用程序等功能。 ###...

    2021-2022计算机二级等级考试试题及答案No.18921.docx

    根据给定文件的信息,我们可以总结出以下几个重要的知识点: ### 数据模型 **1. 层次数据模型** - **定义**: 层次数据模型是最先出现的数据模型之一,它使用树形结构来表示实体及其之间的关系。 - **特点**: 在...

    网管教程 从入门到精通软件篇.txt

    CHK:由Windows磁盘碎片整理器或磁盘扫描保存的文件碎片 CHM:编译过的HTML文件 CHP:Ventura Publisher章节文件 CHR:字符集(字体文件) CHT:ChartViem文件;Harvard Graphics矢量文件 CIF:Adaptec CD 创建...

    2021-2022计算机二级等级考试试题及答案No.19889.docx

    Word文档的默认扩展名是`.doc`或`.docx`,而不是`.xls`或`.xlsx`(这些通常用于Excel文件)。题目中的描述指出Word文档的默认扩展名为`.xls`是错误的。 ### 4. C++函数返回值类型的决定因素 在C++中,函数的返回值...

    驰骋工作流引擎-表单设计器

    用户可以直接操作Excel或Word文件,适用于公文处理和业务报表等场景。这种表单的实现需要感谢第三方组件提供商的支持,如北京点聚公司的组件。 #### 表单设计器的设计原理与组成 表单设计器是表单设计的核心工具,...

Global site tag (gtag.js) - Google Analytics