[]
Use this class to inspect details about a data validation entry that could not be processed during JSON import, such as the worksheet that contains the error, the affected range, and the validation content that caused the error. Instances of this class can be reported in the list returned by Workbook.fromJson(String).
Workbook sourceWorkbook = new Workbook();
IValidation validation = sourceWorkbook.getWorksheets().get(0).getRange("A1:A3").getValidation();
validation.add(ValidationType.Custom, ValidationAlertStyle.Stop,
ValidationOperator.Between, "=A1>0", null);
String json = sourceWorkbook.toJson().replace("A1>0", "A1>");
Workbook importedWorkbook = new Workbook();
List<JsonError> errors = importedWorkbook.fromJson(json);
DataValidationJsonError error = (DataValidationJsonError) errors.get(0);
String range = error.getRange();
DataValidationJsonError(String errorMessage,
String worksheetName,
String range,
String errorContent) getRange()getErrorMessageerrorMessage - The error message.worksheetName - The worksheet name.range - The cell range associated with the error.errorContent - The validation content that caused the error.This method returns the worksheet name stored in this DataValidationJsonError when the error object was created. The value identifies the worksheet that contains the data validation entry that could not be processed during JSON import.
Workbook sourceWorkbook = new Workbook();
IValidation validation = sourceWorkbook.getWorksheets().get(0).getRange("A1:A3").getValidation();
validation.add(ValidationType.Custom, ValidationAlertStyle.Stop,
ValidationOperator.Between, "=A1>0", null);
String json = sourceWorkbook.toJson().replace("A1>0", "A1>");
Workbook importedWorkbook = new Workbook();
List<JsonError> errors = importedWorkbook.fromJson(json);
DataValidationJsonError error = (DataValidationJsonError) errors.get(0);
String worksheetName = error.getWorksheetName();
null if no worksheet name was stored.This method returns the range string recorded for the data validation error when JSON content is imported and a data validation issue is detected.
Workbook sourceWorkbook = new Workbook();
IValidation validation = sourceWorkbook.getWorksheets().get(0).getRange("A1:A3").getValidation();
validation.add(ValidationType.Custom, ValidationAlertStyle.Stop,
ValidationOperator.Between, "=A1>0", null);
String json = sourceWorkbook.toJson().replace("A1>0", "A1>");
Workbook importedWorkbook = new Workbook();
List<JsonError> errors = importedWorkbook.fromJson(json);
DataValidationJsonError error = (DataValidationJsonError) errors.get(0);
String range = error.getRange();
This method returns the validation content captured for a data validation entry that could not be processed during JSON import, such as a formula or other validation definition stored with the error details.
Workbook sourceWorkbook = new Workbook();
IValidation validation = sourceWorkbook.getWorksheets().get(0).getRange("A1:A3").getValidation();
validation.add(ValidationType.Custom, ValidationAlertStyle.Stop,
ValidationOperator.Between, "=A1>0", null);
String json = sourceWorkbook.toJson().replace("A1>0", "A1>");
Workbook importedWorkbook = new Workbook();
List<JsonError> errors = importedWorkbook.fromJson(json);
DataValidationJsonError error = (DataValidationJsonError) errors.get(0);
String errorContent = error.getErrorContent();
null if no error content was stored.