java代码插入wps java读取wps建的excel

用java将数据导出到wps表格中,怎么实现一:页面图片显示预览:
1)如下图:
2)点击导出按钮后预览:
3)最终生成的excel表格图片预览:
二:代码演示:
说明:执行操作时,请先引进导出excel表格的jar文件包 。
找到导出按钮所执行的js方法,在java后天查看该方法的实现即可 。
1)jsp代码:
[html] view plaincopyprint?
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%@taglib prefix="s" uri="/struts-tags" %
%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%
html
head
base href="https://www.04ip.com/post/%=basePath%"
title驾校合格率排名/title
link href="https://www.04ip.com/post/jsp/commonstyle/css/tabStyle.css" rel="stylesheet" type="text/css"
link rel="STYLESHEET" type="text/css" href="https://www.04ip.com/post/%=basePath%jsp/hgltj/js/tablesort.css"
script type="text/javascript" src="/images/defaultpic.gif"/script
script type="text/javascript" src="/images/defaultpic.gif"/script
script type="text/javascript" src="/images/defaultpic.gif"/script
script language="JavaScript"
function load()
{
//根据分辨率设置表格大小
maxw=document.getElementById("maintb").offsetWidth;
if(maxw824){//1024分辨率未展开
mainbox.width="98%";
} else if(maxw1013){//1024分辨率展开
mainbox.width="98%";
} elseif(maxw1081){//1280分辨率未展开
mainbox.width="95%";
} elseif(maxw1270){//1280分辨未展开
mainbox.width="95%";
}else{//1280以上分辨展开
mainbox.width="98%";
}
}
/script
script
function overIt(){
var the_obj = event.srcElement;
if(the_obj.tagName.toLowerCase() == "td"){
the_obj=the_obj.parentElement;
the_obj.oBgc=the_obj.currentStyle.backgroundColor;
the_obj.oFc=the_obj.currentStyle.color;
the_obj.style.backgroundColor='#4073C4';
the_obj.style.color='#ffffff';
the_obj.style.textDecoration='underline';
}
}
function outIt(){
var the_obj = event.srcElement;
if(the_obj.tagName.toLowerCase() == "td"){
the_obj=the_obj.parentElement;
the_obj.style.backgroundColor=the_obj.oBgc;
the_obj.style.color=the_obj.oFc;
the_obj.style.textDecoration='';
}
}
function serch(){
document.getElementById("formName").action="%=basePath %hgltj.action?method=getHglpm";
document.getElementById("formName").submit();
}
function tbbt(){
var jzrq=document.getElementById("jzrqId").value;
//var jxmc=document.getElementById("jxmcId").value;
window.open('%=basePath %hgltj.action?method=getHglpmTbtjjxkshgl.jzrq='+jzrq+'tjjxkshgl.zt='+1,'','height=650,width=1250,top=150,left=200,toobar=no,menubar=no,scrollbars=yes,resizable=no,location=no,');
}
function openwd(){
document.getElementById("formName").action="%=basePath %hgltj.action?method=downJxhglPm";
document.getElementById("formName").submit();
}
/script
/head
BODY onLoad="load()" style="background: url(images/cont_bg.gif); background-repeat: repeat-y"
input type="hidden" name="method" value="https://www.04ip.com/post/getDriverInfoList"/
table border="0" width="100%" cellspacing="0" cellpadding="0" id="maintb"
tr
td align="center"
table width="90%"border="0"cellspacing="0" cellpadding="0" id="mainbox" style="background:url(jsp/commonstyle/images/usermessage_02.gif); background-repeat:repeat-x;"
!--宽度可变内容框--
tr

推荐阅读