Namespace EasyXLS

Class ExcelDataValidator

System.Object
EasyXLS.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
    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.
    This method is overridden as ApplyToRange_2 in COM+ version of EasyXLS.
    Creates and returns a copy of this object.
    int
    Returns the "Error Alert" box style.
    System.String
    Returns the message of the "Error Alert"
    System.String
    Returns the title of the "Error Alert"
    int
    Returns the first column of the cell range where the validation will be applied.
    System.String
    Returns the expression of the first formula.
    int
    Returns the first row of the cell range where the validation will be applied.
    System.String
    Returns the message of the "Input Message"
    System.String
    Returns the title of the "Input Message"
    int
    Returns the last column of the cell range where the validation will be applied.
    int
    Returns the last row of the cell range where the validation will be applied.
    int
    Returns the operator type.
    System.String
    Returns the range where the validation will be aplied.
    System.String
    Returns the expression of the second formula.
    int
    Returns the validation type.
    bool
    Returns the ignore blank option.
    bool
    Returns the show "Error Alert" box option.
    bool
    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.

    Methods inherited from class System.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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
  • Method Details

    • getValidationType

      public int getValidationType()
      Returns the validation type. Possible values are available in DataValidator class.
      Returns:
      the validation type
      See Also:
      setValidationType(int)
    • setValidationType

      public void setValidationType(int validationType)
      Sets the validation type. Possible values are available in DataValidator class.
      Parameters:
      validationType - the validation type
      See Also:
      getValidationType()
    • getErrorStyle

      public int getErrorStyle()
      Returns the "Error Alert" box style. Possible values are available in DataValidator class.
      Returns:
      the error style
      See Also:
      setErrorStyle(int)
    • setErrorStyle

      public void setErrorStyle(int errorStyle)
      Sets the "Error Alert" box style. Possible values are available in DataValidator class.
      Parameters:
      errorStyle - the style of the "Error Alert" box
      See Also:
      getErrorStyle()
    • IgnoreBlank

      public bool IgnoreBlank()
      Returns the ignore blank option.
      Returns:
      true if ignore blank flag is set, false otherwise
      See Also:
      setIgnoreBlank(bool)
    • setIgnoreBlank

      public void setIgnoreBlank(bool ignoreBlank)
      Sets the ignore blank option.
      Parameters:
      ignoreBlank - the ignore blank option
      See Also:
      IgnoreBlank()
    • IsShowInputBox

      public bool IsShowInputBox()
      Returns the show "Input Message" box option.
      Returns:
      true if show "Input Message" checkbox is checked, false otherwise
      See Also:
      setIsShowInputBox(bool)
    • setIsShowInputBox

      public void setIsShowInputBox(bool showInputBox)
      Sets the show "Input Message" box option.
      Parameters:
      showInputBox - the ishow "Input Message" box option
      See Also:
      IsShowInputBox()
    • IsShowErrorBox

      public bool IsShowErrorBox()
      Returns the show "Error Alert" box option.
      Returns:
      true if show "Error Alert" checkbox is checked, false otherwise
      See Also:
      setIsShowErrorBox(bool)
    • setIsShowErrorBox

      public void setIsShowErrorBox(bool showErrorBox)
      Sets the show "Error Alert" box option.
      Parameters:
      showErrorBox - the ishow "Error Alert" box option
      See Also:
      IsShowErrorBox()
    • getOperatorType

      public int getOperatorType()
      Returns the operator type. Possible values are available in DataValidator class.
      Returns:
      the operator type
      See Also:
      setOperatorType(int)
    • setOperatorType

      public void setOperatorType(int operatorType)
      Sets the operator type. Possible values are available in DataValidator class.
      Parameters:
      operatorType - the operator type
      See Also:
      getOperatorType()
    • getRange

      public System.String getRange()
      Returns the range where the validation will be aplied.
      Returns:
      the range where the validation will be aplied
      See Also:
      getFirstRow(), getLastRow(), getFirstColumn(), getLastColumn()
    • getFirstRow

      public int getFirstRow()
      Returns the first row of the cell range where the validation will be applied.
      Returns:
      the first row of the cell range where the validation will be applied
      See Also:
      setFirstRow(int), getLastRow(), getFirstColumn(), getLastColumn(), ApplyToRange(int, int, int, int)
    • setFirstRow

      public void setFirstRow(int firstRow)
      Sets the first row of the cell range where the validation will be applied.
      Parameters:
      firstRow - the first row of the cell range where the validation will be applied
      See Also:
      getFirstRow(), setLastRow(int), setFirstColumn(int), setLastColumn(int), ApplyToRange(int, int, int, int)
    • getLastRow

      public int getLastRow()
      Returns the last row of the cell range where the validation will be applied.
      Returns:
      the last row of the cell range where the validation will be applied
      See Also:
      setLastRow(int), getFirstRow(), getFirstColumn(), getLastColumn(), ApplyToRange(int, int, int, int)
    • setLastRow

      public void setLastRow(int lastRow)
      Sets the last row of the cell range where the validation will be applied.
      Parameters:
      lastRow - the last row of the cell range where the validation will be applied
      See Also:
      getLastRow(), setFirstRow(int), setFirstColumn(int), setLastColumn(int), ApplyToRange(int, int, int, int)
    • getFirstColumn

      public int getFirstColumn()
      Returns the first column of the cell range where the validation will be applied.
      Returns:
      the first column of the cell range where the validation will be applied
      See Also:
      setFirstColumn(int), getFirstRow(), getLastRow(), getLastColumn(), ApplyToRange(int, int, int, int)
    • setFirstColumn

      public void setFirstColumn(int firstColumn)
      Sets the first column of the cell range where the validation will be applied.
      Parameters:
      firstColumn - the first column of the cell range where the validation will be applied
      See Also:
      getFirstColumn(), setFirstRow(int), setLastRow(int), setLastColumn(int), ApplyToRange(int, int, int, int)
    • getLastColumn

      public int getLastColumn()
      Returns the last column of the cell range where the validation will be applied.
      Returns:
      the last column of the cell range where the validation will be applied
      See Also:
      setLastColumn(int), getFirstRow(), getLastRow(), getFirstColumn(), ApplyToRange(int, int, int, int)
    • setLastColumn

      public void setLastColumn(int lastColumn)
      Sets the last column of the cell range where the validation will be applied.
      Parameters:
      lastColumn - the last column of the cell range where the validation will be applied
      See Also:
      getLastColumn(), setFirstRow(int), setLastRow(int), setFirstColumn(int), ApplyToRange(int, int, int, int)
    • ApplyToRange

      public void ApplyToRange(int firstRow, int firstColumn, int lastRow, int lastColumn)
      Sets the cell range where the validation will be applied.
      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
      See Also:
      ApplyToRange(String), getFirstRow(), getLastRow(), getFirstColumn(), getLastColumn()
    • ApplyToRange

      public void ApplyToRange(System.String range)
      Sets the cell range where the validation will be applied.
      This method is overridden as ApplyToRange_2 in COM+ version of EasyXLS.
      Parameters:
      range - cell range where the validation will be applied. It can be a cell reference or a range.
      See Also:
      ApplyToRange(int,int,int,int), getFirstRow(), getLastRow(), getFirstColumn(), getLastColumn()
    • getFirstFormula

      public System.String getFirstFormula()
      Returns the expression of the first formula.
      Returns:
      the expression of the first formula
      See Also:
      setFirstFormula(System.String), getSecondFormula(), setSecondFormula(System.String)
    • setFirstFormula

      public void setFirstFormula(System.String formula)
      Sets the expression of the first formula.
      Parameters:
      formula - the expression of the first formula
      See Also:
      getFirstFormula(), getSecondFormula(), setSecondFormula(System.String)
    • getSecondFormula

      public System.String getSecondFormula()
      Returns the expression of the second formula.
      Returns:
      the expression of the second formula
      See Also:
      setSecondFormula(System.String), setFirstFormula(System.String), getSecondFormula()
    • setSecondFormula

      public void setSecondFormula(System.String formula)
      Sets the expression of the second formula.
      Parameters:
      formula - the expression of the second formula
      See Also:
      getSecondFormula(), getFirstFormula(), setSecondFormula(System.String)
    • setInputTitle

      public void setInputTitle(System.String inputTitle)
      Sets the title of the "Input Message"
      Parameters:
      inputTitle - the title of the "Input Message"
      See Also:
      getInputTitle()
    • getInputTitle

      public System.String getInputTitle()
      Returns the title of the "Input Message"
      Returns:
      the title of the "Input Message"
      See Also:
      setInputTitle(System.String)
    • setErrorTitle

      public void setErrorTitle(System.String errorTitle)
      Sets the title of the "Error Alert"
      Parameters:
      errorTitle - the title of the "Error Alert"
      See Also:
      getErrorTitle()
    • getErrorTitle

      public System.String getErrorTitle()
      Returns the title of the "Error Alert"
      Returns:
      the title of the "Error Alert"
      See Also:
      setErrorTitle(System.String)
    • setInputText

      public void setInputText(System.String inputText)
      Sets the message of the "Input Message"
      Parameters:
      inputText - the message of the "Input Message"
      See Also:
      getInputText()
    • getInputText

      public System.String getInputText()
      Returns the message of the "Input Message"
      Returns:
      the message of the "Input Message"
      See Also:
      setInputText(System.String)
    • setErrorText

      public void setErrorText(System.String textError)
      Sets the message of the "Error Alert"
      Parameters:
      textError - the message of the "Error Alert"
      See Also:
      getErrorText()
    • getErrorText

      public System.String getErrorText()
      Returns the message of the "Error Alert"
      Returns:
      the message of the "Error Alert"
      See Also:
      setErrorText(System.String)
    • setInputMessage

      public void setInputMessage(System.String title, System.String text)
      Sets the title and the message of the "Input Message"
      Parameters:
      title - the title of the "Input Message"
      text - the message of the "Error Alert"
      See Also:
      setInputTitle(System.String), setInputText(System.String)
    • setErrorAlert

      public void setErrorAlert(System.String title, System.String text)
      Sets the title and the message of the "Error Alert"
      Parameters:
      title - the message of the "Error Alert"
      text - the message of the "Error Alert"
      See Also:
      setErrorTitle(System.String), setErrorText(System.String)
    • Clone

      public ExcelDataValidator Clone()
      Creates and returns a copy of this object.
      Returns:
      a clone of this instance.