IReportEngine engine = BirtProvider
.getBirtEngine(directoryProvider.getReportDirectory() + "platform");
// Set options for task
HTMLRenderOption renderOption = new HTMLRenderOption();
renderOption.setOutputStream(out);
renderOption.setImageDirectory(directoryProvider.getTempDirectory());
renderOption.setBaseImageURL("report-images");
try
{
String designFile = directoryProvider.getReportDirectory() + report.getFile();
log.info("Loading BIRT report design: " + report.getFile());
IReportRunnable design = engine.openReportDesign(designFile);
handleDataSourceOverrides(design);
if (input.getExportType() == ExportType.PDF)
{
output.setContentType(ReportEngineOutput.CONTENT_TYPE_PDF);
renderOption.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);
}
else if (input.getExportType() == ExportType.HTML || input.getExportType() == ExportType.HTML_EMBEDDED)
{
output.setContentType(ReportEngineOutput.CONTENT_TYPE_HTML);
renderOption.setOutputFormat(IRenderOption.OUTPUT_FORMAT_HTML);
if (input.getExportType() == ExportType.HTML_EMBEDDED)
{
renderOption.setEmbeddable(true);
}
}
else if (input.getExportType() == ExportType.XLS)
{
output.setContentType(ReportEngineOutput.CONTENT_TYPE_XLS);
renderOption.setOutputFormat("xls");
}
else
{
log.error("Export type not yet implemented: " + input.getExportType());
}