[POI-HSSF] 生成 HSSFWorkbook文件 的字节数组

错误的写法是:

 return workbook.getBytes();

正确的写法是:

  		
ByteArrayOutputStream out = new ByteArrayOutputStream();
workbook.write(out);
return out.toByteArray();

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.