Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » BIRT API
BIRT API [message #58601] Fri, 15 July 2005 03:19 Go to next message
Eclipse UserFriend
Originally posted by: zszqcym.yahoo.com.cn

hi!
I'm a chinese.I use birt and eclipse .I want to creat a report in
java code.
My question is :How can I write a new *.rptdisign file by bird's
api ?
eg.Write datasource and dataset's property into a *.rpt in java.
Thank you for your help!
Re: BIRT API [message #59219 is a reply to message #58601] Sat, 16 July 2005 01:54 Go to previous message
Nina Li is currently offline Nina LiFriend
Messages: 44
Registered: July 2009
Member
Greeting,

You could create a report in BIRT API by following the steps in the below.
If you'd like to find out the API docs, please go to Help-> HelpContents
->BIRT Developer Guide->Reference->API Reference -> Report Object Model
API Reference.
Cheers.

Regards,
Nina Li
Actuate Corporation

------------------------------------------------------------ ---------
createReport( ){

//A session handle to manage all open reports
SessionHandle session = DesignEngine.newSession( null );

//Add a session (A report design handle for this report)
ReportDesignHandle reportDesignHandle = session.createDesign( );

//An element factory for creating all BIRT elements
ElementFactory elementFactory = designHandle.getElementFactory( );

//create the necessary elements for the reports
createMasterPages( );
createDataSources( );
createDataSets( );
createReportBody( );
.
.
.

...Output the report...

reportDesignHandle.saveAs( ... + "*.rptdesign" );
}


createMasterPage(){

//A design element handle for managing the Master page
DesignElementHandle masterPage = elementFactory.newSimpleMasterPage(
"Master Page" );

//Add the master page into the report
reportDesignHandle.getMasterPages( ).add( masterPage );
.
.
.
}


createDataSources( ){

//A script data source handle for managing the data source
ScriptDataSourceHandle dataSourceHandle =
elementFactory.newScriptDataSource("Data source");

...Set the property of data source...

//Add the data source into the report
reportDesignHandle.getDataSources( ).add( dataSourceHandle );
}


createDataSets( ){

//A script data set handle for managing the data set
ScriptDataSetHandle dataSetHandle = elementFactory.newScriptDataSet("Data
set");

...Set the property of data set...

//Add the data set into the report
reportDesignHandle.getDataSets( ).add( datasetHandle );
}


createReportBody( ){

//Create the contents of report
createGrid( );
createTable();
createLabel();
.
.
.
}
Previous Topic:Mailing Labels with BIRT?
Next Topic:importPackage does not work
Goto Forum:
  


Current Time: Thu Nov 21 13:15:10 GMT 2024

Powered by FUDForum. Page generated in 0.04842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top