You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
org.apache.poi.xssf.usermodel.XSSFSimpleShape cannot be cast to org.apache.poi.xssf.usermodel.XSSFPicture
at org.jeecgframework.poi.util.PoiPublicUtil.getSheetPictrues07(PoiPublicUtil.java:286)
at org.jeecgframework.poi.excel.imports.ExcelImportServer.importExcelByIs(ExcelImportServer.java:405)
at org.jeecgframework.poi.excel.ExcelImportUtil.importExcel(ExcelImportUtil.java:85)
org.apache.poi.xssf.usermodel.XSSFSimpleShape cannot be cast to org.apache.poi.xssf.usermodel.XSSFPicture
at org.jeecgframework.poi.util.PoiPublicUtil.getSheetPictrues07(PoiPublicUtil.java:286)
at org.jeecgframework.poi.excel.imports.ExcelImportServer.importExcelByIs(ExcelImportServer.java:405)
at org.jeecgframework.poi.excel.ExcelImportUtil.importExcel(ExcelImportUtil.java:85)
是否可以修改如下:
/**
* 获取Excel2007图片
*
* @param sheet
* 当前sheet对象
* @param workbook
* 工作簿对象
* @return Map key:图片单元格索引(1_1)String,value:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues07(XSSFSheet sheet,
XSSFWorkbook workbook) {
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations()) {
if (dr instanceof XSSFDrawing) {
XSSFDrawing drawing = (XSSFDrawing) dr;
List shapes = drawing.getShapes();
for (XSSFShape shape : shapes) {
if (shape instanceof XSSFPicture) {
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
}
return sheetIndexPicMap;
}
The text was updated successfully, but these errors were encountered: