Export Webi to MHTML

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.

3 thoughts on “Export Webi to MHTML

  1. Saviour

    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();

    Like

    Reply
    1. dmytro Post author

      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”));

      Like

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s