ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 工作簿64编码 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2019-05-29 14:33:08 <br/> * * @param wb * 入参|工作簿| {@link org.apache.poi.ss.usermodel.Workbook} * @param str * 出参|编码| {@link java.lang.String} * @return -1 异常<br/> * 0 失败<br/> * 1 成功<br/> */ @Component(label = "工作簿64编码", style = "选择型", type = "同步组件", version = "1.0.0", deprecated = false, author = "admin", date = "2019-05-29 02:33:08") @InParams(param = { @Param(name = "wb", comment = "工作簿", type = org.apache.poi.ss.usermodel.Workbook.class) }) @OutParams(param = { @Param(name = "str", comment = "编码", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase A_wb64encode(Workbook wb) { try { BASE64Encoder coder = new BASE64Encoder(); ByteArrayOutputStream out = new ByteArrayOutputStream(); wb.write(out); byte[] bytes = out.toByteArray(); return ResultBase.newSuccessResult(coder.encode(bytes)); } catch (IOException e) { AppLog.error(e); return ResultBase.newExceptionResult("999", "工作簿进行64编码错误," + e.getMessage()); } } 交易中组件使用方式: ![](https://img.kancloud.cn/66/b4/66b45cf346b32eb742ddc877b4a230ba_950x750.jpg) ## 参数说明及示例 工作簿:已有的工作簿对象,示例: `__INNER__["wb"]` 编码:返回进行了了base64编码后的对象,示例: `__INNER__["b64"]` > 对工作簿进行base64编码