To export Webi report to MHTML, the function HTMLView.getContent(Writer,String,String) should be used.
// widoc is an instance of DocumentInstance Reports reports = widoc.getReports(); HTMLView htmlView = (HTMLView) reports.getItem(0).getView(OutputFormatType.MHTML); FileWriter fw = new FileWriter("report.mhtml"); htmlView.getContent(fw,"",""); fw.close();
Make sure that libraries xpp3.jar, xpp3_min.jar, xalan.jar and xercesImpl.jar from common\4.0\java\lib\external are included in the class path.
The below code gets executed but the report output cannot be found.
ReportEngines reportEngines = null;
reportEngines = (ReportEngines) enterpriseSession
.getService(“ReportEngines”);
ReportEngine wiRepEngine = (ReportEngine) reportEngines
.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
com.businessobjects.rebean.wi.DocumentInstance widoc = wiRepEngine.openDocument(infoObject.getID());
Reports reports = widoc.getReports();
HTMLView htmlView = (HTMLView) reports.getItem(0).getView(OutputFormatType.MHTML);
FileWriter fw = new FileWriter(“report.mhtml”);
htmlView.getContent(fw,””,””);fw.close();
LikeLike
If the code executes and does not throw an exception, then the file should be somewhere…
Try to specify the full path, e.g.
FileWriter fw = new FileWriter(“c:/report.mhtml”);
Or you can add the following line to see the current working folder
System.out.println(“Working Directory: ” + System.getProperty(“user.dir”));
LikeLike
Did you ever get this working for XLS output?
LikeLike