Saving a report design
After making changes to an existing report design or creating a new report design, an application can save the design for archival purposes or for future use. To overwrite an existing report design to which the application has made changes, use the ReportDesignHandle.save( ) method. To save a new report design or to keep the original report design after making changes, use the ReportDesignHandle.saveAs( ) method. Alternatively, saving the changes to the report design is unnecessary, call ReportDesignHandle.serialize( ) method. This method returns an output stream. The report engine can generate a report by opening this stream as an input stream.
If no further changes to the report design are necessary, call the method, ReportDesignHandle.close( ), to close the report design, as shown in the following code. The variable, design, is a ReportDesignHandle object.
design.saveAs( "sample.rptdesign" );
design.close( );
Creating a report design
The BIRT APIs support using an application to build a report design and generate the report output without using BIRT Report Designer. Use the createDesign( ) method on the session handle class, SessionHandle, to create a report design. Use the other model classes to create its contents, as shown earlier in this chapter.
How to create a new report design
The following code creates a report design:
SessionHandle session = DesignEngine.newSession( null );
ReportDesignHandle design = session.createDesign( );