POI中增加image
引用:http://poi.apache.org/spreadsheet/quick-guide.html#Images
?
Images are part of the drawing support. To add an image just call?createPicture()?on the drawing patriarch. At the time of writing the following types are supported:
It should be noted that any existing drawings may be erased once you add a image to a sheet.
WarningPicture.resize() works only for JPEG and PNG. Other formats are not yet supported.Reading images from a workbook:
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(); } }http://www.iteye.com/topic/18063 http://pengliyong909.blog.163.com/blog/static/40832036201032735423383/这二个可以参考下。