升级poi到最新版本5.5.1

master
RuoYi 3 weeks ago
parent 7c615ccd04
commit 9e1a8e54b0

@ -31,7 +31,7 @@
<fastjson.version>2.0.64</fastjson.version> <fastjson.version>2.0.64</fastjson.version>
<jjwt.version>0.9.1</jjwt.version> <jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version> <minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version> <poi.version>5.5.1</poi.version>
<springdoc.version>3.1.0</springdoc.version> <springdoc.version>3.1.0</springdoc.version>
<transmittable-thread-local.version>2.14.5</transmittable-thread-local.version> <transmittable-thread-local.version>2.14.5</transmittable-thread-local.version>
</properties> </properties>

@ -487,7 +487,7 @@ public class ExcelUtil<T>
/** /**
* listexcel * listexcel
* *
* @param response * @param response
* @param list * @param list
* @param sheetName * @param sheetName
@ -591,7 +591,7 @@ public class ExcelUtil<T>
/** /**
* listexcel * listexcel
* *
* @param sheetName * @param sheetName
* @param title * @param title
* @return * @return
@ -840,13 +840,13 @@ public class ExcelUtil<T>
style.cloneStyleFrom(styles.get("data")); style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER); style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(excel.headerBackgroundColor().index); style.setFillForegroundColor(excel.headerBackgroundColor().getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = wb.createFont(); Font headerFont = wb.createFont();
headerFont.setFontName("Arial"); headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10); headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true); headerFont.setBold(true);
headerFont.setColor(excel.headerColor().index); headerFont.setColor(excel.headerColor().getIndex());
style.setFont(headerFont); style.setFont(headerFont);
// 设置表格头单元格文本形式 // 设置表格头单元格文本形式
DataFormat dataFormat = wb.createDataFormat(); DataFormat dataFormat = wb.createDataFormat();
@ -918,7 +918,7 @@ public class ExcelUtil<T>
Font dataFont = wb.createFont(); Font dataFont = wb.createFont();
dataFont.setFontName("Arial"); dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10); dataFont.setFontHeightInPoints((short) 10);
dataFont.setColor(excel.color().index); dataFont.setColor(excel.color().getIndex());
style.setFont(dataFont); style.setFont(dataFont);
if (ColumnType.TEXT == excel.cellType()) if (ColumnType.TEXT == excel.cellType())
{ {
@ -985,12 +985,15 @@ public class ExcelUtil<T>
else if (ColumnType.IMAGE == attr.cellType()) else if (ColumnType.IMAGE == attr.cellType())
{ {
ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1); ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
String imagePath = Convert.toStr(value); String propertyValue = Convert.toStr(value);
if (StringUtils.isNotEmpty(imagePath)) if (StringUtils.isNotEmpty(propertyValue))
{ {
byte[] data = ImageUtils.getImage(imagePath); List<String> imagePaths = StringUtils.str2List(propertyValue, SEPARATOR);
getDrawingPatriarch(cell.getSheet()).createPicture(anchor, for (String imagePath : imagePaths)
cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); {
byte[] data = ImageUtils.getImage(imagePath);
getDrawingPatriarch(cell.getSheet()).createPicture(anchor, cell.getSheet().getWorkbook().addPicture(data, getImageType(data)));
}
} }
} }
} }
@ -1420,7 +1423,7 @@ public class ExcelUtil<T>
/** /**
* get * get
* *
* @param o * @param o
* @param name * @param name
* @return value * @return value

Loading…
Cancel
Save