Validation

Validation class

Represents data validation.settings.

class Validation;

Methods

MethodDescription
getOperator()Represents the operator for the data validation.
setOperator(OperatorType)Represents the operator for the data validation.
getAlertStyle()Represents the validation alert style.
setAlertStyle(ValidationAlertType)Represents the validation alert style.
getType()Represents the data validation type.
setType(ValidationType)Represents the data validation type.
getInputMessage()Represents the data validation input message.
setInputMessage(string)Represents the data validation input message.
getInputTitle()Represents the title of the data-validation input dialog box.
setInputTitle(string)Represents the title of the data-validation input dialog box.
getErrorMessage()Represents the data validation error message.
setErrorMessage(string)Represents the data validation error message.
getErrorTitle()Represents the title of the data-validation error dialog box.
setErrorTitle(string)Represents the title of the data-validation error dialog box.
getShowInput()Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
setShowInput(boolean)Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
getShowError()Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
setShowError(boolean)Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
getIgnoreBlank()Indicates whether blank values are permitted by the range data validation.
setIgnoreBlank(boolean)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.
setInCellDropDown(boolean)Indicates whether data validation displays a drop-down list that contains acceptable values.
getAreas()Gets all CellArea which contain the data validation settings.
getFormula1(boolean, boolean)Gets the value or expression associated with this validation.
getFormula1(boolean, boolean, number, number)Gets the value or expression associated with this validation for specific cell.
getFormula2(boolean, boolean)Gets the value or expression associated with this validation.
getFormula2(boolean, boolean, number, number)Gets the value or expression associated with this validation for specific cell.
setFormula1(string, boolean, boolean)Sets the value or expression associated with this validation.
setFormula2(string, boolean, boolean)Sets the value or expression associated with this validation.
addArea(CellArea)Applies the validation to the area.
addArea(CellArea, boolean, boolean)Applies the validation to the area.
addAreas(CellArea[], boolean, boolean)Applies the validation to given areas.
removeArea(CellArea)Remove the validation settings in the range.
removeAreas(CellArea[])Removes this validation from given areas.
removeACell(number, number)Remove the validation settings in the cell.
copy(Validation, CopyOptions)Copy validation.

getOperator()

Represents the operator for the data validation.

getOperator() : OperatorType;

Returns

OperatorType

setOperator(OperatorType)

Represents the operator for the data validation.

setOperator(value: OperatorType) : void;

Parameters:

ParameterTypeDescription
valueOperatorTypeThe value to set.

getAlertStyle()

Represents the validation alert style.

getAlertStyle() : ValidationAlertType;

Returns

ValidationAlertType

setAlertStyle(ValidationAlertType)

Represents the validation alert style.

setAlertStyle(value: ValidationAlertType) : void;

Parameters:

ParameterTypeDescription
valueValidationAlertTypeThe value to set.

getType()

Represents the data validation type.

getType() : ValidationType;

Returns

ValidationType

setType(ValidationType)

Represents the data validation type.

setType(value: ValidationType) : void;

Parameters:

ParameterTypeDescription
valueValidationTypeThe value to set.

getInputMessage()

Represents the data validation input message.

getInputMessage() : string;

setInputMessage(string)

Represents the data validation input message.

setInputMessage(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getInputTitle()

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

getInputTitle() : string;

setInputTitle(string)

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

setInputTitle(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getErrorMessage()

Represents the data validation error message.

getErrorMessage() : string;

setErrorMessage(string)

Represents the data validation error message.

setErrorMessage(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getErrorTitle()

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

getErrorTitle() : string;

setErrorTitle(string)

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

setErrorTitle(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getShowInput()

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

getShowInput() : boolean;

setShowInput(boolean)

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

setShowInput(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShowError()

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

getShowError() : boolean;

setShowError(boolean)

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

setShowError(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getIgnoreBlank()

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

getIgnoreBlank() : boolean;

setIgnoreBlank(boolean)

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

setIgnoreBlank(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getInCellDropDown()

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

getInCellDropDown() : boolean;

setInCellDropDown(boolean)

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

setInCellDropDown(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAreas()

Gets all CellArea which contain the data validation settings.

getAreas() : CellArea[];

Returns

CellArea[]

getFormula1(boolean, boolean)

Gets the value or expression associated with this validation.

getFormula1(isR1C1: boolean, isLocal: boolean) : string;

Parameters:

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(boolean, boolean, number, number)

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

getFormula1(isR1C1: boolean, isLocal: boolean, row: number, column: number) : string;

Parameters:

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

The value or expression associated with this validation.

getFormula2(boolean, boolean)

Gets the value or expression associated with this validation.

getFormula2(isR1C1: boolean, isLocal: boolean) : string;

Parameters:

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(boolean, boolean, number, number)

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

getFormula2(isR1C1: boolean, isLocal: boolean, row: number, column: number) : string;

Parameters:

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

The value or expression associated with this validation.

setFormula1(string, boolean, boolean)

Sets the value or expression associated with this validation.

setFormula1(formula: string, isR1C1: boolean, isLocal: boolean) : void;

Parameters:

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

setFormula2(string, boolean, boolean)

Sets the value or expression associated with this validation.

setFormula2(formula: string, isR1C1: boolean, isLocal: boolean) : void;

Parameters:

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

addArea(CellArea)

Applies the validation to the area.

addArea(cellArea: CellArea) : void;

Parameters:

ParameterTypeDescription
cellAreaCellAreaThe area.

Remarks

It is equivalent to use AddArea(Aspose.Cells.CellArea,bool,bool) with checking intersection and edge.

addArea(CellArea, boolean, boolean)

Applies the validation to the area.

addArea(cellArea: CellArea, checkIntersection: boolean, checkEdge: boolean) : void;

Parameters:

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.

Remarks

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.

addAreas(CellArea[], boolean, boolean)

Applies the validation to given areas.

addAreas(areas: CellArea[], checkIntersection: boolean, checkEdge: boolean) : void;

Parameters:

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.

Remarks

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.

removeArea(CellArea)

Remove the validation settings in the range.

removeArea(cellArea: CellArea) : void;

Parameters:

ParameterTypeDescription
cellAreaCellAreathe areas where this validation settings should be removed.

removeAreas(CellArea[])

Removes this validation from given areas.

removeAreas(areas: CellArea[]) : void;

Parameters:

ParameterTypeDescription
areasCellArea[]the areas where this validation settings should be removed.

removeACell(number, number)

Remove the validation settings in the cell.

removeACell(row: number, column: number) : void;

Parameters:

ParameterTypeDescription
rownumberThe row index.
columnnumberThe column index.

copy(Validation, CopyOptions)

Copy validation.

copy(source: Validation, copyOption: CopyOptions) : void;

Parameters:

ParameterTypeDescription
sourceValidationThe source validation.
copyOptionCopyOptionsThe copy option.