Represents a data validation rule which allows any formula to be used to validate the value applied to a cell.

See

  • [[Worksheet.dataValidationRules]]
  • [[DataValidationRuleCollection.add]]
  • [[DataValidationRuleCollection.add]]

Hierarchy

Hierarchy (view full)

Constructors

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get allowNull(): boolean
  • Gets or sets the value which indicates whether a null, or blank, value is allowed to be set on a cell. True if a null value can be set on the cell; False otherwise.

    Returns boolean

  • set allowNull(a): void
  • Parameters

    • a: boolean

    Returns void

  • get errorMessageDescription(): string
  • Gets or sets the description which appears in the dialog box when an invalid value is applied to a cell in Microsoft Excel.

    This value is only used when [[showErrorMessageForInvalidValue]] is True.

    Note: the title cannot be more than 225 characters.

    The description to show the user or null to use a default error description.

    Throws

    [[ArgumentException]] Occurs when the specified value is longer than 225 characters.

    See

    [[errorMessageTitle]]

    Returns string

  • set errorMessageDescription(a): void
  • Parameters

    • a: string

    Returns void

  • get errorMessageTitle(): string
  • Gets or sets the title which appears in the dialog box when an invalid value is applied to a cell in Microsoft Excel.

    This value is only used when [[showErrorMessageForInvalidValue]] is True.

    Note: the title cannot be more than 32 characters.

    The title to show the user or null to use a default error dialog title.

    Throws

    [[ArgumentException]] Occurs when the specified value is longer than 32 characters.

    See

    [[errorMessageDescription]]

    Returns string

  • set errorMessageTitle(a): void
  • Parameters

    • a: string

    Returns void

  • get errorStyle(): DataValidationErrorStyle
  • Gets or sets the value which indicates whether the value is allowed when it is invalid and which options are given to the user in the error dialog shown by Microsoft Excel.

    This value is only used when [[showErrorMessageForInvalidValue]] is True.

    Throws

    [[InvalidEnumArgumentException]] Occurs when the value is not a member of the [[DataValidationErrorStyle]] enumeration.

    See

    [[showErrorMessageForInvalidValue]]

    Returns DataValidationErrorStyle

  • set errorStyle(a): void
  • Parameters

    Returns void

  • get imeMode(): DataValidationImeMode
  • Gets or sets the description of the Japanese input rules.

    Throws

    [[InvalidEnumArgumentException]] Occurs when the value is not a member of the [[DataValidationImeMode]] enumeration.

    Returns DataValidationImeMode

  • set imeMode(a): void
  • Parameters

    Returns void

  • get inputMessageDescription(): string
  • Gets or sets the description in the tooltip which appears when the user selects the cell in Microsoft Excel.

    This value is only used when [[showInputMessage]] is True.

    Note: the description cannot be more than 255 characters.

    The description to show the user in the tooltip.

    Throws

    [[ArgumentException]] Occurs when the specified value is longer than 255 characters.

    See

    [[inputMessageTitle]]

    Returns string

  • set inputMessageDescription(a): void
  • Parameters

    • a: string

    Returns void

  • get inputMessageTitle(): string
  • Gets or sets the title in the tooltip which appears when the user selects the cell in Microsoft Excel.

    This value is only used when [[showInputMessage]] is True.

    Note: the title cannot be more than 32 characters.

    The title to show the user in the tooltip.

    Throws

    [[ArgumentException]] Occurs when the specified value is longer than 32 characters.

    See

    [[inputMessageDescription]]

    Returns string

  • set inputMessageTitle(a): void
  • Parameters

    • a: string

    Returns void

  • get showErrorMessageForInvalidValue(): boolean
  • Gets or sets the value which indicates whether the error dialog should appear in Microsoft Excel when invalid data is entered in the cell.

    When the value is False, invalid data can be entered into cells, but when the user chooses to subsequently circle invalid values in Microsoft Excel, the cell will be circled.

    True to show the error dialog for invalid cell data; False otherwise.

    See

    • [[errorMessageDescription]]
    • [[errorMessageTitle]]
    • [[errorStyle]]

    Returns boolean

  • set showErrorMessageForInvalidValue(a): void
  • Parameters

    • a: boolean

    Returns void

  • get showInputMessage(): boolean
  • Gets or sets the value which indicates whether to show the user an input prompt tooltip when the user selects the cell in Microsoft Excel.

    The input prompt will only be shown if this value is True and the [[inputMessageDescription]] is not null.

    See

    • [[inputMessageDescription]]
    • [[inputMessageTitle]]

    Returns boolean

  • set showInputMessage(a): void
  • Parameters

    • a: boolean

    Returns void

Methods

  • Gets the formula used to validate the value applied to a cell.

    The formula will indicate the value is invalid by evaluating to False, 0, any [[ErrorValue]] (such as #VALUE!), or any string other than "True" (case-insensitive). True, "True" (case-insensitive), null, and non-zero numeric values will indicate a valid value has been applied.

    The address passed in is only needed if relative addresses are used in the the formula. For example, consider the formula applied is =B1, and the data validation rule is applied to the region A1:A5. If you get the formula for A1, the formula =B1 will be returned. If you get the formula for A2, =B2 will be returned. Similarly, for cell A5, =B5 will be returned. However, if the formula contains no references or all absolute references, the 'address' is ignored. So in the previous example, if the original formula was =$B$1, the same formula will be returned regardless of the specified address.

    'address' can be any valid cell or region reference on a worksheet. If a region address is specified, the top-left cell or the region is used. The cell or region specified does not need to have the data validation rule applied to it. Any reference is allowed.

    The cell reference mode with which to parse 'address' will be assumed to be A1, unless the data validation rule is applied to a worksheet which is in a workbook, in which case the [[Workbook.cellReferenceMode]] will be used.

    Throws

    [[ArgumentException]] Occurs when 'address' is not a valid cell or regions address.

    See

    • [[getFormula]]
    • [[setFormula]]
    • [[setFormula]]

    Parameters

    • address: string

      The address of the cell or region that serves as the basis for relative references, or null to use the top-left cell of the worksheet.

    Returns string

  • Gets the formula used to validate the value applied to a cell.

    The formula will indicate the value is invalid by evaluating to False, 0, any [[ErrorValue]] (such as #VALUE!), or any string other than "True" (case-insensitive). True, "True" (case-insensitive), null, and non-zero numeric values will indicate a valid value has been applied.

    The address passed in is only needed if relative addresses are used in the the formula. For example, consider the formula applied is =B1, and the data validation rule is applied to the region A1:A5. If you get the formula for A1, the formula =B1 will be returned. If you get the formula for A2, =B2 will be returned. Similarly, for cell A5, =B5 will be returned. However, if the formula contains no references or all absolute references, the 'address' is ignored. So in the previous example, if the original formula was =$B$1, the same formula will be returned regardless of the specified address.

    'address' can be any valid cell or region reference on a worksheet. If a region address is specified, the top-left cell or the region is used. The cell or region specified does not need to have the data validation rule applied to it. Any reference is allowed.

    Throws

    [[ArgumentException]] Occurs when 'address' is not a valid cell or regions address.

    Throws

    [[InvalidEnumArgumentException]] Occurs when 'format' is not defined in the [[WorkbookFormat]] enumeration.

    Throws

    [[InvalidEnumArgumentException]] Occurs when 'cellReferenceMode' is not defined in the [[CellReferenceMode]] enumeration.

    See

    • [[getFormula]]
    • [[setFormula]]
    • [[setFormula]]

    Parameters

    • address: string

      The address of the cell or region that serves as the basis for relative references, or null to use the top-left cell of the worksheet.

    • format: WorkbookFormat

      The workbook format with which to parse 'address'.

    • cellReferenceMode: CellReferenceMode

      The cell reference mode with which to parse 'address'.

    • culture: string | CultureInfo

      The culture to use when generating the formula string.

    Returns string

  • Indicates if this rule is structurally equivalent to another.

    Parameters

    Returns boolean

  • Sets the formula used to validate the value applied to a cell.

    The formula will indicate the value is invalid by evaluating to False, 0, any [[ErrorValue]] (such as #VALUE!), or any string other than "True" (case-insensitive). True, "True" (case-insensitive), null, and non-zero numeric values will indicate a valid value has been applied.

    The address passed in is only needed if relative addresses are used in the the formula. When the data validation rule is applied to cells or regions, the references in the formula used by each individual cell will be shifted by the offset of the cell to the passed in 'address'. For example, consider the formula specified is =B1 and the specified address is A1. If the data validation rule is then applied to the A5 cell, the formula is will use is =B5. However, if the references in the formula are absolute, such as =$B$1, the same formula will be applied regardless of the specified address.

    'address' can be any valid cell or region reference on a worksheet. If a region address is specified, the top-left cell or the region is used. The cell or region specified does not need to have the data validation rule applied to it. Any reference is allowed.

    The cell reference mode with which to parse 'address' will be assumed to be A1, unless the data validation rule is applied to a worksheet which is in a workbook, in which case the [[Workbook.cellReferenceMode]] will be used.

    Throws

    [[ArgumentNullException]] Occurs when 'formula' is null and the rule is currently applied to a [[Worksheet]].

    Throws

    [[FormulaParseException]] Occurs when 'formula' is not a valid formula.

    Throws

    [[ArgumentException]] Occurs when 'address' is not a valid cell or regions address.

    See

    • [[getFormula]]
    • [[getFormula]]
    • [[setFormula]]

    Parameters

    • formula: string

      The validation formula to use for the rule.

    • address: string

      The address of the cell or region that serves as the basis for relative references, or null to use the top-left cell of the worksheet.

    Returns void

  • Sets the formula used to validate the value applied to a cell.

    The formula will indicate the value is invalid by evaluating to False, 0, any [[ErrorValue]] (such as #VALUE!), or any string other than "True" (case-insensitive). True, "True" (case-insensitive), null, and non-zero numeric values will indicate a valid value has been applied.

    The address passed in is only needed if relative addresses are used in the the formula. When the data validation rule is applied to cells or regions, the references in the formula used by each individual cell will be shifted by the offset of the cell to the passed in 'address'. For example, consider the formula specified is =B1 and the specified address is A1. If the data validation rule is then applied to the A5 cell, the formula is will use is =B5. However, if the references in the formula are absolute, such as =$B$1, the same formula will be applied regardless of the specified address.

    'address' can be any valid cell or region reference on a worksheet. If a region address is specified, the top-left cell or the region is used. The cell or region specified does not need to have the data validation rule applied to it. Any reference is allowed.

    Throws

    [[ArgumentNullException]] Occurs when 'formula' is null and the rule is currently applied to a [[Worksheet]].

    Throws

    [[FormulaParseException]] Occurs when 'formula' is not a valid formula.

    Throws

    [[ArgumentException]] Occurs when 'address' is not a valid cell or regions address.

    Throws

    [[InvalidEnumArgumentException]] Occurs when 'format' is not defined in the [[WorkbookFormat]] enumeration.

    Throws

    [[InvalidEnumArgumentException]] Occurs when 'cellReferenceMode' is not defined in the [[CellReferenceMode]] enumeration.

    See

    • [[getFormula]]
    • [[getFormula]]
    • [[setFormula]]

    Parameters

    • formula: string

      The validation formula to use for the rule.

    • address: string

      The address of the cell or region that serves as the basis for relative references, or null to use the top-left cell of the worksheet.

    • format: WorkbookFormat

      The workbook format with which to parse 'address'.

    • cellReferenceMode: CellReferenceMode

      The cell reference mode with which to parse 'address'.

    • culture: string | CultureInfo

      The culture to use when parsing the formula string.

    Returns void

  • Parameters

    • item1: any
    • item2: any

    Returns number