If you are installing BIRT 3.7 or later See BIRT 3.7 Migration Guide.
It is no longer necessary to set BIRT Home in the DesignConfig class. Just add the BIRT jars to your classpath/buildpath.
A report design consist of three key concepts:
The BIRT Design Engine API (DEAPI) provides a number of services to applications that work with report designs:
To create an application that uses the DEAPI, you'll need the design engine SDK.
At present, you'll need to download the project source code and build the Javadoc yourself. In time, the Javadoc will be available as part of a BIRT download. The model Jar is available as part of the runtime download.
This API is described in Javadoc in the
org.eclipse.birt.report.model.api package within the
org.eclipse.birt.report.model project. Read the package overview for general information about getting started with this API.
The following code shows a simple example that creates a working report design. Here are the files you'll need:
The first step is to create an instance of the design engine.
SessionHandle session = DesignEngine.newSession( null );
Then, create a new report design.
ReportDesignHandle design = session.createDesign( );
Next, get the "element factory" that creates new elements within your design:
ElementFactory factory = design.getElementFactory( );
Next, we add a page master that determines how the report will appear when printed:
DesignElementHandle element = factory.newSimpleMasterPage( "Page Master" );
design.getMasterPages( ).add( element );
This design will contain a grid that contains an image and a label. Let's first create the grid and add it to the report's body slot.
GridHandle grid = factory.newGridItem( null, 2 /* cols */, 1 /* row */ );
design.getBody( ).add( grid );
grid.setWidth( "100%" );
Next, create the image and add it to the first cell within the grid.
RowHandle row = (RowHandle) grid.getRows( ).get( 0 );
ImageHandle image = factory.newImage( null );
CellHandle cell = (CellHandle) row.getCells( ).get( 0 );
cell.getContent( ).add( image );
Then, create a label and add it to the second cell.
LabelHandle label = factory.newLabel( null );
cell = (CellHandle) row.getCells( ).get( 1 );
cell.getContent( ).add( label );
label.setText( "Hello, world!" );
Finally, save and close the report design.
design.saveAs( "sample.rptdesign" );
You can now open the design within BIRT and preview it.
Several Examples, PPT files and Webinars are available on BIRT-Exchange: