gpt4 book ai didi

java - 使用poi从excel文件中读取图像和数据

转载 作者:行者123 更新时间:2023-12-02 07:25:11 25 4
gpt4 key购买 nike

我知道如何从 Excel xls/xlxs 读取数据。现在我的要求是我必须使用 POI 3.8 从 Excel 文件读取图像和数据。你能指导我该怎么做吗?使用 poi 从一个 excel 文件中读取图像和数据...提前致谢

最佳答案

直接来自the developer's guide :

List lst = workbook.getAllPictures();
for (Iterator it = lst.iterator(); it.hasNext(); ) {
PictureData pict = (PictureData)it.next();
String ext = pict.suggestFileExtension();
byte[] data = pict.getData();
if (ext.equals("jpeg")){
FileOutputStream out = new FileOutputStream("pict.jpg");
out.write(data);
out.close();
}
}

RTM:)

关于java - 使用poi从excel文件中读取图像和数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13658315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com