Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How do I convert rptdocument to rptdesign use API?
jikang
How can I convert rptdocument to rptdesign use API?
Find more posts tagged with
Comments
Virgil Dodson
Hi jikang,<br />
<br />
Do you mean how to convert a report design (rptdesign) into a report document (rptdocument is an occurance of an executed report)? If so, there are examples at <a class='bbc_url' href='
http://www.birt-exchange.org/devshare/deploying-birt-reports/568-execute-birt-reports-from-java-class/#description'>Execute
BIRT Reports from Java class - Designs & Code - BIRT Exchange</a><br />
<br />
Otherwise, there is no way to go backwards from completed report document, back into a design.
johnw
The following code snippet will extract the report design from a rptdocument file and save.
package birt.executor;
import java.io.IOException;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.ReportEngine;
public class RestoreReportDesign {
/**
*
@param
args
*/
public static void main(String[] args) {
try {
String birtHome = "C:/Libraries/birt-runtime-2_3_2/ReportEngine";
EngineConfig engineConfig = new EngineConfig();
engineConfig.setBIRTHome(birtHome);
Platform.startup(engineConfig);
ReportEngine re = new ReportEngine(engineConfig);
IReportDocument doc = re.openReportDocument("Completed.rptdocument");
doc.getReportDesign().saveAs("extractedReportDesign.rptdesign");
doc.close();
Platform.shutdown();
} catch (EngineException e) {
e.printStackTrace();
} catch (BirtException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Virgil Dodson
thanks John... I didn't even know this was possible... Thanks for posting the code snippet.