Validation

Validation class

Represents data validation.settings.

public class Validation

Properties

Name Description
AlertStyle { get; set; } Represents the validation alert style.
Areas { get; } Gets all CellArea which contain the data validation settings.
ErrorMessage { get; set; } Represents the data validation error message.
ErrorTitle { get; set; } Represents the title of the data-validation error dialog box.
Formula1 { get; set; } Represents the value or expression associated with the data validation.
Formula2 { get; set; } Represents the value or expression associated with the data validation.
IgnoreBlank { get; set; } Indicates whether blank values are permitted by the range data validation.
InCellDropDown { get; set; } Indicates whether data validation displays a drop-down list that contains acceptable values.
InputMessage { get; set; } Represents the data validation input message.
InputTitle { get; set; } Represents the title of the data-validation input dialog box.
Operator { get; set; } Represents the operator for the data validation.
ShowError { get; set; } Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
ShowInput { get; set; } Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
Type { get; set; } Represents the data validation type.
Value1 { get; set; } Represents the first value associated with the data validation.
Value2 { get; set; } Represents the second value associated with the data validation.

Methods

Name Description
AddArea(CellArea) Applies the validation to the area.
AddArea(CellArea, bool, bool) Applies the validation to the area.
AddAreas(CellArea[], bool, bool) Applies the validation to given areas.
Copy(Validation, CopyOptions) Copy validation.
GetFormula1(bool, bool) Gets the value or expression associated with this validation.
GetFormula1(bool, bool, int, int) Gets the value or expression associated with this validation for specific cell.
GetFormula2(bool, bool) Gets the value or expression associated with this validation.
GetFormula2(bool, bool, int, int) Gets the value or expression associated with this validation for specific cell.
GetListValue(int, int) Get the value for list of the validation for the specified cell.
RemoveACell(int, int) Remove the validation settings in the cell.
RemoveArea(CellArea) Remove the validation settings in the range.
RemoveAreas(CellArea[]) Removes this validation from given areas.
SetFormula1(string, bool, bool) Sets the value or expression associated with this validation.
SetFormula2(string, bool, bool) Sets the value or expression associated with this validation.

Examples

[C#]
Workbook workbook = new Workbook();
ValidationCollection validations = workbook.Worksheets[0].Validations;
CellArea area = CellArea.CreateCellArea(0, 0, 1, 1);
Validation validation = validations[validations.Add(area)];
validation.Type = Aspose.Cells.ValidationType.WholeNumber;
validation.Operator = OperatorType.Between;
validation.Formula1 = "3";
validation.Formula2 = "1234";

[Visual Basic]
Dim workbook as Workbook = new Workbook()
Dim validations as ValidationCollection  = workbook.Worksheets(0).Validations
Dim area as CellArea = CellArea.CreateCellArea(0, 0, 1, 1);
Dim validation as Validation = validations(validations.Add(area))
validation.Type = ValidationType.WholeNumber
validation.Operator = OperatorType.Between
validation.Formula1 = "3"
validation.Formula2 = "1234"

See Also