Namespace EasyXLS

Class ExcelDataValidator


  • public class ExcelDataValidator
    extends System.Object
    This class restricts the cell entries to a specific data type (integers, decimal numbers, or text) and sets limits on the valid entries. The validation is stored as one formula for "equal to", "not equal to", "greater than", "less than", "greater than or equal to" or "less than or equal to" operators and two formulas for "between" and "not between" operators.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExcelDataValidator()
      Defines an instance of the validator.
      ExcelDataValidator​(int firstRow, int firstColumn, int lastRow, int lastColumn, int validationType, int operatorType, System.String firstFormula, System.String secondFormula)
      Defines an instance of the validator having the specified position, validation type, operator and formula restrictions.
      ExcelDataValidator​(System.String range, int validationType, int operatorType, System.String firstFormula, System.String secondFormula)
      Defines an instance of the validator having the specified position, validation type, operator and formula restrictions.
    • Method Summary

      Modifier and Type Method Description
      void ApplyToRange​(int firstRow, int firstColumn, int lastRow, int lastColumn)
      Sets the cell range where the validation will be applied.
      void ApplyToRange​(System.String range)
      Sets the cell range where the validation will be applied.
      ExcelDataValidator Clone()
      Creates and returns a copy of this object.
      int getErrorStyle()
      Returns the "Error Alert" box style.
      System.String getErrorText()
      Returns the message of the "Error Alert"
      System.String getErrorTitle()
      Returns the title of the "Error Alert"
      int getFirstColumn()
      Returns the first column of the cell range where the validation will be applied.
      System.String getFirstFormula()
      Returns the expression of the first formula.
      int getFirstRow()
      Returns the first row of the cell range where the validation will be applied.
      System.String getInputText()
      Returns the message of the "Input Message"
      System.String getInputTitle()
      Returns the title of the "Input Message"
      int getLastColumn()
      Returns the last column of the cell range where the validation will be applied.
      int getLastRow()
      Returns the last row of the cell range where the validation will be applied.
      int getOperatorType()
      Returns the operator type.
      System.String getRange()
      Returns the range where the validation will be aplied.
      System.String getSecondFormula()
      Returns the expression of the second formula.
      int getValidationType()
      Returns the validation type.
      bool IgnoreBlank()
      Returns the ignore blank option.
      bool IsShowErrorBox()
      Returns the show "Error Alert" box option.
      bool IsShowInputBox()
      Returns the show "Input Message" box option.
      void setErrorAlert​(System.String title, System.String text)
      Sets the title and the message of the "Error Alert"
      void setErrorStyle​(int errorStyle)
      Sets the "Error Alert" box style.
      void setErrorText​(System.String textError)
      Sets the message of the "Error Alert"
      void setErrorTitle​(System.String errorTitle)
      Sets the title of the "Error Alert"
      void setFirstColumn​(int firstColumn)
      Sets the first column of the cell range where the validation will be applied.
      void setFirstFormula​(System.String formula)
      Sets the expression of the first formula.
      void setFirstRow​(int firstRow)
      Sets the first row of the cell range where the validation will be applied.
      void setIgnoreBlank​(bool ignoreBlank)
      Sets the ignore blank option.
      void setInputMessage​(System.String title, System.String text)
      Sets the title and the message of the "Input Message"
      void setInputText​(System.String inputText)
      Sets the message of the "Input Message"
      void setInputTitle​(System.String inputTitle)
      Sets the title of the "Input Message"
      void setIsShowErrorBox​(bool showErrorBox)
      Sets the show "Error Alert" box option.
      void setIsShowInputBox​(bool showInputBox)
      Sets the show "Input Message" box option.
      void setLastColumn​(int lastColumn)
      Sets the last column of the cell range where the validation will be applied.
      void setLastRow​(int lastRow)
      Sets the last row of the cell range where the validation will be applied.
      void setOperatorType​(int operatorType)
      Sets the operator type.
      void setSecondFormula​(System.String formula)
      Sets the expression of the second formula.
      void setValidationType​(int validationType)
      Sets the validation type.
    • Constructor Detail

      • ExcelDataValidator

        public ExcelDataValidator()
        Defines an instance of the validator.
      • ExcelDataValidator

        public ExcelDataValidator​(System.String range,
                                  int validationType,
                                  int operatorType,
                                  System.String firstFormula,
                                  System.String secondFormula)
        Defines an instance of the validator having the specified position, validation type, operator and formula restrictions.
        Parameters:
        range - the area location of the data validator. It can be a cell reference or a range.
        operatorType - the operator type. Possible values are available in DataValidator class.
        validationType - the validation type. Possible values are available in DataValidator class.
        firstFormula - the expression of the first formula
        secondFormula - the expression of the second formula
      • ExcelDataValidator

        public ExcelDataValidator​(int firstRow,
                                  int firstColumn,
                                  int lastRow,
                                  int lastColumn,
                                  int validationType,
                                  int operatorType,
                                  System.String firstFormula,
                                  System.String secondFormula)
        Defines an instance of the validator having the specified position, validation type, operator and formula restrictions.
        Parameters:
        firstRow - the first row of the cell range where the validation will be applied
        firstColumn - the first column of the cell range where the validation will be applied
        lastRow - the last row of the cell range where the validation will be applied
        lastColumn - the last column of the cell range where the validation will be applied
        operatorType - the operator type. Possible values are available in DataValidator class.
        validationType - the validation type. Possible values are available in DataValidator class.
        firstFormula - the expression of the first formula
        secondFormula - the expression of the second formula