Collection class for objects which derive from [[ConditionBase]].

To enable a conditional format on a region of worksheet cells, add a [[ConditionBase]]-derived instance to this collection.

This collection exposes an Add method for each type of conditional format available.

For example, to add a conditional format which is based on a value and a logical operator, use the [[addOperatorCondition]] method.

The conditional formatting classes which derive from [[ConditionalFormatBase]] expose a CellFormat property, which in turn exposes properties which control the visual attributes of cells which meet the criteria defined by the condition. This format is applied to cells with a value which passes the condition.

See

  • [[ConditionBase]]
  • [[addAverageCondition]]
  • [[addBlanksCondition]]
  • [[addColorScaleCondition]]
  • [[addDataBarCondition]]
  • [[addDateTimeCondition]]
  • [[addDuplicateCondition]]
  • [[addErrorsCondition]]
  • [[addFormulaCondition]]
  • [[addIconSetCondition]]
  • [[addNoBlanksCondition]]
  • [[addNoErrorsCondition]]
  • [[addOperatorCondition]]
  • [[addRankCondition]]
  • [[addTextCondition]]
  • [[addUniqueCondition]]

Hierarchy

Hierarchy

  • Base
    • ConditionalFormatCollection

Implements

Constructors

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get count(): number
  • Returns the total number of items in the collection.

    Returns number

Methods

  • Returns EnumeratorWrapper<ConditionBase>

  • Adds a new [[AverageConditionalFormat]] instance to this collection.

    See

    [[AverageConditionalFormat]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional aboveBelow: FormatConditionAboveBelow

      A [[FormatConditionAboveBelow]] value which defines the initial value of the [[AverageConditionalFormat.aboveBelow]] property. This parameter is optional and defaults to AboveAverage.

    Returns AverageConditionalFormat

  • Adds a new [[BlanksConditionalFormat]] instance to this collection.

    See

    • [[BlanksConditionalFormat]]
    • [[addNoBlanksCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns BlanksConditionalFormat

  • Adds a new [[ColorScaleConditionalFormat]] instance to this collection.

    Note that when TwoColor is specified as the value of the 'colorScaleType' parameter, the [[ColorScaleConditionalFormat.midpointThreshold]] property is not applicable; attempting to set properties on the object returned from that property causes an exception to be thrown.

    The [[ColorScaleConditionalFormat.minimumThreshold]] and [[ColorScaleConditionalFormat.maximumThreshold]] properties can be used to customize the coloring and threshold boundaries for the minimum and maximum points of the associated range.

    For a 3-color scale, the [[ColorScaleConditionalFormat.midpointThreshold]] can also be used to customize the midpoint threshold boundary.

    See

    • [[ColorScaleConditionalFormat]]
    • [[ColorScaleCriterion]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • colorScaleType: ColorScaleType

      A [[ColorScaleType]] value which determines whether to add a 2-color or 3-color scale.

    Returns ColorScaleConditionalFormat

  • Adds a new [[DataBarConditionalFormat]] instance to this collection.

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns DataBarConditionalFormat

  • Adds a new [[DateTimeConditionalFormat]] instance to this collection.

    See

    [[DateTimeConditionalFormat]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional dateOperator: FormatConditionTimePeriod

      A [[FormatConditionTimePeriod]] which defines the time period against which cell date values are evaluated. This parameter is optional and defaults to Today.

    Returns DateTimeConditionalFormat

  • Adds a new [[DuplicateConditionalFormat]] instance to this collection, configured as a duplicate value condition.

    Use this method to add a condition which evaluates to true only for cell values which are non-unique across the associated range.

    See

    • [[DuplicateConditionalFormat]]
    • [[addUniqueCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns DuplicateConditionalFormat

  • Adds a new [[ErrorsConditionalFormat]] instance to this collection.

    See

    • [[ErrorsConditionalFormat]]
    • [[addNoErrorsCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns ErrorsConditionalFormat

  • Adds a new [[FormulaConditionalFormat]] instance to this collection.

    See

    • [[FormulaConditionalFormat]]
    • [[FormulaConditionalFormat.formula]]
    • [[FormulaConditionalFormat.setFormula]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • formula: string

      The formula which is used to determine whether a cell value meets the condition criteria.

    • Optional cellReferenceMode: CellReferenceMode

      A [[CellReferenceMode]] value which specifies whether the 'formula' parameter should be interpreted as an A1 or R1C1 expression. This parameter is optional and defaults to null, in which case the [[Workbook.cellReferenceMode]] property is used.

    Returns FormulaConditionalFormat

  • Adds a new [[IconSetConditionalFormat]] instance to this collection.

    Each constant in the [[FormatConditionIconSet]] enumeration contains either 3, 4, or 5 in its name. This number identifies the number of thresholds supported by the condition.

    A three-threshold condition supports thresholds of 33%, 67%, and 100%.

    A four-threshold condition supports thresholds of 25%, 50%, 75%, and 100%.

    A five-threshold condition supports thresholds of 20%, 40%, 60%, 80%, and 100%.

    A [[ColorScaleCriterion]] object for each threshold, is returned from the [[IconSetConditionalFormat.iconCriteria]] collection.

    These objects provide the ability to customize the values for the corresponding threshold. For example, the icon that is displayed for a given index can be overridden using the [[IconCriterion.icon]] property.

    See

    • [[IconSetConditionalFormat]]
    • [[IconSetConditionalFormat.iconCriteria]]
    • [[IconCriterion]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional iconSet: FormatConditionIconSet

      A [[FormatConditionIconSet]] value which identifies the icon set to use. This parameter is optional and defaults to IconSet3TrafficLights1.

    Returns IconSetConditionalFormat

  • Adds a new [[NoBlanksConditionalFormat]] instance to this collection.

    See

    • [[NoBlanksConditionalFormat]]
    • [[addBlanksCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns NoBlanksConditionalFormat

  • Adds a new [[NoErrorsConditionalFormat]] instance to this collection.

    See

    • [[ErrorsConditionalFormat]]
    • [[addErrorsCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns NoErrorsConditionalFormat

  • Adds a new [[OperatorConditionalFormat]] instance to this collection.

    See

    [[OperatorConditionalFormat]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional conditionOperator: FormatConditionOperator

      A [[FormatConditionOperator]] value which defines the initial value of the [[OperatorConditionalFormat.operator]] property. This parameter is optional and defaults to Equal.

    Returns OperatorConditionalFormat

  • Adds a new [[RankConditionalFormat]] instance to this collection.

    A RankConditionalFormat can be used, for example, to format the "top ten" values in a given cell range.

    To change the number of top or bottom values, use the [[RankConditionalFormat.rank]] property.

    See

    [[RankConditionalFormat]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional topBottom: FormatConditionTopBottom

      A [[FormatConditionTopBottom]] value which determines whether the top or bottom of the ranking is evaluated. This parameter is optional and defaults to Top.

    • Optional rank: number

      The numeric, percentage, or percentile ranking. This parameter is optional and defaults to 10.

    Returns RankConditionalFormat

  • Adds a new [[TextOperatorConditionalFormat]] instance to this collection.

    See

    [[TextOperatorConditionalFormat]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    • Optional text: string

      A string which determines the string against which cell text values are evaluated. This parameter is optional and defaults to null.

    • Optional textOperator: FormatConditionTextOperator

      A [[FormatConditionTextOperator]] value which determines the manner in which cell values are compared to the 'text' value. This parameter is optional and defaults to BeginsWith.

    Returns TextOperatorConditionalFormat

  • Adds a new [[UniqueConditionalFormat]] instance to this collection, configured as a unique value condition.

    Use this method to add a condition which evaluates to true only for cell values which are unique across the associated range.

    See

    • [[UniqueConditionalFormat]]
    • [[addDuplicateCondition]]

    Parameters

    • regionAddress: string

      A string identifying the region to which this conditional format applies.

    Returns UniqueConditionalFormat

  • Removes all items from the collection.

    Returns void

  • Returns true if the collection contains the condition

    Parameters

    Returns boolean

  • Parameters

    • other: any

    Returns boolean

  • Returns any

  • Returns any

  • Returns number

  • Gets the index of the item in the collection

    Parameters

    Returns number

  • Indexer

    Throws

    [[IndexOutOfRangeException]] If the index is negative or greater than or equal to [[count]]

    Parameters

    • a: number

    Returns ConditionBase

  • Returns Base

  • Removes an item from the collection

    Parameters

    Returns boolean

  • Removes an item from the collection at a specifoed index

    Parameters

    • index: number

      The zero based index in the collection

    Returns void

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns boolean

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns number

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Returns void