From this format, it is possible to use as a data source using a special ODA I designed, extract the data using the BIRT Web Viewer to create a CSV in case the ODa gives me issues, and extract the original report design file. So, how do you extract the report design? This was a question asked on the BIRT Exchange, and this was the solutions I provided:
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("C:/Contracts/MyReportDesign.rptdocument");
doc.getReportDesign().saveAs("C:/TEMP/extractedReportDesign.rptdesign");
doc.close();
Platform.shutdown();
} catch (EngineException e) {
e.printStackTrace();
} catch (BirtException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
1 comment:
John, thanks! This is going to be a very handy technique to have in the old toolbag!
Post a Comment