asposecells.api

Class Validation

Represents data validation.settings.

Example:

workbook = Workbook()
validations = workbook.getWorksheets().get(0).getValidations()
validation = validations.get(validations.add())
validation.setType(ValidationType.WHOLE_NUMBER)
validation.setOperator(OperatorType.BETWEEN)
validation.setFormula1("3")
validation.setFormula2("1234")

area = CellArea()
area.StartRow = 0
area.EndRow = 1
area.StartColumn = 0
area.EndColumn = 1

validation.addArea(area)

Property Getters/Setters Summary
methodgetAlertStyle()
method
           Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
methodgetAreas()
Gets all CellArea which contain the data validation settings.
methodgetErrorMessage()
method
           Represents the data validation error message.
methodgetErrorTitle()
method
           Represents the title of the data-validation error dialog box.
methodgetFormula1()
method
           Represents the value or expression associated with the data validation.
methodgetFormula2()
method
           Represents the value or expression associated with the data validation.
methodgetIgnoreBlank()
method
           Indicates whether blank values are permitted by the range data validation.
methodgetInCellDropDown()
method
           Indicates whether data validation displays a drop-down list that contains acceptable values.
methodgetInputMessage()
method
           Represents the data validation input message.
methodgetInputTitle()
method
           Represents the title of the data-validation input dialog box.
methodgetOperator()
method
           Represents the operator for the data validation. The value of the property is OperatorType integer constant.
methodgetShowError()
method
           Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
methodgetShowInput()
method
           Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
methodgetType()
method
setType(value)
           Represents the data validation type. The value of the property is ValidationType integer constant.
methodgetValue1()
method
setValue1(value)
           Represents the first value associated with the data validation.
methodgetValue2()
method
setValue2(value)
           Represents the second value associated with the data validation.
 
Method Summary
methodaddArea(cellArea)
Applies the validation to the area.
methodaddArea(cellArea, checkIntersection, checkEdge)
Applies the validation to the area.
methodaddAreas(areas, checkIntersection, checkEdge)
Applies the validation to given areas.
methodcopy(source, copyOption)
Copy validation.
methodgetFormula1(isR1C1, isLocal)
Gets the value or expression associated with this validation.
methodgetFormula1(isR1C1, isLocal, row, column)
Gets the value or expression associated with this validation for specific cell.
methodgetFormula2(isR1C1, isLocal)
Gets the value or expression associated with this validation.
methodgetFormula2(isR1C1, isLocal, row, column)
Gets the value or expression associated with this validation for specific cell.
methodgetListValue(row, column)
Get the value for list of the validation for the specified cell.
methodremoveACell(row, column)
Remove the validation settings in the cell.
methodremoveArea(cellArea)
Remove the validation settings in the range.
methodremoveAreas(areas)
Removes this validation from given areas.
methodsetFormula1(formula, isR1C1, isLocal)
Sets the value or expression associated with this validation.
methodsetFormula2(formula, isR1C1, isLocal)
Sets the value or expression associated with this validation.
 

    • Property Getters/Setters Detail

      • getOperator/setOperator : int 

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

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

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

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

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

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

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

        boolean getShowInput() / 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 

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

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

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

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

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

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

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

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

      • getFormula1

        String 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

        String 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

        String 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: int - The row index.
        column: int - The column index.
        Returns:
        The value or expression associated with this validation.
      • getFormula2

        String 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: int - The row index.
        column: int - The column index.
        Returns:
        The value or expression associated with this validation.
      • setFormula1

         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

         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

        Object 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: int - The row index.
        column: int - 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

         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 thoses 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

         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 thoses 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

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

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

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

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