ConditionalValue Struct
Represents a conditional value used in conditional formatting rules which format all cells based on their values (ColorScaleCondition, DataBarCondition and IconSetCondition).
public struct ConditionalValue : IEquatable<ConditionalValue>Public Structure ConditionalValue
Implements IEquatable(Of ConditionalValue)Implements
Fields
Automatic
Gets the ConditionalValue instance whose ValueType is equal to Automatic.
public static readonly ConditionalValue AutomaticPublic Shared ReadOnly Automatic As ConditionalValueField Value
Highest
Gets the ConditionalValue instance whose ValueType is equal to Highest.
public static readonly ConditionalValue HighestPublic Shared ReadOnly Highest As ConditionalValueField Value
Lowest
Gets the ConditionalValue instance whose ValueType is equal to Lowest.
public static readonly ConditionalValue LowestPublic Shared ReadOnly Lowest As ConditionalValueField Value
None
Gets the ConditionalValue instance whose ValueType is equal to None.
Field Value
Properties
Value
Gets the value.
Property Value
- System.Object
The value.
Remarks
Value is
- equal to null if ValueType is equal to None, Automatic, Lowest or Highest.
- System.Double or System.String if ValueType is equal to Number, Percent or Percentile. The value is System.Double if it represents constant value and System.String if it represents formula.
- System.String if ValueType is equal to Formula.
ValueType
Gets the conditional value type.
public readonly ConditionalValueType ValueType { get; }Public ReadOnly Property ValueType As ConditionalValueTypeProperty Value
The conditional value type.
Methods
Equals(ConditionalValue)
Determines whether the other ConditionalValue is equal to this ConditionalValue instance.
public bool Equals(ConditionalValue other)Public Function Equals(other As ConditionalValue) As BooleanParameters
other- ConditionalValue
The other ConditionalValue to compare with this ConditionalValue instance.
Returns
- System.Boolean
true if the other ConditionalValue is equal to this ConditionalValue instance; otherwise, false.
Equals(Object)
Determines whether the specified System.Object is equal to this ConditionalValue instance.
public override bool Equals(object obj)Public Overrides Function Equals(obj As Object) As BooleanParameters
obj- System.Object
The System.Object to compare with this ConditionalValue instance.
Returns
- System.Boolean
true if the specified System.Object is a ConditionalValue and is equal to this ConditionalValue instance; otherwise, false.
Overrides
FromFormula(String)
Creates a new instance of the ConditionalValue from the specified formula.
public static ConditionalValue FromFormula(string formula)Public Shared Function FromFormula(formula As String) As ConditionalValueParameters
formula- System.String
The formula value.
Returns
A new instance of the ConditionalValue whose ValueType is equal to Formula and Value is equal to formula parameter.
Exceptions
- System.ArgumentException
Formula value is null or System.String.Empty.
FromNumber(Double)
Creates a new instance of the ConditionalValue from the specified number.
public static ConditionalValue FromNumber(double number)Public Shared Function FromNumber(number As Double) As ConditionalValueParameters
number- System.Double
The number value.
Returns
A new instance of the ConditionalValue whose ValueType is equal to Number and Value is equal to number parameter.
FromPercent(Double)
Creates a new instance of the ConditionalValue from the specified percent.
public static ConditionalValue FromPercent(double percent)Public Shared Function FromPercent(percent As Double) As ConditionalValueParameters
percent- System.Double
The percent value.
Returns
A new instance of the ConditionalValue whose ValueType is equal to Percent and Value is equal to percent parameter.
Exceptions
- System.ArgumentOutOfRangeException
Percent value is less than 0 or greater than 100.
FromPercentile(Double)
Creates a new instance of the ConditionalValue from the specified percentile.
public static ConditionalValue FromPercentile(double percentile)Public Shared Function FromPercentile(percentile As Double) As ConditionalValueParameters
percentile- System.Double
The percentile value.
Returns
A new instance of the ConditionalValue whose ValueType is equal to Percentile and Value is equal to percentile parameter.
Exceptions
- System.ArgumentOutOfRangeException
Percentile value is less than 0 or greater than 100.
GetHashCode()
Returns a hash code for this ConditionalValue instance.
Returns
- System.Int32
An integer value that specifies a hash value for this ConditionalValue instance.
Overrides
ToString()
Returns a System.String that represents this ConditionalValue instance.
Returns
- System.String
A System.String that represents this ConditionalValue instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).
Operators
Equality(ConditionalValue, ConditionalValue)
Determines whether first and second ConditionalValues are equal.
public static bool operator ==(ConditionalValue first, ConditionalValue second)Public Shared Operator =(first As ConditionalValue, second As ConditionalValue) As BooleanParameters
first- ConditionalValue
The first ConditionalValue.
second- ConditionalValue
The second ConditionalValue.
Returns
- System.Boolean
true if first and second ConditionalValues are equal; otherwise, false.
Inequality(ConditionalValue, ConditionalValue)
Determines whether first and second ConditionalValues are not equal.
public static bool operator !=(ConditionalValue first, ConditionalValue second)Public Shared Operator <>(first As ConditionalValue, second As ConditionalValue) As BooleanParameters
first- ConditionalValue
The first ConditionalValue.
second- ConditionalValue
The second ConditionalValue.
Returns
- System.Boolean
true if first and second ConditionalValues are not equal; otherwise, false.