🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 /** * <b>方法描述:</b> 获取工作簿 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2019-05-24 16:49:03 <br/> * * @param bytes * 入参|二进制数组| {@link Object} * @param book * 出参|工作簿| {@link org.apache.poi.ss.usermodel.Workbook} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "获取工作簿", style = "判断型", type = "同步组件", comment = "根据数组获取工作簿", version = "1.0.0", deprecated = false, author = "admin", date = "2019-05-24 04:49:03") @InParams(param = { @Param(name = "bytes", comment = "二进制数组", type = Object.class) }) @OutParams(param = { @Param(name = "book", comment = "工作簿", type = org.apache.poi.ss.usermodel.Workbook.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase A_getWorkbook(Object bytes) { try { byte[] bs = (byte[]) bytes; ByteArrayInputStream in = new ByteArrayInputStream(bs); Workbook wb = WorkbookFactory.create(in); return ResultBase.newSuccessResult(wb); } catch (Exception e) { AppLog.error("数组转工作簿异常", e); return ResultBase.newFailureResult("999", "获得文件工作簿异常"); } } 交易中组件使用方式: ![](https://img.kancloud.cn/78/e2/78e2a1eb05d946578af2ab2f6c77486c_950x750.jpg) ## 参数说明及示例 二进制数组:文件的二进制数组,可以是请求传递也可以是其他技术组件处理后的结果,示例: `__INNER__["byteArr"]` 工作簿:返回文件工作簿对象,示例: `__INNER__["workBook"]` > 根据数组获取工作簿