Skip to Content
0
Former Member
Sep 25, 2009 at 06:54 AM

一个报表有2个或多个sheet,导出excel如何把其他sheet都导出来?

455 Views

一个报表有1个sheet导出excel的代码:

String query = "SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='" + CeKind.WEBI + "' AND SI_INSTANCE=0 AND SI_ID='" + DocId<i> + "'";

IInfoObjects boInfoObjects = (IInfoObjects) boInfoStore.query(query);

IInfoObject infoObject = (IInfoObject) boInfoObjects.get(0);

String webiDocName = infoObject.getTitle().replaceAll(" ","").replaceAll("/","");//表名中含有tab键替换

try{

ReportEngines boReportEngines = (ReportEngines) boEnterpriseSession.getService("ReportEngines");

ReportEngine boReportEngine = boReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);

DocumentInstance boDocumentInstance = boReportEngine.openDocument(infoObject.getID());

Report boReport = boDocumentInstance.getReports().getItem(reportIndex);

boReport.setPaginationMode(PaginationMode.Listing);

//get the report contents as a binary stream in Excel/Pdf format

if(type.equals("excel"))

{

BinaryView docBinaryView =(BinaryView)boReport.getView(OutputFormatType.XLS);

byte[] abyBinaryContent = docBinaryView.getContent();

outputStream= new FileOutputStream(pathtimePathrandom"
"
webiDocName+".xls");

outputStream.write(abyBinaryContent);

}

一个报表有2个或多个sheet,导出excel如何把其他sheet都导出来?