Programming using the BIRT Reporting APIs : Programming the structure of a report design : Opening a report design for editing : How to open a report design for editing
 
How to open a report design for editing
The code sample in Listing 12‑16 creates a DesignEngine object from which to create a SessionHandle object. The code uses the SessionHandle object to open a report design.
Listing 12‑16 Opening a report design for editing
// Create a design engine configuration object.
DesignConfig dConfig = new DesignConfig( );
dConfig.setBIRTHome( "C:/birt-runtime-2_6_0/ReportEngine" );
// Start the platform for a non-RCP application.
Platform.startup( dConfig );
IDesignEngineFactory factory = ( IDesignEngineFactory ) Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );
IDesignEngine dEngine = factory.createDesignEngine( dConfig );
// Create a session handle, using the system locale.
SessionHandle session = dEngine.newSessionHandle( null );
// Create a handle for an existing report design.
String name = "./SimpleReport.rptdesign";
ReportDesignHandle design = null;
try {
design = session.openDesign( name );
} catch (Exception e) {
System.err.println( "Report " + name + " not opened!\nReason is " + e.toString( ) );
return null;
}