-1

谁能告诉我如何通过Apache POI从excel表格单元格中读取图像。实际上,当单元格内容为文本类型但当单元格内容为图像时,它不会将图像读取到单元格类对象和我的单元格类对象将其作为空白数据。请帮助我,伙计们......

4

1 回答 1

1
 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();
        }
    }
于 2013-06-14T11:16:32.370 回答