InputStream inputStream = new FileInputStream("D:\\crdimg.jpeg");
byte[] bytes = IOUtils.toByteArray(inputStream);
int pictureIdx = workbook.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG);
inputStream.close();
CreationHelper helper = workbook.getCreationHelper();
Drawing drawing = sheet.createDrawingPatriarch();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setCol1(1);
anchor.setRow1(2);
anchor.setCol2(2);
anchor.setRow2(3);
Picture pict = drawing.createPicture(anchor, pictureIdx);
pict.resize();
给予
ClassNotFoundException
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/digest/DigestUtils
在线
int pictureIdx = workbook.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG);