🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
`new XSSFClientAnchor(int dx1,int dy1,int dx2,int dy2,short col1,int row1,short col2, int row2)` `short col1,int row1` 确定图片左上角 `short col2, int row2` 确定图片右下角 `int dx1,int dy1` 和`int dx2,int dy2`不能决定图片的位置,知识在左右下角单元格的位置 ![](https://img.kancloud.cn/75/38/7538304a629ff28e3884674685b1b091_1229x502.png) ~~~ String base64Image = vo.getImage().get(i).replace("data:image/png;base64,", ""); byte[] imageByteArray = Base64.getDecoder().decode(base64Image); //添加图片 XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 255, 255,(short) 0, 0,12, 15); anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE); Drawing<?> patriarch = workbook.getSheet("sheet1").createDrawingPatriarch(); patriarch.createPicture(anchor, workbook.addPicture(imageByteArray, XSSFWorkbook.PICTURE_TYPE_JPEG)); ~~~