Home >Database >Mysql Tutorial >PentahoReportDesigner入门教程(三)

PentahoReportDesigner入门教程(三)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:03:341506browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn