aspose.cells

Class Validation

Represents data validation.settings.

Example:

$workbook = new cells\Workbook();
$validations = $workbook->getWorksheets()->get(0)->getValidations();
$validation = $validations->get($validations->add());
$validation->setType(cells\ValidationType::WHOLE_NUMBER);
$validation->setOperator(cells\OperatorType::BETWEEN);
$validation->setFormula1("3");
$validation->setFormula2("1234");

$area = new cells\CellArea();
$area->StartRow = 0;
$area->EndRow = 1;
$area->StartColumn = 0;
$area->EndColumn = 1;
$validation->addArea($area);

Property Getters/Setters Summary
functiongetAlertStyle()
function
           Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
functiongetAreas()
Gets all CellArea which contain the data validation settings.
functiongetErrorMessage()
function
           Represents the data validation error message.
functiongetErrorTitle()
function
           Represents the title of the data-validation error dialog box.
functiongetFormula1()
function
           Represents the value or expression associated with the data validation.
functiongetFormula2()
function
           Represents the value or expression associated with the data validation.
functiongetIgnoreBlank()
function
           Indicates whether blank values are permitted by the range data validation.
functiongetInCellDropDown()
function
           Indicates whether data validation displays a drop-down list that contains acceptable values.
functiongetInputMessage()
function
           Represents the data validation input message.
functiongetInputTitle()
function
           Represents the title of the data-validation input dialog box.
functiongetOperator()
function
           Represents the operator for the data validation. The value of the property is OperatorType integer constant.
functiongetShowError()
function
           Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
functiongetShowInput()
function
           Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
functiongetType()
function
setType(value)
           Represents the data validation type. The value of the property is ValidationType integer constant.
functiongetValue1()
function
setValue1(value)
           Represents the first value associated with the data validation.
functiongetValue2()
function
setValue2(value)
           Represents the second value associated with the data validation.
 
Method Summary
functionaddArea(cellArea)
Applies the validation to the area.
functionaddArea(cellArea, checkIntersection, checkEdge)
Applies the validation to the area.
functionaddAreas(areas, checkIntersection, checkEdge)
Applies the validation to given areas.
functioncopy(source, copyOption)
Copy validation.
functiongetFormula1(isR1C1, isLocal)
Gets the value or expression associated with this validation.
functiongetFormula1(isR1C1, isLocal, row, column)
Gets the value or expression associated with this validation for specific cell.
functiongetFormula2(isR1C1, isLocal)
Gets the value or expression associated with this validation.
functiongetFormula2(isR1C1, isLocal, row, column)
Gets the value or expression associated with this validation for specific cell.
functiongetListValue(row, column)
Get the value for list of the validation for the specified cell.
functionremoveACell(row, column)
Remove the validation settings in the cell.
functionremoveArea(cellArea)
Remove the validation settings in the range.
functionremoveAreas(areas)
Removes this validation from given areas.
functionsetFormula1(formula, isR1C1, isLocal)
Sets the value or expression associated with this validation.
functionsetFormula2(formula, isR1C1, isLocal)
Sets the value or expression associated with this validation.
 

    • Property Getters/Setters Detail

      • getOperator/setOperator : Number 

        function getOperator() / function setOperator(value)
        
        Represents the operator for the data validation. The value of the property is OperatorType integer constant.
      • getAlertStyle/setAlertStyle : Number 

        function getAlertStyle() / function setAlertStyle(value)
        
        Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
      • getType/setType : Number 

        function getType() / function setType(value)
        
        Represents the data validation type. The value of the property is ValidationType integer constant.
      • getInputMessage/setInputMessage : String 

        function getInputMessage() / function setInputMessage(value)
        
        Represents the data validation input message.
      • getInputTitle/setInputTitle : String 

        function getInputTitle() / function setInputTitle(value)
        
        Represents the title of the data-validation input dialog box.
      • getErrorMessage/setErrorMessage : String 

        function getErrorMessage() / function setErrorMessage(value)
        
        Represents the data validation error message.
      • getErrorTitle/setErrorTitle : String 

        function getErrorTitle() / function setErrorTitle(value)
        
        Represents the title of the data-validation error dialog box.
      • getShowInput/setShowInput : boolean 

        function getShowInput() / function setShowInput(value)
        
        Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
      • getShowError/setShowError : boolean 

        function getShowError() / function setShowError(value)
        
        Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
      • getIgnoreBlank/setIgnoreBlank : boolean 

        function getIgnoreBlank() / function setIgnoreBlank(value)
        
        Indicates whether blank values are permitted by the range data validation.
      • getFormula1/setFormula1 : String 

        function getFormula1() / function setFormula1(value)
        
        Represents the value or expression associated with the data validation.
      • getFormula2/setFormula2 : String 

        function getFormula2() / function setFormula2(value)
        
        Represents the value or expression associated with the data validation.
      • getValue1/setValue1 : Object 

        function getValue1() / function setValue1(value)
        
        Represents the first value associated with the data validation.
      • getValue2/setValue2 : Object 

        function getValue2() / function setValue2(value)
        
        Represents the second value associated with the data validation.
      • getInCellDropDown/setInCellDropDown : boolean 

        function getInCellDropDown() / function setInCellDropDown(value)
        
        Indicates whether data validation displays a drop-down list that contains acceptable values.
      • getAreas : CellArea[] 

        function getAreas()
        
        Gets all CellArea which contain the data validation settings.
    • Method Detail

      • getFormula1

        function getFormula1(isR1C1, isLocal)
        Gets the value or expression associated with this validation.
        Parameters:
        isR1C1: boolean - Whether the formula needs to be formatted as R1C1.
        isLocal: boolean - Whether the formula needs to be formatted by locale.
        Returns:
        The value or expression associated with this validation.
      • getFormula2

        function getFormula2(isR1C1, isLocal)
        Gets the value or expression associated with this validation.
        Parameters:
        isR1C1: boolean - Whether the formula needs to be formatted as R1C1.
        isLocal: boolean - Whether the formula needs to be formatted by locale.
        Returns:
        The value or expression associated with this validation.
      • getFormula1

        function getFormula1(isR1C1, isLocal, row, column)
        Gets the value or expression associated with this validation for specific cell.
        Parameters:
        isR1C1: boolean - Whether the formula needs to be formatted as R1C1.
        isLocal: boolean - Whether the formula needs to be formatted by locale.
        row: Number - The row index.
        column: Number - The column index.
        Returns:
        The value or expression associated with this validation.
      • getFormula2

        function getFormula2(isR1C1, isLocal, row, column)
        Gets the value or expression associated with this validation for specific cell.
        Parameters:
        isR1C1: boolean - Whether the formula needs to be formatted as R1C1.
        isLocal: boolean - Whether the formula needs to be formatted by locale.
        row: Number - The row index.
        column: Number - The column index.
        Returns:
        The value or expression associated with this validation.
      • setFormula1

        function setFormula1(formula, isR1C1, isLocal)
        Sets the value or expression associated with this validation.
        Parameters:
        formula: String - The value or expression associated with this format condition.
        isR1C1: boolean - Whether the formula is R1C1 formula.
        isLocal: boolean - Whether the formula is locale formatted.
      • setFormula2

        function setFormula2(formula, isR1C1, isLocal)
        Sets the value or expression associated with this validation.
        Parameters:
        formula: String - The value or expression associated with this format condition.
        isR1C1: boolean - Whether the formula is R1C1 formula.
        isLocal: boolean - Whether the formula is locale formatted.
      • getListValue

        function 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.
        Parameters:
        row: Number - The row index.
        column: Number - The 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.
      • addArea

        function 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.
        Parameters:
        cellArea: CellArea - The area.
        checkIntersection: boolean - Whether 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.
        checkEdge: boolean - Whether 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

        function 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.
        Parameters:
        areas: CellArea[] - The areas.
        checkIntersection: boolean - Whether 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.
        checkEdge: boolean - Whether 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

        function removeArea(cellArea)
        Remove the validation settings in the range.
        Parameters:
        cellArea: CellArea - the areas where this validation settings should be removed.
      • removeAreas

        function removeAreas(areas)
        Removes this validation from given areas.
        Parameters:
        areas: CellArea[] - the areas where this validation settings should be removed.
      • removeACell

        function removeACell(row, column)
        Remove the validation settings in the cell.
        Parameters:
        row: Number - The row index.
        column: Number - The column index.
      • copy

        function copy(source, copyOption)
        Copy validation.
        Parameters:
        source: Validation - The source validation.
        copyOption: CopyOptions - The copy option.