|
|
@ -560,7 +560,7 @@ public class WExcel<T> implements Serializable, Cloneable {
|
|
|
|
sheet.setColumnWidth(j + offset, (4 + column.getCellWidth()) * 256);
|
|
|
|
sheet.setColumnWidth(j + offset, (4 + column.getCellWidth()) * 256);
|
|
|
|
|
|
|
|
|
|
|
|
if (column.getCellList() != null){
|
|
|
|
if (column.getCellList() != null){
|
|
|
|
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 65535, j, j);
|
|
|
|
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 65535, j+offset, j+offset);
|
|
|
|
DataValidationHelper helper = sheet.getDataValidationHelper();
|
|
|
|
DataValidationHelper helper = sheet.getDataValidationHelper();
|
|
|
|
DataValidationConstraint constraint = helper.createExplicitListConstraint(column.getCellList());
|
|
|
|
DataValidationConstraint constraint = helper.createExplicitListConstraint(column.getCellList());
|
|
|
|
DataValidation dataValidation = helper.createValidation(constraint, cellRangeAddressList);
|
|
|
|
DataValidation dataValidation = helper.createValidation(constraint, cellRangeAddressList);
|
|
|
@ -574,7 +574,7 @@ public class WExcel<T> implements Serializable, Cloneable {
|
|
|
|
|
|
|
|
|
|
|
|
dataValidation.setEmptyCellAllowed(true);
|
|
|
|
dataValidation.setEmptyCellAllowed(true);
|
|
|
|
dataValidation.setShowPromptBox(true);
|
|
|
|
dataValidation.setShowPromptBox(true);
|
|
|
|
dataValidation.createPromptBox("提示", "只能选择下拉框里面的数据");
|
|
|
|
dataValidation.createPromptBox("提示", "请选择下拉框里面的数据");
|
|
|
|
sheet.addValidationData(dataValidation);
|
|
|
|
sheet.addValidationData(dataValidation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -599,7 +599,7 @@ public class WExcel<T> implements Serializable, Cloneable {
|
|
|
|
// 添加错误信息详细说明
|
|
|
|
// 添加错误信息详细说明
|
|
|
|
Cell errsCell = row.createCell(1);
|
|
|
|
Cell errsCell = row.createCell(1);
|
|
|
|
errsCell.setCellStyle(new ErrorCellStyle(workbook).getStyle());
|
|
|
|
errsCell.setCellStyle(new ErrorCellStyle(workbook).getStyle());
|
|
|
|
String join = String.join(";", errorList);
|
|
|
|
String join = String.join("\n", errorList);
|
|
|
|
errsCell.setCellValue(new XSSFRichTextString(join));
|
|
|
|
errsCell.setCellValue(new XSSFRichTextString(join));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 添加结果
|
|
|
|
// 添加结果
|
|
|
|