Merge branch 'release/2.15.2.2409.01' into feature/自定义列全局设置

This commit is contained in:
钱涛 2024-10-11 15:34:44 +08:00
commit 32b3ce97a9
1 changed files with 8 additions and 8 deletions

View File

@ -134,7 +134,7 @@ public class ExcelUtilPlus {
rowZeroCell.setCellValue(columnGroupItem.getText().toString());
rowZeroCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(i, Math.max(12, columnGroupItem.getText().length() * 4) * 256);
sheet.setColumnWidth(i, Math.min(255, Math.max(12, columnGroupItem.getText().length() * 4)) * 256);
patternList.add(columnGroupItem.getPattern());
}
@ -262,7 +262,7 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i, Math.max(12, header.get(i).toString().length() * 4) * 256);
sheet.setColumnWidth(i, Math.min(255, Math.max(12, header.get(i).toString().length() * 4)) * 256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
@ -349,7 +349,7 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i, Math.max(12, header.get(i).toString().length() * 4) * 256);
sheet.setColumnWidth(i, Math.min(255, Math.max(12, header.get(i).toString().length() * 4)) * 256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
@ -454,7 +454,7 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i, Math.max(12, header.get(i).toString().length() * 4) * 256);
sheet.setColumnWidth(i, Math.min(255, Math.max(12, header.get(i).toString().length() * 4)) * 256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
@ -588,7 +588,7 @@ public class ExcelUtilPlus {
rowOneCell.setCellValue(columnGroupItem.getText().toString());
rowOneCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex, Math.max(12, columnGroupItem.getText().length() * 4) * 256);
sheet.setColumnWidth(startIndex, Math.min(255, Math.max(12, columnGroupItem.getText().length() * 4)) * 256);
startIndex++;
patternList.add(columnGroupItem.getPattern());
} else {
@ -610,7 +610,7 @@ public class ExcelUtilPlus {
subHeader.setCellValue(childrenItem.getText().toString());
subHeader.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex + j, Math.max(12, childrenItem.getText().length() * 4) * 256);
sheet.setColumnWidth(startIndex + j, Math.min(255, Math.max(12, childrenItem.getText().length() * 4)) * 256);
patternList.add(childrenItem.getPattern());
}
@ -789,7 +789,7 @@ public class ExcelUtilPlus {
rowOneCell.setCellValue(columnGroupItem.getText().toString());
rowOneCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex, Math.max(12, columnGroupItem.getText().length() * 4) * 256);
sheet.setColumnWidth(startIndex, Math.min(255, Math.max(12, columnGroupItem.getText().length() * 4)) * 256);
startIndex++;
} else {
List<WeaTableColumnGroup> childrenList = columnGroupItem.getChildren();
@ -810,7 +810,7 @@ public class ExcelUtilPlus {
subHeader.setCellValue(childrenItem.getText().toString());
subHeader.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex + j, Math.max(12, childrenItem.getText().length() * 4) * 256);
sheet.setColumnWidth(startIndex + j, Math.min(255, Math.max(12, childrenItem.getText().length() * 4)) * 256);
}
startIndex += childrenList.size();