我已经使用 Apache POI API 生成了一个 Excel 文件,并尝试使用 Spring Integration 将其发送到远程目录,但是当我编写下面的代码时,会出现编译时错误,因为它只支持"file"类型对象 Excel 类型是“HSSFWorkbook”。
HSSFWorkbook workbook = gerateExcelFile(data);
excelCollector.add((workbook);
并使用以下代码作为“入站 channel 适配器”
<inbound-channel-adapter id="excelAdapter" auto-startup="true"
ref="excelCollector" method="poll" channel="excelInputChannel">
<poller fixed-rate="500"/>
</inbound-channel-adapter>
最佳答案
框架不知道如何处理任意对象。
您需要将工作簿写入文件
或将其转换为包含工作簿内容的字节[],然后发送。
关于java - 使用 spring 集成将 Excel 或 xls 文件发送到远程目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779499/