[代码优化](v2.6):修复导出 excel 数据报错

close https://github.com/elunez/eladmin/issues/531
pull/545/head^2
zhengjie 2020-12-12 22:54:07 +08:00
parent 264b3cb79d
commit 76b600eecc
1 changed files with 2 additions and 1 deletions

View File

@ -248,7 +248,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
SXSSFCell currentCell = currentRow.getCell(columnNum); SXSSFCell currentCell = currentRow.getCell(columnNum);
if (currentCell.getCellTypeEnum() == CellType.STRING) { if (currentCell.getCellTypeEnum() == CellType.STRING) {
int length = currentCell.getStringCellValue().getBytes().length; int length = currentCell.getStringCellValue().getBytes().length;
if (columnWidth < length) { // 如果长度大于最大值 65280那就取 length
if (columnWidth < length || (columnWidth * 256 > 65280)) {
columnWidth = length; columnWidth = length;
} }
} }