Represents a conditional format.
public interface class FormatCondition
[System.Runtime.InteropServices.Guid("00024425-0000-0000-C000-000000000046")] [System.Runtime.InteropServices.InterfaceType(2)] public interface FormatCondition
Public Interface FormatCondition
The FormatCondition object is a member of the FormatConditions collection. The FormatConditions collection can contain up to three conditional formats for a given range.
index), where index is the index number of the conditional format, to return a FormatCondition object.
Use the Microsoft.Office.Interop.Excel.FormatConditions.Add(Microsoft.Office.Interop.Excel.XlFormatConditionType,System.Object,System.Object,System.Object) method to create a new conditional format. If you try to create more than three conditional formats for a single range, the Add method fails. If a range has three formats, you can use the Modify(XlFormatConditionType, Object, Object, Object) method to change one of the formats, or you can use the Delete() method to delete a format and then use the Add method to create a new format.
Use the Font, Borders, and Interior properties of the FormatCondition object to control the appearance of formatted cells. Some properties of these objects aren’t supported by the conditional format object model. The properties that can be used with conditional formatting are listed in the following table.
|Font||Bold Color ColorIndex FontStyle Italic Strikethrough UnderlineThe accounting underline styles cannot be used.|
|Border||Bottom Color Left Right StyleThe following border styles can be used (all others aren’t supported): xlNone, xlSolid, xlDash, xlDot, xlDashDot, xlDashDotDot, xlGray50, xlGray75, and xlGray25.TopWeightThe following border weights can be used (all others aren’t supported): xlWeightHairline and xlWeightThin.|
|Interior||Color ColorIndex Pattern PatternColorIndex|
Returns an Application object that represents the Microsoft Excel application.
Returns a Range object specifying the cell range to which the formatting rule is applied.
Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).
Returns a 32-bit integer that indicates the application in which this object was created.
Specifies the XlTimePeriods Date operator used in the format condition. Read/write.
Returns a Font object that represents the font of the specified object.
Returns the value or expression associated with the conditional format or data validation.
Returns the value or expression associated with the second part of a conditional format or data validation.
Returns an Interior object that represents the interior of the specified object.
Returns or sets the number format applied to a cell if the conditional formatting rule evaluates to True. Read/write Object.
Returns the operator for the conditional format.
Returns the parent object for the specified object.
Returns or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
Returns a Boolean value indicating if the conditional format is being applied to a PivotTable chart. Read-only.
Returns or sets one of the constants of the XlPivotConditionScope enumeration, which determines the scope of the conditional format when it is applied to a PivotTable chart.
Returns or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to True.
Returns or sets a String value specifying the text used by the conditional formatting rule.
Returns or sets one of the constants of the XlContainsOperator enumeration, specifying the text search performed by the conditional formatting rule.
Returns the object type.
Deletes the object.
|Modify(XlFormatConditionType, Object, Object, Object)||
Modifies an existing conditional format.
Sets the cell range to which this formatting rule applies.
|ModifyEx(XlFormatConditionType, Object, Object, Object, Object, Object)|
Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet.
Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.