あなたが理解しているように、どこかの場所に* .rptdesignがあるサーブレットのbirtレポートフォームを生成しようとしています。
良い、あなたがタイプIReportRunnableからレポートのインスタンスを取得し、その後BIRTエンジンを準備しなければならない最初のものを見ることができるように、次のコード
this.bundle = ResourceBundle.getBundle("com.tts.mersal.resources.MersalResources");
this.config = new EngineConfig();
this.config.setEngineHome(bundle.getString("BIRT_ENGINE_HOME"));
this.config.setLogConfig(bundle.getString("BIRT_LOGGING_FOLDER_PATH"), Level.ALL);
Platform.startup(config);
this.factory = (IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
this.engine = factory.createReportEngine(config);
this.engine.changeLogLevel(Level.ALL);
ContentReader contentReader = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService().getReader(MersalOutboundReportDialogBean.this.dialogReportNode.getNodeRef());
IReportRunnable report = MersalOutboundReportDialogBean.this.getEngine().openReportDesign(contentReader.getContentInputStream());
ReportDesignHandle designHandle = (ReportDesignHandle)report.getDesignHandle();
OdaDataSource source = (OdaDataSource)designHandle.getModule().findDataSource(DATA_SOURCE_NAME);
source.setProperty(source.getPropertyDefn("FILELIST"), buildUrl((String)source.getProperty(designHandle.getModule(), "FILELIST")));
IRunAndRenderTask runAndRenderTask = MersalOutboundReportDialogBean.this.getEngine().createRunAndRenderTask(report);
HTMLRenderOption render = new HTMLRenderOption();
render.setOutputFileName("G:/Render.html");
render.setOutputFormat("html");
runAndRenderTask.setRenderOption(render);
runAndRenderTask.run();
runAndRenderTask.close();
を見て、あなたがその場所を設定することができた後、あなたの要求に基づいて変更されるオプションを使用して出力の
複数のchocies、HTMLRenderOption、PDFRenderOptionなどがあります。
私はあなたに役立つことを願っています。
ありがとうございました。
素晴らしい答え、Stack Overflowへの功績。完了し、正確に求められたもの。よくできました。 – MystikSpiral
revisited - 4.2.2でも有効 – Geronimo
Tomcat 7のBIRT 4.3.2で動作します。3.7.1または4.3.2ではJettyでは動作しませんでした。 – Ryan