1.字典表 终端类型改为型号 2.分布式光伏台账

This commit is contained in:
2022-07-08 13:50:34 +08:00
parent 18a6c2637a
commit 632b6275c6
97 changed files with 6290 additions and 55 deletions

View File

@@ -7,9 +7,12 @@ import com.njcn.web.utils.HttpServletUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.DVConstraint;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -96,13 +99,15 @@ public class ExcelUtil {
Sheet sheet = workbook.getSheetAt(0);
// 生成下拉列表
// 只对(xx)单元格有效
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(3, 65535, firstCol, lastCol);
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol);
// 生成下拉框内容
DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(strings);
HSSFDataValidation dataValidation = new HSSFDataValidation(cellRangeAddressList, dvConstraint);
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)
dvHelper.createExplicitListConstraint(strings);
XSSFDataValidation validation =(XSSFDataValidation)dvHelper.createValidation(
dvConstraint, cellRangeAddressList);
// 对sheet页生效
sheet.addValidationData(dataValidation);
sheet.addValidationData(validation);
}