使用poi从excel文件中读取图像和数据 [英] reading images and data from excel file using poi

查看:24
本文介绍了使用poi从excel文件中读取图像和数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i know how to read data from excel xls/xlxs. now my requirement is that i have to read image and data from excel file using POI 3.8. can you please guide me how to do that. reading images and data both from one excel file using poi.... Thanks in advance

推荐答案

直接来自 开发者指南:

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 :)

这篇关于使用poi从excel文件中读取图像和数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆