Validation

Validation class

Represents data validation.settings.

Properties

NameTypeDescription
OperatorintRepresents the operator for the data validation. The value of the property is OperatorType integer constant.
AlertStyleintRepresents the validation alert style. The value of the property is ValidationAlertType integer constant.
TypeintRepresents the data validation type. The value of the property is ValidationType integer constant.
InputMessageStringRepresents the data validation input message.
InputTitleStringRepresents the title of the data-validation input dialog box.
ErrorMessageStringRepresents the data validation error message.
ErrorTitleStringRepresents the title of the data-validation error dialog box.
ShowInputbooleanIndicates whether the data validation input message will be displayed whenever the user selects a cell in the data valid
ShowErrorbooleanIndicates whether the data validation error message will be displayed whenever the user enters invalid data.
IgnoreBlankbooleanIndicates whether blank values are permitted by the range data validation.
Formula1StringRepresents the value or expression associated with the data validation.
Formula2StringRepresents the value or expression associated with the data validation.
Value1ObjectRepresents the first value associated with the data validation.
Value2ObjectRepresents the second value associated with the data validation.
InCellDropDownbooleanIndicates whether data validation displays a drop-down list that contains acceptable values.
AreasCellArea[]Gets all CellArea which contain the data validation settings.

Methods

NameDescription
getFormula1Gets the value or expression associated with this validation.
getFormula2Gets the value or expression associated with this validation.
setFormula1Sets the value or expression associated with this validation.
setFormula2Sets the value or expression associated with this validation.
getListValueGet the value for list of the validation for the specified cell.

Only for validation whose type is List and has been ap | | getValue | Get the value of validation on the specific cell. | | addArea | Applies the validation to the area.

It is equivalent to use addArea(com.aspose.cells.CellArea, boolean, boolean) with c | | addAreas | Applies the validation to given areas.

In this method, we will remove all old validations in given area. For the top-le | | removeArea | Remove the validation settings in the range. | | removeAreas | Removes this validation from given areas. | | removeACell | Remove the validation settings in the cell. | | copy | Copy validation. |

Validation.Operator property

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

Type: int

Validation.AlertStyle property

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

Type: int

Validation.Type property

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

Type: int

Validation.InputMessage property

Represents the data validation input message.

Type: String

Validation.InputTitle property

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

Type: String

Validation.ErrorMessage property

Represents the data validation error message.

Type: String

Validation.ErrorTitle property

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

Type: String

Validation.ShowInput property

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

Type: boolean

Validation.ShowError property

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

Type: boolean

Validation.IgnoreBlank property

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

Type: boolean

Validation.Formula1 property

Represents the value or expression associated with the data validation.

Type: String

Validation.Formula2 property

Represents the value or expression associated with the data validation.

Type: String

Validation.Value1 property

Represents the first value associated with the data validation.

Type: Object

Validation.Value2 property

Represents the second value associated with the data validation.

Type: Object

Validation.InCellDropDown property

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

Type: boolean

Validation.Areas property

Gets all CellArea which contain the data validation settings.

Type: CellArea[]

getFormula1(isR1C1, isLocal) (1 of 2)

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: The value or expression associated with this validation.


getFormula1(isR1C1, isLocal, row, column) (2 of 2)

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.
rowintThe row index.
columnintThe column index.

Returns: The value or expression associated with this validation.

getFormula2(isR1C1, isLocal) (1 of 2)

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: The value or expression associated with this validation.


getFormula2(isR1C1, isLocal, row, column) (2 of 2)

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.
rowintThe row index.
columnintThe column index.

Returns: The value or expression associated with this 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(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.

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
rowintThe row index.
columnintThe column index.

Returns: 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.

getValue(row, column, isValue1)

Get the value of validation on the specific cell.

ParameterTypeDescription
rowintThe row index.
columnintThe column index.
isValue1booleanIndicates whether getting the first value.

addArea(cellArea) (1 of 2)

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) (2 of 2)

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
areasCellArea[]The 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.

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
areasCellArea[]the areas where this validation settings should be removed.

removeACell(row, column)

Remove the validation settings in the cell.

ParameterTypeDescription
rowintThe row index.
columnintThe column index.

copy(source, copyOption)

Copy validation.

ParameterTypeDescription
sourceValidationThe source validation.
copyOptionCopyOptionsThe copy option.