openReportDesign(reportName);
IRunAndRenderTask task = engine.createRunAndRenderTask(runnable);
//Set Render context to handle url and image locations
HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory(IMAGE_PATH);
HashMap contextMap = new HashMap();
contextMap.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext );
task.setAppContext( contextMap );
//Set rendering options - such as file or stream output,
//Output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName(outputFile);
options.setOutputFormat("html");
task.setRenderOption(options);
//Run the report and close
task.run();
task.close();
catch (EngineException e) {
e.printStackTrace();
System.exit(-1);
}
}
/**
* executeReport
*
* This method will execute the report and save the the output file
* @param reportInput
* @param reportOutput
*/
public void executeReport(String reportInput, String reportOutput)
{
//Start up the platform
startupPlatform();
//Create a Report Engine
IReportEngine engine = createReportEngine();
//Create a run and render task, and execute report
executeReportNoParams(reportInput, reportOutput, engine);
Chapter 11
[ 267 ]
//Shutdown platform
Platform.shutdown();
}
/**
* @param args
*/
public static void main(String[] args) {
ReportExecutor re = new ReportExecutor();
//Get command line options
CommandLine cl = re.
Pages:
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217