Birt Report [message #1776326] |
Wed, 15 November 2017 11:22 |
manjusha ganjewar Messages: 1 Registered: November 2017 |
Junior Member |
|
|
Hi,
I am new to Java also to BIRT tool. I have designed a report using BIRT designer and then I imported this .rptdesign file in the project that I was developing using eclipse mars. When I run this project, the output report file is generated but it is blank. I am unable to understand, the same report runs when using the BIRT designer but not in eclipse mars.
Can someone please help me out.
The code to call the BIRT report in java is as below :-
IReportEngine engine = null;
EngineConfig config = null;
config = new EngineConfig();
config.setEngineHome("G:\\Manjusha\\Projects\\BullsEye\\birt-runtime-4.6.0-20160607\\ReportEngine");
config.setLogConfig("G:/Manjusha/Projects/BullsEye/birt-rcp-report-designer-4.6.0-20160607-win32.win32.x86_64/birt/plugins/org.eclipse.birt.report.viewer_4.6.0.v201606072122/birt/logs", Level.FINE);
try {
Platform.startup(config);
} catch (BirtException e) {
e.printStackTrace();
}
final IReportEngineFactory FACTORY = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = FACTORY.createReportEngine(config);
engine.changeLogLevel(Level.WARNING);
final IReportRunnable DESIGN = engine.openReportDesign("G:/Manjusha/Projects/BullsEye/Workspace_Mars/Probability/Probability/src/Probability/Round.rptdesign");
final IRunAndRenderTask TASK = engine.createRunAndRenderTask(DESIGN);
// Set Render context to handle URL and image locations
final HTMLRenderContext RENDER_CONTEXT = new HTMLRenderContext();
// Set the Base URL for all actions
// RENDER_CONTEXT.setBaseURL("http:// 172.16.206.219/");
final HashMap<String, HTMLRenderContext> CONTEXT = new HashMap<String, HTMLRenderContext>();
CONTEXT.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, RENDER_CONTEXT);
TASK.setAppContext(CONTEXT);
// Set PARAMETERS for the report
//final HTMLRenderOption HTML_OPTIONS = new HTMLRenderOption();
//HTML_OPTIONS.setOutputFileName("G:\\Manjusha\\Projects\\BullsEye\\Workspace_Mars\\Probability\\Probability\\Report.pdf");
//HTML_OPTIONS.setOutputFormat("pdf");
PDFRenderOption options = new PDFRenderOption( );
options.setOutputFormat("pdf");
options.setOutputFileName("G:/Manjusha/Projects/BullsEye/Workspace_Mars/Probability/Probability/Report.pdf" );
TASK.setRenderOption(options);
TASK.run();
TASK.close();
engine.shutdown();
Platform.shutdown();
System.out.println("Finished");
JOptionPane.showMessageDialog(null, "Report Generated Successfully", "Computing Hit Probability",JOptionPane.WARNING_MESSAGE);
I am attaching my .rptdesign file.
|
|
|
Powered by
FUDForum. Page generated in 0.03121 seconds