Debug.logInfo("Set BIRT parameters:" + parameters, module);
task.setParameterValues(parameters);
}
// set output options
RenderOption options = new RenderOption();
if ("text/html".equalsIgnoreCase(contentType)) { // HTML
options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
htmlOptions.setImageDirectory(birtImageDirectory);
htmlOptions.setBaseImageURL(birtImageDirectory);
options.setImageHandler(imageHandler);
} else if ("application/postscript".equalsIgnoreCase(contentType)) { // Post Script
options.setOutputFormat("postscript");
} else if ("application/pdf".equalsIgnoreCase(contentType)) { // PDF
options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
PDFRenderOption pdfOptions = new PDFRenderOption(options);
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
} else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) { // MS Word
options.setOutputFormat("doc");
} else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) { // MS Excel
options.setOutputFormat("xls");
new EXCELRenderOption(options);
} else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) { // MS Power Point
options.setOutputFormat("ppt");
} else if ("application/vnd.oasis.opendocument.text".equalsIgnoreCase(contentType)) { // Open Document Text
options.setOutputFormat("odt");
} else if ("application/vnd.oasis.opendocument.spreadsheet".equalsIgnoreCase(contentType)) { // Open Document Spreadsheet
options.setOutputFormat("ods");
} else if ("application/vnd.oasis.opendocument.presentation".equalsIgnoreCase(contentType)) { // Open Document Presentation
options.setOutputFormat("odp");
} else {
throw new GeneralException("Unknown content type : " + contentType);
}
options.setOutputStream(output);
task.setRenderOption(options);
// run report
Debug.logInfo("BIRT's locale is: " + task.getLocale(), module);
Debug.logInfo("Run report's task", module);