本站首页    管理页面    写新日志    退出


«October 2025»
1234
567891011
12131415161718
19202122232425
262728293031


公告

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:KENWOOD
日志总数:8
评论数量:13
留言数量:0
访问次数:60013
建立时间:2006年7月31日




JAVA 恶梦的开始
软件技术

Triger 发表于 2006/8/1 8:34:12

如何在Eclispe中用JAVA设用BIRT报表:---好东西共享(参考BIRT API 官方网站) 1:如下是全部代码 2:如果生成PDF,请将 options.setOutputFormat("html"); 改成 options.setOutputFormat("PDF"); 文件扩展名也要改为相应的PDF 3:加入com.ibm.icu_3.4.4.1.Jar \js.jar\coreapi.jar\engineapi.jar到 BUILD PATH 中 4:PDF记录有中文时出现乱码,请将itext-1.3放在 INSTALLDIR\birt-runtime-2_1_0 \ReportEngine\plugins\com.lowagie.itext\lib 5:本人用的是Eclispe 3.2,JDK1.4,BIRT2.1 package user; import java.util.HashMap; import java.util.logging.Level; import org.eclipse.birt.core.framework.Platform; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.engine.api.EngineConstants; import org.eclipse.birt.report.engine.api.EngineException; import org.eclipse.birt.report.engine.api.HTMLActionHandler; import org.eclipse.birt.report.engine.api.HTMLEmitterConfig; import org.eclipse.birt.report.engine.api.HTMLRenderContext; import org.eclipse.birt.report.engine.api.HTMLRenderOption; import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; import org.eclipse.birt.report.engine.api.IReportEngine; import org.eclipse.birt.report.engine.api.IReportEngineFactory; import org.eclipse.birt.report.engine.api.IReportRunnable; import org.eclipse.birt.report.engine.api.IRunAndRenderTask; public class ExecuteReport { static void executeReport() throws EngineException{ IReportEngine engine=null; EngineConfig config = null; try{ //Configure the Engine and start the Platform config = new EngineConfig( ); config.setEngineHome( "C:/eclipse/workspace/ReportDrive/birt-runtime-2_1_0/ReportEngine" ); config.setLogConfig(null, Level.FINE); Platform.startup( config ); IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); engine = factory.createReportEngine( config ); engine.changeLogLevel( Level.WARNING ); }catch( Exception ex){ ex.printStackTrace(); } IReportRunnable design = null; //Open the report design design = engine.openReportDesign("C:/eclipse/workspace/html/ken.rptdesign"); IRunAndRenderTask task = engine.createRunAndRenderTask(design); //Set rendering options - such as file or stream output, //output format, whether it is embeddable, etc HTMLRenderOption options = new HTMLRenderOption(); options.setOutputFileName("C:/eclipse/workspace/html/ken.htm"); //Set output format options.setOutputFormat("html"); task.setRenderOption(options); //run the report and destroy the engine //Note - If the program stays resident do not shutdown the Platform or the Engine task.run(); task.close(); engine.shutdown(); Platform.shutdown(); System.out.println("Finished"); System.exit(0); } public static void main(String[] args) { try { executeReport( ); } catch ( Exception e ) { e.printStackTrace(); } } }


阅读全文(2767) | 回复(1) | 编辑 | 精华
 


回复:JAVA 恶梦的开始
软件技术

runnnn(游客)发表评论于2006/9/4 12:17:17

怎么不排版呢,这样太难看啊


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 1.342 second(s), page refreshed 144810039 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号