求:JSP+JavaBean的报表及报表的打印功能的例子, 谁有我也想要一份!谢谢![email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script language="javascript"> function printsetup(){ // 打印页面设置 wb.execwb(8,1); } function printpreview(){ // 打印页面预览 wb.execwb(7,1); } function printit() { if (confirm('确定打印吗?')) { wb.execwb(6,6) } } </script></head><body><OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT><input type=button name=button_print value="打印" onclick="javascript:printit()"><input type=button name=button_setup value="打印页面设置" onclick="javascript:printsetup();"> <input type=button name=button_show value="打印预览" onclick="javascript:printpreview();"> <input type=button name=button_fh value="关闭" onclick="javascript:window.close();">------------------------------------------------关于这个组件还有其他的用法,列举如下:WebBrowser.ExecWB(1,1) 打开Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口Web.ExecWB(4,1) 保存网页Web.ExecWB(6,1) 打印Web.ExecWB(7,1) 打印预览Web.ExecWB(8,1) 打印页面设置Web.ExecWB(10,1) 查看页面属性Web.ExecWB(15,1) 好像是撤销,有待确认Web.ExecWB(17,1) 全选Web.ExecWB(22,1) 刷新Web.ExecWB(45,1) 关闭窗体无提示 up!随便给我一份:[email protected] give me,thanks :[email protected] 我也想要,也给我发一份吧!!![email protected] 谢谢,我也急需[email protected] 可以给我一份吗?[email protected]谢谢!...... [email protected]我也要一份,谢谢 [email protected]我想要,谢谢! [email protected]十分感谢! 现在要有没有晚了一点?[email protected],十分感谢! 学习学习,指教指教^_^[email protected] 谁有我也想要一份!谢谢![email protected] 谁有的请也给我一份谢谢![email protected] 我有一种,你看看可以吗。先用excel做一个摸版,之后用在这个摸版生成一个网页,把网页改成jsp文件。就可以,对了还的加一个头文件,就可以实现数据到入到这个摸版中,用户就可以利用这个打印了 [email protected]谢谢,也给我一份 我也想要一份,[email protected] 强烈关注中 [email protected] <!--统计及格于不及格人数--><%@ page contentType="application/pdf;charset=GB2312"%><%@ page import="java.io.*"%><%@ page import="java.io.FileOutputStream"%><%@ page import="java.io.IOException"%><%@ page import="java.util.*"%><%@ page import="java.text.*"%><%@ page import="java.lang.*"%><%@ page import="java.awt.color.*"%><%@ page import="java.awt.font.*"%><%@ page import="com.lowagie.text.*"%><%@ page import="com.lowagie.text.pdf.*"%><%@ page import="com.lowagie.text.pdf.PdfWriter"%><%@ page import="com.lowagie.text.html.HtmlWriter"%><%Calendar cal=Calendar.getInstance();Date dt=cal.getTime(); //System.out.println(dt); SimpleDateFormat df=new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat df1=new SimpleDateFormat("yyyy年MM月dd日"); //String str=df1.format(dt);%><%String time=df1.format(dt);String pass=request.getParameter("passed");String fail=request.getParameter("failed");String absent=request.getParameter("absent");String total=request.getParameter("total");String filename=df.format(dt);String aPath = application.getRealPath("/");String templateName=aPath + "new/tongji/passorfail.pdf";ByteArrayOutputStream ba = new ByteArrayOutputStream(); try { /*打开已经定义好字段以后的pdf模板*/ PdfReader reader = new PdfReader(templateName); /*将要生成的目标PDF文件名称*/ PdfStamper stamp = new PdfStamper(reader,ba); PdfContentByte under = stamp.getUnderContent(1); /*使用中文字体*/ BaseFont bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED); Font FontChinese = new Font(bf, 12, Font.NORMAL); /*取出报表模板中的所有字段*/ AcroFields form = stamp.getAcroFields(); form.setField("time",time); form.setField("pass",pass); form.setField("fail",fail); form.setField("que",absent); form.setField("total",total); stamp.setFormFlattening(true); /*必须要调用这个,否则文档不会生成的*/ stamp.close(); } catch(DocumentException de) { de.printStackTrace(); System.err.println("A Document error:" +de.getMessage()); } response.setContentType("application/pdf"); response.setHeader("Content-disposition","attachment; filename="+filename+".pdf" ); response.setContentLength(ba.size());try{ServletOutputStream outstream = response.getOutputStream();ba.writeTo(outstream);outstream.flush();outstream.close();ba.close();}catch(IOException e){e.printStackTrace();System.err.println("A Document error:" +e.getMessage());}%> 压力很大;不是很好做!可以用itext做报表打印的 学习学习,谢谢指教。也给我2吧:[email protected] 在JSP里打印怎么将页眉和页脚去掉????? 推荐大家用用用友cell很好用的! 看样子完了,[email protected],谢谢 俺没来晚吧!也给俺一份。谢谢[email protected] 可以用CELL,但是要实现复杂的打印和一些特殊的图表打印,需要使用自己写的浏览器,我有一个这样的浏览器,用DELPHI写的,需要的告诉我! 给我一份可以吗?谢谢了[email protected] 超级想要,一定要给我发一个啊大侠,谢谢了[email protected] 大哥:给我一个:lockty[email protected] 太好了 正是我想要的东西 给我一个可以吗 谢谢!!! [email protected] hh:mm:ss格式的时间如何保存 让外网的访问局域网的我tomcat, 如何将采集的HTML源码 过滤所有HTML标签。得到类似全选复制HTML再粘贴到记事本中的文本效果。 高分求救的白痴问题 如何重设HashMap的value值? tomcat里如何设置session过期时间? 关于读文件路径的问题请教 不知道哪里出了错,求指点啊! 大段文本要加入html,怎么让解析器保留空格和换行(即保留原有格式,不要解析)? 404错误,访问路径出现问题 一个关于环境变量的小问题 Bean中的字符串变量乱码!
function printsetup(){
// 打印页面设置
wb.execwb(8,1);
}
function printpreview(){
// 打印页面预览
wb.execwb(7,1);
} function printit()
{
if (confirm('确定打印吗?')) {
wb.execwb(6,6)
}
}
</script>
</head>
<body>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
<input type=button name=button_print value="打印" onclick="javascript:printit()">
<input type=button name=button_setup value="打印页面设置" onclick="javascript:printsetup();">
<input type=button name=button_show value="打印预览" onclick="javascript:printpreview();">
<input type=button name=button_fh value="关闭" onclick="javascript:window.close();">------------------------------------------------
关于这个组件还有其他的用法,列举如下:
WebBrowser.ExecWB(1,1) 打开
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页面设置
Web.ExecWB(10,1) 查看页面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
[email protected]
[email protected]
[email protected]
谢谢!......
我也要一份,谢谢
我想要,谢谢!
十分感谢!
[email protected]
[email protected]
谢谢,也给我一份
<%@ page contentType="application/pdf;charset=GB2312"%>
<%@ page import="java.io.*"%>
<%@ page import="java.io.FileOutputStream"%>
<%@ page import="java.io.IOException"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.awt.color.*"%>
<%@ page import="java.awt.font.*"%>
<%@ page import="com.lowagie.text.*"%>
<%@ page import="com.lowagie.text.pdf.*"%>
<%@ page import="com.lowagie.text.pdf.PdfWriter"%>
<%@ page import="com.lowagie.text.html.HtmlWriter"%>
<%
Calendar cal=Calendar.getInstance();
Date dt=cal.getTime();
//System.out.println(dt);
SimpleDateFormat df=new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat df1=new SimpleDateFormat("yyyy年MM月dd日");
//String str=df1.format(dt);
%>
<%
String time=df1.format(dt);
String pass=request.getParameter("passed");
String fail=request.getParameter("failed");
String absent=request.getParameter("absent");
String total=request.getParameter("total");
String filename=df.format(dt);
String aPath = application.getRealPath("/");
String templateName=aPath + "new/tongji/passorfail.pdf";
ByteArrayOutputStream ba = new ByteArrayOutputStream();
try {
/*打开已经定义好字段以后的pdf模板*/
PdfReader reader = new PdfReader(templateName);
/*将要生成的目标PDF文件名称*/
PdfStamper stamp = new PdfStamper(reader,ba); PdfContentByte under = stamp.getUnderContent(1); /*使用中文字体*/
BaseFont bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
Font FontChinese = new Font(bf, 12, Font.NORMAL);
/*取出报表模板中的所有字段*/
AcroFields form = stamp.getAcroFields();
form.setField("time",time);
form.setField("pass",pass);
form.setField("fail",fail);
form.setField("que",absent);
form.setField("total",total); stamp.setFormFlattening(true);
/*必须要调用这个,否则文档不会生成的*/
stamp.close();
}
catch(DocumentException de)
{
de.printStackTrace();
System.err.println("A Document error:" +de.getMessage());
} response.setContentType("application/pdf");
response.setHeader("Content-disposition","attachment; filename="+filename+".pdf" );
response.setContentLength(ba.size());
try
{
ServletOutputStream outstream = response.getOutputStream();
ba.writeTo(outstream);
outstream.flush();
outstream.close();
ba.close();
}
catch(IOException e)
{
e.printStackTrace();
System.err.println("A Document error:" +e.getMessage());
}%>
可以用itext做报表打印的
很好用的!
也给俺一份。谢谢
[email protected]
[email protected]
[email protected]
给我一个:
lockty
[email protected]
给我一个可以吗 谢谢!!!
[email protected]