温馨提示×

XSSFWorkbook的保存与关闭

c#
小樊
328
2024-08-13 07:51:35
栏目: 编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

要保存XSSFWorkbook对象到文件中,可以使用其write方法将内容写入到输出流中,然后关闭文件流。示例如下:

try {
    FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
    workbook.write(fileOut);
    fileOut.close();
} catch (IOException e) {
    e.printStackTrace();
}

要关闭XSSFWorkbook对象,可以使用其close方法,示例如下:

workbook.close();

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:XSSFWorkbook的加密与解密

0