以前に設計した BIRT レポートを Eclipse Indigo で 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)
レンダリングしたい任意のタイプの出力フォーマットでも同じことが起こります。
私が間違っていることは何ですか?
ありがとう
ユレクシ