main
黄海 2 years ago
parent 2cbe1a40d0
commit 7012a44134

@ -44,10 +44,17 @@ public class CreateTableAndTemplate {
int colIdx = 0;
for (Record record : _list) {
record.set("column_type", "varchar(2048)");
record.set("allow_blank", false);
if (sheetIdx == 0 && colIdx == 3) {//第一个Sheet表的品牌型号列
record.set("options", "华为,中兴,思科");//生成下拉框
}
//品牌型号必需填写
//台数必需填写
if ((sheetIdx == 0 && colIdx == 3) || (sheetIdx == 0 && colIdx == 5))
record.set("allow_blank", false);
else
record.set("allow_blank", true);
colIdx++;
}
sheetIdx++;
@ -165,8 +172,11 @@ public class CreateTableAndTemplate {
}
sheetIdx++;
}
// 保存
wb.setActiveSheet(0); // 设置活动表单为第一个表单
// 取消每一个表单的激活状态
for (int i = 0; i < kvList.size(); i++) wb.getSheetAt(i).setSelected(false);
// 设置活动表单为第一个表单
wb.setActiveSheet(0);
FileOutputStream fileOut = new FileOutputStream(source);
wb.write(fileOut);
//关闭Excel

Loading…
Cancel
Save