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_formula1(self, is_r1c1, is_local)Gets the value or expression associated with this validation.
get_formula1(self, is_r1c1, is_local, row, column)Gets the value or expression associated with this validation for specific cell.
get_formula2(self, is_r1c1, is_local)Gets the value or expression associated with this validation.
get_formula2(self, is_r1c1, is_local, row, column)Gets the value or expression associated with this validation for specific cell.
add_area(self, cell_area)Applies the validation to the area.
add_area(self, cell_area, check_intersection, check_edge)Applies the validation to the area.
set_formula1(self, formula, is_r1c1, is_local)Sets the value or expression associated with this validation.
set_formula2(self, formula, is_r1c1, is_local)Sets the value or expression associated with this validation.
get_list_value(self, row, column)Get the value for list of the validation for the specified cell.
get_value(self, row, column, is_value1)Get the value of validation on the specific cell.
add_areas(self, areas, check_intersection, check_edge)Applies the validation to given areas.
remove_area(self, cell_area)Remove the validation settings in the range.
remove_areas(self, areas)Removes this validation from given areas.
remove_a_cell(self, row, column)Remove the validation settings in the cell.
copy(self, source, copy_option)Copy 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