|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.ibeetl.admin.core.util.excelGroupValidation;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
@ -159,6 +160,7 @@ public class ExcelUtil {
|
|
|
|
|
String format = "%s!$%s$%s:$%s$%s";
|
|
|
|
|
// 创建名称管理器
|
|
|
|
|
Name name = workbook.createName();
|
|
|
|
|
nameString = replaceNameName(nameString);
|
|
|
|
|
name.setNameName(nameString);
|
|
|
|
|
String cellColumnFlag = getCellColumnFlag(columnIndex + 2);
|
|
|
|
|
int nameManageRegan = CollectionUtils.isEmpty(data) ? 1 : data.size() + 1;
|
|
|
|
@ -172,6 +174,16 @@ public class ExcelUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对poi的name字段,进行小加工
|
|
|
|
|
* @param nameName
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static String replaceNameName(String nameName) {
|
|
|
|
|
// 首字母必须是中文,支持有限的符号
|
|
|
|
|
return ReUtil.get("[\\u4e00-\\u9fa5]+[_0-9]*", nameName, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getCellColumnFlag(int num) {
|
|
|
|
|
String colFiled = "";
|
|
|
|
|
int chuNum = 0;
|
|
|
|
|