[原创]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.