Programming using the BIRT Reporting APIs : Generating reports from an application : Opening a source for report generation : Understanding an IReportRunnable object
 
Understanding an IReportRunnable object
The IReportRunnable object provides direct access to basic properties of the report design. The names of report design properties are static String fields, such as IReportRunnable.AUTHOR. To access a report design property, use getProperty( ) with a String argument that contains one of these fields.
To generate a report from a design, open the report design as shown in Listing 12‑4. Then, perform the tasks shown later in this chapter.
How to access a report design
Listing 12‑4 shows how to open a report design and find a property value. If the engine cannot open the specified report design, the code destroys the engine. The variable, engine, is a ReportEngine object.
Listing 12‑4 Accessing a report design
String designName = "./SimpleReport.rptdesign";
IReportRunnable runnable = null;
try {
runnable = engine.openReportDesign( designName );
}
catch ( EngineException e ) {
System.err.println ( "Design " + designName + " not found!" );
engine.destroy( );
System.exit( -1 );
}
// Get the value of a simple property.
String title = ( String ) runnable.getProperty
( IReportRunnable.TITLE );