Is it possible to extract an image\'s information from an xls spreadsheet using Apache POI?
In one of my projects, I need to read some images from a .xls file. I can
I hope this code will help)
XSSFDrawing dp = workbook.getSheetAt(1).createDrawingPatriarch();
List pics = dp.getShapes();
XSSFPicture inpPic = (XSSFPicture)pics.get(0);
XSSFClientAnchor clientAnchor = inpPic.getClientAnchor();
inpPic.getShapeName(); // узнаю название картинки
PictureData pict = inpPic.getPictureData();
FileOutputStream out = new FileOutputStream("pict.jpg");
byte[] data = pict.getData();
out.write(data);
out.close();
System.out.println("col1: " + clientAnchor.getCol1() + ", col2: " + clientAnchor.getCol2() + ", row1: " + clientAnchor.getRow1() + ", row2: " + clientAnchor.getRow2());
System.out.println("x1: " + clientAnchor.getDx1() + ", x2: " + clientAnchor.getDx2() + ", y1: " + clientAnchor.getDy1() + ", y2: " + clientAnchor.getDy2());