这个跟网上提供的有所不同,所有的输出内容是用标签来实现。
<%@ page language="java" contentType = "application/vnd.ms-excel; charset=gbk"%>
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%
response.setContentType("application/msword");
String filename = new String(("调查报告").getBytes("GBK"),"ISO-8859-1");
response.setHeader("Content-Disposition", "inline; filename=\""+filename+".doc\"");
%>
<html 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>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>调查管理系统</o:Author>
<o:LastAuthor>调查管理系统</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>0</o:TotalTime>
<o:Created>2008-12-12T05:06:00Z</o:Created>
<o:LastSaved>2008-12-12T05:06:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Company>WwW.YlmF.CoM</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:Version>11.9999</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<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;}
h1
{mso-style-next:正文;
margin-top:17.0pt;
margin-right:0cm;
margin-bottom:16.5pt;
margin-left:0cm;
text-align:justify;
text-justify:inter-ideograph;
line-height:240%;
mso-pagination:lines-together;
page-break-after:avoid;
mso-outline-level:1;
font-size:22.0pt;
font-family:"Times New Roman";
mso-font-kerning:22.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]-->
</head>
<body style='tab-interval:21.0pt;text-justify-trim:punctuation'>
<div style='layout-grid:15.6pt'>
<p><span><o:p><br> </o:p></span></p>
</div>
<logic:notEmpty name="list">
<logic:iterate id="listPrint" name="list">
<p align="center"><strong>XX保险股份有限公司调查报告书</strong></p>
<table width="630" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="68" height="28" valign="top"><p align="center">(投)保单(赔案)号</p></td>
<td width="127" valign="top"><p align="center">
<logic:notEmpty name="listPrint" property="claimno">
<bean:write name="listPrint" property="claimno"/>
</logic:notEmpty>
<logic:empty name="listPrint" property="claimno">
<bean:write name="listPrint" property="appno"/>
</logic:empty>
</p></td>
<td width="68" valign="top"><p align="center">被调查人</p></td>
<td width="90" valign="top"><p align="center"><bean:write name="listPrint" property="name"/> </p>
</td>
<td width="64" valign="top"><p align="center">身份证号</p></td>
<td width="199" valign="top"><p align="center"><bean:write name="listPrint" property="pid"/> </p></td>
</tr>
<tr>
<td width="68" valign="top"><p align="center"> </p>
<p align="center">交查目的、内容、途径等</p></td>
<td colspan="5" valign="top">
<p><bean:write name="listPrint" property="invdest"/> </p></td>
</tr>
<tr>
<td width="68" height="56" valign="top"><p align="center"> </p>
<p align="center">调查地点</p>
<p align="center"> </p></td>
<td colspan="5" valign="top"><p><bean:write name="listPrint" property="invaddr"/> </p></td>
</tr>
<tr>
<td width="68" valign="top"><p align="center"> </p>
<p align="center"> </p>
<p align="center">调查经过</p>
<p align="center"> </p>
<p align="center"> </p></td>
<td colspan="5" valign="top"><p><bean:write name="listPrint" property="invprocess"/> </p></td>
</tr>
<tr>
<td width="68" valign="top"><p align="center"> </p>
<p align="center"> </p>
<p align="center">调查结论</p>
<p align="center"> </p>
<p align="center"> </p>
</td>
<td colspan="5" valign="top"><p align="center">
<logic:equal value="0" name="listPrint" property="resultcode">正常件</logic:equal>
<logic:equal value="1" name="listPrint" property="resultcode">异常件</logic:equal>
<logic:equal value="2" name="listPrint" property="resultcode">参考件</logic:equal>
</p>
<p><bean:write name="listPrint" property="invresult"/></p></td>
</tr>
<tr>
<td width="68" valign="top"><p align="center">备注</p>
<p align="center"> </p></td>
<td colspan="5" valign="top"><p> </p>
<p align="right">调查人: <bean:write name="listPrint" property="invgrpman"/> 日期:<bean:write name="listPrint" property="signdate" format="yyyy"/>年<bean:write name="listPrint" property="signdate" format="MM"/>月<bean:write name="listPrint" property="signdate" format="dd"/>日</p></td>
</tr>
<tr>
<td width="68" valign="top"><p align="center">主管意见</p>
<p align="center"> </p></td>
<td colspan="5" valign="top"><p><bean:write name="listPrint" property="notion"/> </p>
<p align="right">调查主管: <bean:write name="listPrint" property="disno"/> 日期:<bean:write name="year"/>年<bean:write name="month"/>月<bean:write name="day"/>日</p></td>
</tr>
</table>
</logic:iterate>
</logic:notEmpty>
<logic:notPresent name="list">
<table align="center">
<tr>
<td align="center" style="color:red">
没有符合条件的记录
</td>
</tr>
</table>
</logic:notPresent>
</body>
</html>
Body部分可以换成自己的内容。
分享到:
相关推荐
五、 用JSP输出Word文档,如何去掉“文件下载”提示? 15 问题文件源代码: 15 回答: 16 六、 怎么把JSP页面上的TABLE输出到EXCEL表中? 16 简单实现如下: 16 属性设置为attachment文件名带日期格式:浏览器下载 16...
myeclipse中直接把jsp中table内容导出到word,一看就懂。
Java对PageOffice编程,从空白的word模板动态生成word文件,填充文本内容、图片,同时设置文本的字体、...不但可以把单独的Word文档动态拼合起来,而且还可以动态填充公文标题、发文号、发文日期、主题词、发文单位等
本文实例讲述了JSP生成WORD文档,EXCEL文档及PDF文档的方法。分享给大家供大家参考,具体如下: 在web-oa系统中,公文管理好象不可或缺,有时需要从数据库中查询一些数据以某种格式输出来,并以word文档的形式展现,...
NULL 博文链接:https://ll-feng.iteye.com/blog/345873
客户要求用程序生成标准的word文档,要能打印,而且不能变形,以前用过很多解决方案,都在客户严格要求下牺牲的无比惨烈。 POI读word文档还行,写文档实在不敢恭维,复杂的样式很难控制不提,想象一下一个20多页,...
本示例演示了使用在JSP中结合NTKO Office文档控件开发的实例。包含从JSP中读取和写入Access数据库的代码。请参阅压缩包中的readme.html进行安装设置。 本安装指南适用于windows 2000平台+ --------------------...
导出word从JSP哪里!
上传内容包括 1,将java后台获取的数据写入...2,将图片导入word文档并导出(注意:导出图片在word模板上需要先随便找张图片先放入指定位置,另存为xml之后打开,将先前放入的图片xml删掉,做个标识符(例如:${abc}))
word页面只要在jsp头... 您可能感兴趣的文章:JSP上传excel及excel插入至数据库的方法JSP导出Excel文件的方法JSP实现从数据库导出数据到Excel下载的方法jsp实现针对excel及word文档的打印方法jsp导出excel并支持分she
Jsp结合Velocity实现依据Word模板文件生成对应数据文件,操作非常灵活,方便。
JavaServer PagesTM (JSP)技术为创建显示动态生成内容的Web页面提供了一个简捷而快速的方法。JSP技术的设计目的是使得构造基于Web的应用程序更加容易和快捷,而这些应用程序能够与各种Web服务器,应用服务器,浏览器...
如流程审批单,在流程处理完成后将处理过程按照流程单的要求导出,有时程序中需要实现生成标准Word文档,要求能够打印,并且保持页面样式不变,常见的方案有POI、iText、JACOB、JSP几种方式,POI读取Word文档比较...
利用插件可以导出WORD文档,已经根据IE的特性新增了一个JS来支持IE8导出,页面中尽量用共通的CSS样式,引入类似bootstrap等UI框架WORD中不会识别样式
人们也可以在本系统之中系统的生成试卷,并且可以直接到处到word文档之中,通过这种方式进一步的简化了教研工作的流程,也在一定的方面促进了教育事业的发展。 系统的主要功能界面:1个人资料管理;2单选题管理,...
java调用PageOffice V4.4实现在线编辑保存Word文件(支持跨浏览器)
系统设计旨在为中小企业IT团队提供一个便捷、高效的API接口文档管理平台,通过在线填写文本框即可生成接口文档,支持文档的轻松管理和一键导出Word文档功能,方便在线和线下分享,有效提高了团队的工作效率。
Jsp图书馆管理系统软件设计(软件源码+数据库+sql+本科毕业论文WORD文档资料) 随着科学技术的进步,计算机行业的迅速发展,大大提高人们的工作效率。计算机信息处理系统的引进已彻底改变了许多系统的经营管理 。 ...
基于Jsp的图书馆管理系统毕业论文(源码+数据库+sql+word毕业论文文档) 摘 要 随着科学技术的进步,计算机行业的迅速发展,大大提高人们的工作效率。计算机信息处理系统的引进已彻底改变了许多系统的经营管理 。 ...