我想在Eclipse Indigo中将以前设计的BIRT报告呈现给HTML。我正在使用BIRT 4.2.1。当我在普通的Java应用程序中执行它时运行正常。但是,当我想从RCP应用程序执行相同操作时,它不会。
这是我的代码:
IRunAndRenderTask task=null;
IReportEngine engine=null;
EngineConfig config = null;
IReportRunnable design = null;
try{
config = new EngineConfig( );
IReportEngineFactory factory = (IReportEngineFactory) Platform.
createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
//use this if the report is in the bundle
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle("com.accenture.workforceplanning.ui");
URL url = FileLocator.find(bundle, new Path("/reports/scenarioAnalysis.rptdesign"), null);
String rpt = FileLocator.toFileURL(url).getPath();
//Open the report design
design = engine.openReportDesign(rpt);
task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
options.setImageDirectory("./");
URL url1 = FileLocator.find(bundle, new Path("/reports"), null);
String rpt1 = FileLocator.toFileURL(url1).getPath();
options.setOutputFileName(rpt1 +"/scenarioAnalysis.html");
options.setOutputFormat("html");
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
当程序到达task.run()时,我收到以下错误:
org.eclipse.birt.report.engine.api.UnsupportedFormatException: The output format html is not supported.
at org.eclipse.birt.report.engine.api.impl.EngineTask.setupRenderOption(EngineTask.java:2047)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:96)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at com.accenture.workforceplanning.ui.composites.OutputComposite.reportToHtml(OutputComposite.java:470)
at com.accenture.workforceplanning.ui.composites.OutputComposite.createReportScenarioAnalysis(OutputComposite.java:410)
at com.accenture.workforceplanning.ui.composites.OutputComposite.access$6(OutputComposite.java:308)
at com.accenture.workforceplanning.ui.composites.OutputComposite$4.widgetSelected(OutputComposite.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.accenture.workforceplanning.application.Application.start(Application.java:26)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
对于我想渲染的任何类型的输出格式,它都会发生相同的事情。
知道我做错了吗?
由于
答案 0 :(得分:1)
我设法解决了问题。为了防止有人遇到同样的问题,这就是我所做的: 我手动将所有BIRT插件添加到我的RCP应用程序产品的依赖项(由于某种原因,未添加所需的插件)。我仍然不知道丢失的插件是什么。但是应用程序现在工作正常。