您好,欢迎访问一九零五行业门户网

PentahoReportDesigner入门教程(三)

pentaho report designer 入门教程(三) 采用pentaho report designer5.1版本,也是最新的版本。 一、 安装和介绍 介绍部分内容略,首先安装jdk,并配置java相关环境变量,下载pentaho report并解压,直接运行即可。 二、 第一个示例 三、在swing程序中集成
pentaho report designer 入门教程(三)
采用pentaho report designer5.1版本,也是最新的版本。
一、 安装和介绍
介绍部分内容略,首先安装jdk,并配置java相关环境变量,下载pentaho report并解压,直接运行即可。
二、 第一个示例
三、在swing程序中集成
四、在j2ee程序中集成
? 新建web项目
? 编写ant脚本,编译运行项目
? 测试通过servlet 访问不同文件格式的报表
publicvoid init(servletconfig config)throws servletexception {
classicengineboot.getinstance().start();
super.init(config);
}
protectedvoiddoget(httpservletrequest request,
httpservletresponse response)throws servletexception, ioexception {
try {
resourcemanager manager =new resourcemanager();
manager.registerdefaults();
string reportpath = file:
+ this.getservletcontext().getrealpath(
data/ch2_1.prpt);
resource res =manager.createdirectly(newurl(reportpath),
masterreport.class);
masterreport report = (masterreport)res.getresource();
// determine the output format and renderaccordingly
string outputformat =request.getparameter(outputformat);
if (pdf.equals(outputformat)) {
// render thepdf
response.setcontenttype(application/pdf);
pdfreportutil.createpdf(report,response.getoutputstream());
} elseif (xls.equals(outputformat)) {
// render in excel
response.setcontenttype(application/vnd.ms-excel);
excelreportutil.createxls(report,response.getoutputstream());
} elseif (rtf.equals(outputformat)) {
// render inrtf
response.setcontenttype(application/rtf);
rtfreportutil.creatertf(report,response.getoutputstream());
}
} catch (exception e) {
e.printstacktrace();
}
super.doget(request, response);
}
? jsp或html文件调用servlet
example application
this is an exampleapplication demonstrating how to embed
pentaho reporting into yourweb application.
generate pdf report
generate excel report
generate rtf report
其它类似信息

推荐信息