return f;
}
static void executeReport() throws EngineException {
IReportEngine engine = null;
EngineConfig config = null;
try {
config = new EngineConfig();
config.setLogConfig(null, Level.FINE);
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
engine.changeLogLevel(Level.WARNING);
} catch (Exception ex) {
ex.printStackTrace();
}
IReportRunnable runnable = null;
runnable = engine.openReportDesign(outputReportFile);
// Create task to run the report - use the task to execute and run the report,
IRunTask task2 = engine.createRunTask(runnable);
// Create rptdocument
task2.run("D:/Temp/TOCTest.rptdocument");
// Open rptdocument
IReportDocument rptdoc = engine
.openReportDocument("D:/Temp/TOCTest.rptdocument");
// Create Render Task
IRenderTask rtask = engine.createRenderTask(rptdoc);
PDFRenderOption optionsPDF = new PDFRenderOption();
optionsPDF.setOutputFileName("D:/Temp/output.pdf");
optionsPDF.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
rtask.setRenderOption(optionsPDF);
// render
rtask.render();
// render the report and destroy the engine
// Note - If the program stays resident do not shutdown the Platform or
// the Engine
task2.close();
engine.shutdown();
Platform.shutdown();
System.out.println("Finished");
}