Validation

Validation class

Represents data validation.settings.

Methods

NameDescription
addArea(cellArea)Applies the validation to the area. It is equivalent to use addArea(com.aspose.cells.CellArea, boolean, boolean) with ch
addArea(cellArea, checkIntersection, checkEdge)Applies the validation to the area. In this method, we will remove all old validations in given area. For the top-left o
addAreas(areas, checkIntersection, checkEdge)Applies the validation to given areas. In this method, we will remove all old validations in given area. For the top-lef
copy(source, copyOption)Copy validation.
getAlertStyle()Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
getAreas()Gets all CellArea which contain the data validation settings.
getErrorMessage()Represents the data validation error message.
getErrorTitle()Represents the title of the data-validation error dialog box.
getFormula1()Represents the value or expression associated with the data validation.
getFormula1(isR1C1, isLocal)Gets the value or expression associated with this validation.
getFormula1(isR1C1, isLocal, row, column)Gets the value or expression associated with this validation for specific cell.
getFormula2()Represents the value or expression associated with the data validation.
getFormula2(isR1C1, isLocal)Gets the value or expression associated with this validation.
getFormula2(isR1C1, isLocal, row, column)Gets the value or expression associated with this validation for specific cell.
getIgnoreBlank()Indicates whether blank values are permitted by the range data validation.
getInCellDropDown()Indicates whether data validation displays a drop-down list that contains acceptable values.
getInputMessage()Represents the data validation input message.
getInputTitle()Represents the title of the data-validation input dialog box.
getListValue(row, column)Get the value for list of the validation for the specified cell. Only for validation whose type is List and has been app
getOperator()Represents the operator for the data validation. The value of the property is OperatorType integer constant.
getShowError()Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
getShowInput()Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data valid
getType()Represents the data validation type. The value of the property is ValidationType integer constant.
getValue(row, column, isValue1)Get the value of validation on the specific cell.
getValue1()Represents the first value associated with the data validation.
getValue2()Represents the second value associated with the data validation.
removeACell(row, column)Remove the validation settings in the cell.
removeArea(cellArea)Remove the validation settings in the range.
removeAreas(areas)Removes this validation from given areas.
setAlertStyle()Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
setErrorMessage()Represents the data validation error message.
setErrorTitle()Represents the title of the data-validation error dialog box.
setFormula1()Represents the value or expression associated with the data validation.
setFormula1(formula, isR1C1, isLocal)Sets the value or expression associated with this validation.
setFormula2()Represents the value or expression associated with the data validation.
setFormula2(formula, isR1C1, isLocal)Sets the value or expression associated with this validation.
setIgnoreBlank()Indicates whether blank values are permitted by the range data validation.
setInCellDropDown()Indicates whether data validation displays a drop-down list that contains acceptable values.
setInputMessage()Represents the data validation input message.
setInputTitle()Represents the title of the data-validation input dialog box.
setOperator()Represents the operator for the data validation. The value of the property is OperatorType integer constant.
setShowError()Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
setShowInput()Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data valid
setType()Represents the data validation type. The value of the property is ValidationType integer constant.
setValue1()Represents the first value associated with the data validation.
setValue2()Represents the second value associated with the data validation.

addArea(cellArea)

Applies the validation to the area. It is equivalent to use addArea(com.aspose.cells.CellArea, boolean, boolean) with checking intersection and edge.

ParameterTypeDescription
cellAreaCellAreaThe area.

addArea(cellArea, checkIntersection, checkEdge)

Applies the validation to the area. In this method, we will remove all old validations in given area. For the top-left one of Validation’s applied ranges, firstly its StartRow is smallest, secondly its StartColumn is the smallest one of those areas who have the same smallest StartRow.

ParameterTypeDescription
cellAreaCellAreaThe area.
checkIntersectionbooleanWhether check the intersection of given area with existing validations’ areas. If one validation has been applied in given area(or part of it), then the existing validation should be removed at first from given area. Otherwise corruption may be caused for the generated Validations. If user is sure that the added area does not intersect with any existing area, this parameter can be set as false for performance consideration.
checkEdgebooleanWhether check the edge of this validation’s applied areas. Validation’s internal settings depend on the top-left one of its applied ranges, so if given area will become the new top-left one of the applied ranges, the internal settings should be changed and rebuilt, otherwise unexpected result may be caused. If user is sure that the added area is not the top-left one, this parameter can be set as false for performance consideration.

addAreas(areas, checkIntersection, checkEdge)

Applies the validation to given areas. In this method, we will remove all old validations in given area. For the top-left one of Validation’s applied ranges, firstly its StartRow is smallest, secondly its StartColumn is the smallest one of those areas who have the same smallest StartRow.

ParameterTypeDescription
areasArray ofCellAreaThe areas.
checkIntersectionbooleanWhether check the intersection of given area with existing validations’ areas. If one validation has been applied in given area(or part of it), then the existing validation should be removed at first from given area. Otherwise corruption may be caused for the generated Validations. If user is sure that all the added areas do not intersect with any existing area, this parameter can be set as false for performance consideration.
checkEdgebooleanWhether check the edge of this validation’s applied areas. Validation’s internal settings depend on the top-left one of its applied ranges, so if one of given areas will become the new top-left one of the applied ranges, the internal settings should be changed and rebuilt, otherwise unexpected result may be caused. If user is sure that no one of those added areas is the top-left, this parameter can be set as false for performance consideration.

copy(source, copyOption)

Copy validation.

ParameterTypeDescription
sourceValidationThe source validation.
copyOptionCopyOptionsThe copy option.

getAlertStyle()

Represents the validation alert style. The value of the property is ValidationAlertType integer constant.

getAreas()

Gets all CellArea which contain the data validation settings.

getErrorMessage()

Represents the data validation error message.

getErrorTitle()

Represents the title of the data-validation error dialog box.

getFormula1()

Represents the value or expression associated with the data validation.

getFormula1(isR1C1, isLocal)

Gets the value or expression associated with this validation.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: String — String The value or expression associated with this validation.

getFormula1(isR1C1, isLocal, row, column)

Gets the value or expression associated with this validation for specific cell.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The value or expression associated with this validation.

getFormula2()

Represents the value or expression associated with the data validation.

getFormula2(isR1C1, isLocal)

Gets the value or expression associated with this validation.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: String — String The value or expression associated with this validation.

getFormula2(isR1C1, isLocal, row, column)

Gets the value or expression associated with this validation for specific cell.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The value or expression associated with this validation.

getIgnoreBlank()

Indicates whether blank values are permitted by the range data validation.

getInCellDropDown()

Indicates whether data validation displays a drop-down list that contains acceptable values.

getInputMessage()

Represents the data validation input message.

getInputTitle()

Represents the title of the data-validation input dialog box.

getListValue(row, column)

Get the value for list of the validation for the specified cell. Only for validation whose type is List and has been applied to given cell, otherwise null will be returned.

ParameterTypeDescription
rowNumberThe row index.
columnNumberThe column index.

Returns: Object — Object The value to produce the list of this validation for the specified cell. If the list references to a range, then the returned value will be a ReferredArea object; Otherwise the returned value may be null, object[], or simple object.

getOperator()

Represents the operator for the data validation. The value of the property is OperatorType integer constant.

getShowError()

Indicates whether the data validation error message will be displayed whenever the user enters invalid data.

getShowInput()

Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.

getType()

Represents the data validation type. The value of the property is ValidationType integer constant.

getValue(row, column, isValue1)

Get the value of validation on the specific cell.

ParameterTypeDescription
rowNumberThe row index.
columnNumberThe column index.
isValue1booleanIndicates whether getting the first value.

Returns: Object — Object

getValue1()

Represents the first value associated with the data validation.

getValue2()

Represents the second value associated with the data validation.

removeACell(row, column)

Remove the validation settings in the cell.

ParameterTypeDescription
rowNumberThe row index.
columnNumberThe column index.

removeArea(cellArea)

Remove the validation settings in the range.

ParameterTypeDescription
cellAreaCellAreathe areas where this validation settings should be removed.

removeAreas(areas)

Removes this validation from given areas.

ParameterTypeDescription
areasArray ofCellAreathe areas where this validation settings should be removed.

setAlertStyle()

Represents the validation alert style. The value of the property is ValidationAlertType integer constant.

setErrorMessage()

Represents the data validation error message.

setErrorTitle()

Represents the title of the data-validation error dialog box.

setFormula1()

Represents the value or expression associated with the data validation.

setFormula1(formula, isR1C1, isLocal)

Sets the value or expression associated with this validation.

ParameterTypeDescription
formulaStringThe value or expression associated with this format condition.
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setFormula2()

Represents the value or expression associated with the data validation.

setFormula2(formula, isR1C1, isLocal)

Sets the value or expression associated with this validation.

ParameterTypeDescription
formulaStringThe value or expression associated with this format condition.
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setIgnoreBlank()

Indicates whether blank values are permitted by the range data validation.

setInCellDropDown()

Indicates whether data validation displays a drop-down list that contains acceptable values.

setInputMessage()

Represents the data validation input message.

setInputTitle()

Represents the title of the data-validation input dialog box.

setOperator()

Represents the operator for the data validation. The value of the property is OperatorType integer constant.

setShowError()

Indicates whether the data validation error message will be displayed whenever the user enters invalid data.

setShowInput()

Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.

setType()

Represents the data validation type. The value of the property is ValidationType integer constant.

setValue1()

Represents the first value associated with the data validation.

setValue2()

Represents the second value associated with the data validation.