IRange usedRange = worksheet.getUsedRange();
IRange iRange;
IValidation validation;
for (int i = usedRange.getRow(); i < usedRange.getLastRow() + 1; i++) {
for (int j = usedRange.getColumn(); j < usedRange.getLastColumn() + 1; j++) {
iRange = usedRange.get(i, j);
validation = iRange.getValidation();
if (!iRange.getHasValidation() || !validation.getShowError()) {
continue;
}
if (iRange.getValue() == null && !validation.getIgnoreBlank()) {
throw new GenericException(ErrorCode.CHECK_VALIDATION_NULL_ERROR, iRange.getAddress());
} else if (!validation.getValue()) {
throw new GenericException(ErrorCode.CHECK_VALIDATION_ERROR,
iRange.getAddress(),
validation.getErrorMessage());
}
}
}
|