word模版另存为网页(*.htm,*.html),转为jsp页面并加入数据后导出成word

时间:2024-03-10 17:45:31

word模版另存为网页之后,将html格式的文件转为jsp页面,在页面上加入相应的动态值,加入的值中包含图片,这个该怎么处理??另外导出的文件需要拷贝到不同的地方(无法联网)使用。

 

<%@ page contentType="application/vnd.ms-word; charset=GBK" language="java" import="java.util.*,java.io.*"%>
<%@ taglib uri="tableURI" prefix="Combo" %>
<%response.setContentType("application/msword");%>
<%response.setHeader("Content-Type","application/msword");%>
<%response.setHeader("Content-disposition","attachment;filename=djb.doc");%>
<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="text/html; 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="xmfiles/filelist.xml">
<link rel=Edit-Time-Data href="xm.files/editdata.mso">

<%
 String jc=request.getParameter("jc");
 String dbzt=request.getParameter("dbzt");
try{
 int j=1;
 ArrayList aList = new ArrayList();
 ArrayList aListXjdwid = new ArrayList();
 aListXjdwid = getNominee.selectXjdw();
%>
<body lang=ZH-CN style=\'tab-interval:21.0pt;text-justify-trim:punctuation\'>

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

<%
 for(int k=0;k<aListXjdwid.size();k++){
%>
<p class=MsoNormal style=\'margin-left:-.65pt;mso-para-margin-left:-.06gd\'><span
lang=EN-US style=\'mso-bidi-font-size:14.0pt\'><o:p>代表团:<Combo:code displayStyle="" codeColName="xjdwid" descColName="xjdwname" codeTableName="xjdw" condition=" Display=1 order by Xh" code="<%=aListXjdwid.get(k).toString()%>"/></o:p></span></p>

 

 

jsp中的代码如上,有没有人有好的建议??烦请指导!!