jasper
package jasper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.export.JRXlsExporter;
public class JasperReportFill {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
String sourceFileName = "f://jaspertest/report1.jasper";
String printFileName = null;
DataBeanList DataBeanList = new DataBeanList();
ArrayList dataList = DataBeanList.getDataBeanList();
JRBeanCollectionDataSource beanColDataSource =
new JRBeanCollectionDataSource(dataList);
Map parameters = new HashMap();
try {
printFileName = JasperFillManager.fillReportToFile(sourceFileName,
parameters, beanColDataSource);
if (printFileName != null) {
/**
* 1- export to PDF
*/
JasperExportManager.exportReportToPdfFile(printFileName,
"f://sample_report.pdf");
/**
* 2- export to HTML
*/
JasperExportManager.exportReportToHtmlFile(printFileName,
"f://sample_report.html");
/**
* 3- export to Excel sheet
*/
// JRXlsExporter exporter = new JRXlsExporter();
//
// exporter.setParameter(JRExporterParameter.INPUT_FILE_NAME,
// printFileName);
// exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,
// "f://sample_report.xls");
//
// exporter.exportReport();
}
} catch (JRException e) {
e.printStackTrace();
}
}
}
jasper的更多相关文章
- org.apache.jasper.JasperException: Unable to compile class for JSP
项目启动时报错 : The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory S ...
- jasper 常用知识点总结
1.应用: 列头 "YYYY-MM" 格式转化为 "MM YYYY"格式, eg : Date1 = 2014-11 new java.text.SimpleD ...
- Jasper(物联网网络支撑平台公司)的技术为什么这么牛逼?
Jasper在这个行业积累了十几年,合作的运营商超过30个,合作的行业大咖包括了通用.空客.宝马.特斯拉等几千个行业龙头,还是有很多积累下来的优势的. 一是,Jasper通过积累下来的行业应用经验,针 ...
- Tomcat 6 --- 使用Jasper引擎解析JSP
熟悉JAVA web开发的朋友都知道JSP会被转换成java文件(预编译),然后编译成class使用,即按照JSP-->java-->class的过程进行编译. 由于JVM只认识class ...
- HTTP Status 500 - org.apache.jasper.JasperException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException
HTTP Status 500 - org.apache.jasper.JasperException: com.sun.org.apache.xerces.internal.impl.io.Malf ...
- org.apache.jasper.JasperException: Expecting "jsp:param" standard action with "name" and "value" attributes
jasper 英 ['dʒæspə] 美 ['dʒæspɚ] 跟读 口语练习 n. 碧玉:墨绿色 n. (Jasper)人名:(德)雅斯佩尔:(西)哈斯佩尔 JasperException 异 ...
- 报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17) equal symbol expected
现象:写了如下一个jsp文件,导入需要用到的两个包: 运行结果报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17 ...
- Stretch a row if data overflows in jasper reports
My band stretches if necessary with the following conditions, I do not know yours. I have started wi ...
- jasper ireport create a report with parameters without sql query
I'm new in jasper ireport , and I want to know if it is possible to create a report only with static ...
随机推荐
- MVC 3.0 在各个版本IIS中的部署
概述: 最近在做一个MVC 3的项目,在部署服务器时破费了一番功夫,特将过程整理下来,希望可以帮到大家! 本文主要介绍在IIS5.1.IIS6.0.IIS7.5中安装配置MVC 3的具体办法! 正文: ...
- (转载)file_get_contents("php://input")
(转载)http://taoshi.blog.51cto.com/1724747/1165499 $data = file_get_contents("php://input"); ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.2.3
(1). Let $\sed{A_\al}$ be a family of mutually commuting operators. Then, there exists a common Schu ...
- FZU2234 牧场物语 DP
题意:先去再回,不能吃重复的,获取最大值 分析:等价于两个人同时去,不能吃重复的 定义dp[i][j][k]表示从起点走k步,第一个人的横坐标是i,第二个人的横坐标是j的最最大值 这个题和bc上一个回 ...
- Java&MySQL Type Mapping
MySQL Type Name Return value of GetColumnClassName Returned as Java Class BIT(1) (new in MySQL-5.0) ...
- oracle 临时表学习
临时表概念 临时表就是用来暂时保存临时数据(亦或叫中间数据)的一个数据库对象,它和普通表有些类似,然而又有很大区别.它只能存储在临时表空间,而非用户的表空间.ORACLE临时表是会话或事务级别的,只对 ...
- HDOJ-ACM1004(JAVA)
转载声明:原文转自http://www.cnblogs.com/xiezie/p/5502876.html JAVA语言实现: 拿到题目第一反应是用HashMap实现,但是感觉用HashMap实在太浪 ...
- Casio普通计算器编程
用xelatex写了个奇怪的东西……欢乐向 PDF http://files.cnblogs.com/htfy/calc.pdf TEX http://files.cnblogs.com/htfy/ ...
- https原理:证书传递、验证和数据加密、解密过程解析
写的太好了,就是我一直想找的内容,看了这个对https立马明白多了 http://www.cnblogs.com/zhuqil/archive/2012/07/23/2604572.html 我们都知 ...
- Hadoop源码的编译过程详细解读(各版本)
说在前面的话 重新试多几次.编译过程中会出现下载某个包的时间太久,这是由于连接网站的过程中会出现假死,按ctrl+c,重新运行编译命令. 如果出现缺少了某个文件的情况,则要先清理maven(使用命 ...