成本测算导出-单位下拉框

This commit is contained in:
李贵强 2025-02-24 18:23:36 +08:00
parent 4ecd7d8f64
commit 85169a3d9b
1 changed files with 12 additions and 0 deletions

View File

@ -710,6 +710,18 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
// 添加数据验证规则
sheet.addValidationData(dataValidation1);
break;
case "单位":
// 1. 设置下拉项数据
String[] products2 = {"%", "KVA", "m2", "m3","点位","","",""};
DataValidationHelper helper2 = sheet.getDataValidationHelper();
DataValidationConstraint constraint2 = helper2.createExplicitListConstraint(products2);
int totalRowCount2 = sheet.getLastRowNum() + 1;
System.out.println("总行数 (包括空行): " + totalRowCount2);
CellRangeAddressList addressList2 = new CellRangeAddressList(4, totalRowCount2-1, colIndex, colIndex); // A2 A10 作为下拉列表范围
DataValidation dataValidation2 = helper2.createValidation(constraint2, addressList2);
// 添加数据验证规则
sheet.addValidationData(dataValidation2);
break;
default:
}
}