Validation class

Validation class

Represents data validation.settings.

The Validation type exposes the following members:

Properties

PropertyDescription
operatorRepresents the operator for the data validation.
alert_styleRepresents the validation alert style.
typeRepresents the data validation type.
input_messageRepresents the data validation input message.
input_titleRepresents the title of the data-validation input dialog box.
error_messageRepresents the data validation error message.
error_titleRepresents the title of the data-validation error dialog box.
show_inputIndicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
show_errorIndicates whether the data validation error message will be displayed whenever the user enters invalid data.
ignore_blankIndicates whether blank values are permitted by the range data validation.
formula1Represents the value or expression associated with the data validation.
formula2Represents the value or expression associated with the data validation.
value1Represents the first value associated with the data validation.
value2Represents the second value associated with the data validation.
in_cell_drop_downIndicates whether data validation displays a drop-down list that contains acceptable values.
areasGets all CellArea which contain the data validation settings.

Methods

MethodDescription
get_formula1Gets the value or expression associated with this validation.
get_formula1Gets the value or expression associated with this validation for specific cell.
get_formula2Gets the value or expression associated with this validation.
get_formula2Gets the value or expression associated with this validation for specific cell.
add_areaApplies the validation to the area.
add_areaApplies the validation to the area.
set_formula1Sets the value or expression associated with this validation.
set_formula2Sets the value or expression associated with this validation.
get_list_valueGet the value for list of the validation for the specified cell.
get_valueGet the value of validation on the specific cell.
add_areasApplies the validation to given areas.
remove_areaRemove the validation settings in the range.
remove_areasRemoves this validation from given areas.
remove_a_cellRemove the validation settings in the cell.
copyCopy validation.

Example

from aspose.cells import CellArea, OperatorType, ValidationType, Workbook

workbook = Workbook()
validations = workbook.worksheets[0].validations
area = CellArea.create_cell_area(0, 0, 1, 1)
validation = validations[validations.add(area)]
validation.type = ValidationType.WHOLE_NUMBER
validation.operator = OperatorType.BETWEEN
validation.formula1 = "3"
validation.formula2 = "1234"

See Also