Search code examples
business-objectsbusiness-objects-sdkwebi

Exporting Webi to Excel throws java.lang.NoClassFoundException :com.crystaldecisions.celib.trace.h


I have to export the Webi report in the excel format and show it to the user .Environment present is BOXI R3 .

ReportQuery:

Select * from CI_INFOOBJECTS where SI_NAME ='xxxx' and si_kind ='Webi' and SI_PARENTID=xxxx

IInfoObjects webiDocs = infostore.query(reportQuery.toString);
IWebi webiDoc =IWebi  webiDocs.get(o);

It throws exception on infostore.query:

java.lang.NoClassFoundException :com.crystaldecisions.celib.trace.h

Note: h.class is not present in BOXI R3 celib.jar


Solution

  • To open a WebI document to get the data you will need to follow a different route from the one you are headed down. Try something similar to the following:

    // get your list of IInfoObjects
    IInfoObjects webiDocs = infostore.query(reportQuery.toString);
    
    // get a report engine to open the document
    ReportEngines engines = (ReportEngines)enterpriseSession.getService("ReportEngines");
    ReportEngine reportEngine = engines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
    
    //Get the actual Doc instance
    DocumentInstance docInstance = reportEngine.openDocument(webiDocs.get(0).getID());
    
    // get the Raw data stream
    BinaryView bv = (BinaryView)documentInstance.getView(OutputFormatType.CSV);
    OutputStream outputStream; // defined else where to meet your needs
    bv.getContent(outputStream);
    

    I did notice that casts from a IInfoObject to what you think it specifically is, does not usually work. The specific children classes seem to be used internally to the libraries more than as actual externally usable classes.