help wanted
Metriche repository
- Star
- (33.728 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
建议先去看文档
异常代码
public static class NumericValidationWriteHandler implements SheetWriteHandler {
private final int firstCol, lastCol;
public NumericValidationWriteHandler(int firstCol, int lastCol) {
this.firstCol = firstCol;
this.lastCol = lastCol;
}
@Override
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
Sheet sheet = writeSheetHolder.getSheet();
DataValidationHelper helper = sheet.getDataValidationHelper();
CellRangeAddressList addressList = new CellRangeAddressList(1, 65535, firstCol, lastCol);
DataValidationConstraint constraint = helper.createCustomConstraint("ISNUMBER(A1)");
DataValidation dataValidation = helper.createValidation(constraint, addressList);
dataValidation.setErrorStyle(DataValidation.ErrorStyle.STOP);
dataValidation.setShowErrorBox(true);
dataValidation.createErrorBox("错误:", "赋值属性只能为数字");
sheet.addValidationData(dataValidation);
}
}
sheet.setCustomWriteHandlerList(Lists.newArrayList(
new EasyExcelExportExample.NumericValidationWriteHandler(1, 1),
new EasyExcelExportExample.NumericValidationWriteHandler(3, 3)
));
异常提示
大家尽量把问题一次性描述清楚,然后贴上全部异常,这样方便把问题一次性解决掉。 至少大家要符合一个原则就是,能让其他人复现出这个问题,如果无法复现,肯定无法解决。
问题描述
设置所有行的单元格公式为数字,但是只有前两行可以,但是即使输入数字也报错。所以想问一下是否支持,还是只能用poi本身的功能?