Birt 是一个eclipse org的开源项目。它免费,方便的报表开发插件。报表的开发和集成是两个独立的过程。官方地址:
[url]http://www.eclipse.org/birt/phoenix/[/url]
[b]1 环境搭建[/b],下载All-in-One 或者 下载全部的eclipse插件
[url]http://download.eclipse.org/birt/downloads/index2.5.2.php[/url]
[b]2 报表开发[/b]
(i)官方入门视屏教程
[url]http://download.eclipse.org/birt/downloads/examples/reports/2.1/tutorial/tutorial.html[/url]
(ii)安装插件后的eclipse有大量的例子,打开例子的方法只需打开Chart Examples 和 Report Examples两个view。选中view中的例子右击Open就可以导入报表项目。eclipse help里面也有一些报表的基本使用方法。
[b]
3 Java Web应用结成Birt报表[/b]
先下载j2ee应用需要的Runtime,[url]http://download.eclipse.org/birt/downloads/index2.5.2.php[/url],需要的jar包在:ReportEngine\lib。 解压后的结构
[img]http://dl.iteye.com/upload/attachment/268158/69d32498-a6ca-325f-b06f-ea3a8879daaa.jpg[/img]
(i) 使用WebViewer集成web应用
拷贝上面Runtime下面的WebViewerExample到tomcat发布目录既可以运行,也就是说我们把这个应用覆盖我们的web应用就可以了。它实现了导出各种常见文档如pdf,doc,excel等等,还直接支持打印功能。具体使用和参数配置:
[url]http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.php[/url]
常见的集成到jsp的方式是使用<birt:viewer>标签
(ii) 通过servlet集成birt。官方用法
[url]http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1[/url]
其中关键的几个类可以再这里下载[url]http://wiki.eclipse.org/images/2/2c/WebReport2.5.zip[/url]
[b]常见问题及其处理办法:[/b]
1 Debug birt中的脚本使用如下方式
[quote]importPackage(Packages.java.lang);
System.out.println("test==========");
[/quote]
2 取得session
[quote]var session =reportContext.getHttpServletRequest().getSession();
value = session.getAttribute("attribute");
[/quote]
3 改变页面title
[quote]设置传递的参数 __title="自己设"
[/quote]
4 Programmatically hide actions in the Birt Report Viewer Toolbar
[quote]Just open the the following directory up within the viewer plugin
birt\webcontent\birt\pages\control
and
modify the ToolbarFragment.jsp to remove the entries you do not want.
[/quote]
5 Birt Api
[url]http://www.birt-exchange.com/be/documentation/BIRT_231/EngineJavadoc/engine/api/org/eclipse/birt/report/engine/api/EXCELRenderOption.html[/url]
6 Birt 报表参数的使用
[url]http://www.ibm.com/developerworks/cn/opensource/os-cn-ecl-birt/[/url]
7 birt 报表标签在JSP中的使用
[url]http://blog.sina.com.cn/s/blog_602f35650100daje.html[/url]
8 Birt 2.2与struts 1.3.9整合
[url]http://www.eclipseworld.org/bbs/simple/?t14047.html[/url]
[url]http://www.eclipse.org/birt/phoenix/[/url]
[b]1 环境搭建[/b],下载All-in-One 或者 下载全部的eclipse插件
[url]http://download.eclipse.org/birt/downloads/index2.5.2.php[/url]
[b]2 报表开发[/b]
(i)官方入门视屏教程
[url]http://download.eclipse.org/birt/downloads/examples/reports/2.1/tutorial/tutorial.html[/url]
(ii)安装插件后的eclipse有大量的例子,打开例子的方法只需打开Chart Examples 和 Report Examples两个view。选中view中的例子右击Open就可以导入报表项目。eclipse help里面也有一些报表的基本使用方法。
[b]
3 Java Web应用结成Birt报表[/b]
先下载j2ee应用需要的Runtime,[url]http://download.eclipse.org/birt/downloads/index2.5.2.php[/url],需要的jar包在:ReportEngine\lib。 解压后的结构
[img]http://dl.iteye.com/upload/attachment/268158/69d32498-a6ca-325f-b06f-ea3a8879daaa.jpg[/img]
(i) 使用WebViewer集成web应用
拷贝上面Runtime下面的WebViewerExample到tomcat发布目录既可以运行,也就是说我们把这个应用覆盖我们的web应用就可以了。它实现了导出各种常见文档如pdf,doc,excel等等,还直接支持打印功能。具体使用和参数配置:
[url]http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.php[/url]
常见的集成到jsp的方式是使用<birt:viewer>标签
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/birt.tld" prefix="birt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<birt:viewer id="birtViewer" reportDesign="TopNPercent.rptdesign"
pattern="frameset"
height="450"
width="700"
format="html"
></birt:viewer>
</body>
</html>
(ii) 通过servlet集成birt。官方用法
[url]http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1[/url]
其中关键的几个类可以再这里下载[url]http://wiki.eclipse.org/images/2/2c/WebReport2.5.zip[/url]
[b]常见问题及其处理办法:[/b]
1 Debug birt中的脚本使用如下方式
[quote]importPackage(Packages.java.lang);
System.out.println("test==========");
[/quote]
2 取得session
[quote]var session =reportContext.getHttpServletRequest().getSession();
value = session.getAttribute("attribute");
[/quote]
3 改变页面title
[quote]设置传递的参数 __title="自己设"
[/quote]
4 Programmatically hide actions in the Birt Report Viewer Toolbar
[quote]Just open the the following directory up within the viewer plugin
birt\webcontent\birt\pages\control
and
modify the ToolbarFragment.jsp to remove the entries you do not want.
[/quote]
5 Birt Api
[url]http://www.birt-exchange.com/be/documentation/BIRT_231/EngineJavadoc/engine/api/org/eclipse/birt/report/engine/api/EXCELRenderOption.html[/url]
6 Birt 报表参数的使用
[url]http://www.ibm.com/developerworks/cn/opensource/os-cn-ecl-birt/[/url]
7 birt 报表标签在JSP中的使用
[url]http://blog.sina.com.cn/s/blog_602f35650100daje.html[/url]
8 Birt 2.2与struts 1.3.9整合
[url]http://www.eclipseworld.org/bbs/simple/?t14047.html[/url]