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->getAreaList()->add($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.
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.
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)
        Applies the validation to the area. In this method , we will remove all old validations on this area.
        Parameters:
        cellArea: CellArea - The area.
      • removeArea

        function removeArea(cellArea)
        Remove the validation settings in the range.
        Parameters:
        cellArea: CellArea - The range which contains the data validation settings.
      • 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.