|
@@ -950,7 +950,7 @@ public class ExcelUtil<T> |
|
@@ -950,7 +950,7 @@ public class ExcelUtil<T> |
|
950
|
*/
|
950
|
*/
|
|
951
|
public void annotationDataStyles(Map<String, CellStyle> styles, Field field, Excel excel)
|
951
|
public void annotationDataStyles(Map<String, CellStyle> styles, Field field, Excel excel)
|
|
952
|
{
|
952
|
{
|
|
953
|
- String key = StringUtils.format("data_{}_{}_{}_{}", excel.align(), excel.color(), excel.backgroundColor(), excel.cellType());
|
953
|
+ String key = StringUtils.format("data_{}_{}_{}_{}_{}", excel.align(), excel.color(), excel.backgroundColor(), excel.cellType(), excel.wrapText());
|
|
954
|
if (!styles.containsKey(key))
|
954
|
if (!styles.containsKey(key))
|
|
955
|
{
|
955
|
{
|
|
956
|
CellStyle style = wb.createCellStyle();
|
956
|
CellStyle style = wb.createCellStyle();
|
|
@@ -966,6 +966,7 @@ public class ExcelUtil<T> |
|
@@ -966,6 +966,7 @@ public class ExcelUtil<T> |
|
966
|
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
966
|
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
967
|
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
967
|
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
968
|
style.setFillForegroundColor(excel.backgroundColor().getIndex());
|
968
|
style.setFillForegroundColor(excel.backgroundColor().getIndex());
|
|
|
|
969
|
+ style.setWrapText(excel.wrapText());
|
|
969
|
Font dataFont = wb.createFont();
|
970
|
Font dataFont = wb.createFont();
|
|
970
|
dataFont.setFontName("Arial");
|
971
|
dataFont.setFontName("Arial");
|
|
971
|
dataFont.setFontHeightInPoints((short) 10);
|
972
|
dataFont.setFontHeightInPoints((short) 10);
|
|
@@ -994,7 +995,7 @@ public class ExcelUtil<T> |
|
@@ -994,7 +995,7 @@ public class ExcelUtil<T> |
|
994
|
if (isSubList())
|
995
|
if (isSubList())
|
|
995
|
{
|
996
|
{
|
|
996
|
// 填充默认样式,防止合并单元格样式失效
|
997
|
// 填充默认样式,防止合并单元格样式失效
|
|
997
|
- sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType())));
|
998
|
+ sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText())));
|
|
998
|
if (attr.needMerge())
|
999
|
if (attr.needMerge())
|
|
999
|
{
|
1000
|
{
|
|
1000
|
sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column));
|
1001
|
sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column));
|
|
@@ -1137,7 +1138,7 @@ public class ExcelUtil<T> |
|
@@ -1137,7 +1138,7 @@ public class ExcelUtil<T> |
|
1137
|
sheet.addMergedRegion(new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column));
|
1138
|
sheet.addMergedRegion(new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column));
|
|
1138
|
}
|
1139
|
}
|
|
1139
|
}
|
1140
|
}
|
|
1140
|
- cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType())));
|
1141
|
+ cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText())));
|
|
1141
|
|
1142
|
|
|
1142
|
// 用于读取对象中的属性
|
1143
|
// 用于读取对象中的属性
|
|
1143
|
Object value = getTargetValue(vo, field, attr);
|
1144
|
Object value = getTargetValue(vo, field, attr);
|