当前位置: 代码迷 >> Java Web开发 >> [原创]Birt中用API创建和修改BIRT报表实例
  详细解决方案

[原创]Birt中用API创建和修改BIRT报表实例

热度:163   发布时间:2008-06-20 10:32:36.0
[原创]Birt中用API创建和修改BIRT报表实例
创建和修改BIRT报表是通过使用Model的接口 (org.eclipse.birt.report.model)来完成。下面是一个简单的实例:创建一个report design,添加一个label。

IDesignEngine designEngine = new DesignEngine( new DesignConfig( ) );
SessionHandle sessionHandle = designEngine.newSessionHandle( ULocale.ENGLISH );
ReportDesignHandle reportDesignHandle = sessionHandle.createDesign( );

ElementFactory elementFactory = new ElementFactory( reportDesignHandle.getModule( ) );

LabelHandle labelHandle = elementFactory.newLabel( "label" );
labelHandle.setText( "hello world" );
reportDesignHandle.getBody( ).add( labelHandle );

ModuleHandle moduleHandle = reportDesignHandle.getModuleHandle( );
moduleHandle.saveAs( path + file );
reportDesignHandle.close( );

关注BI关注百灵http://www.actuatechina.com/
搜索更多相关主题的帖子: BIRT报表  API  实例  Birt  report  

----------------解决方案--------------------------------------------------------