在Excel中导出Webi报表(Business Objects / java)

时间:2011-10-28 06:00:42

标签: business-objects business-objects-sdk

我必须以excel格式导出Webi报告并将其显示给用户。环境存在的是BOXI R3。

// reportQuery:“从CI_INFOOBJECTS中选择*,其中SI_NAME ='xxxx'和si_kind ='Webi'和SI_PARENTID = xxxx”

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

获取以下内容(代码行:查询infostore)异常:java.lang.NoClassFoundException:com.crystaldecisions.celib.trace.h

注意:BOXI R3 celib.jar中不存在h.class

1 个答案:

答案 0 :(得分:0)

要打开WebI文档以获取数据,您需要遵循与您前往的路线不同的路线。尝试类似以下的内容:

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

我注意到从IInfoObject转换到你认为具体的东西,通常不起作用。特定的子类似乎在内部用于库,而不是实际的外部可用类。