As I understand you, you are trying to create a birt report form in which you have * .rptdesign in some place.
Ok look at the following code
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();
As you can see, the first thing you need to prepare is the birt engine, and then get the report instance from the IReportRunnable type so that you can then set the location of the output using the therender parameter, which will be changed depending on your request.
You have several chocies, HTMLRenderOption, PDFRenderOption and others.
I hope this will serve you.
Thanks.
source share