获取一个 FormatConditions 集合,该集合表示 XmlMappedRange 控件的所有条件格式。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
ReadOnly Property FormatConditions As FormatConditions
    Get
FormatConditions FormatConditions { get; }
属性值
类型:Microsoft.Office.Interop.Excel.FormatConditions
一个 FormatConditions 集合,表示 XmlMappedRange 控件的所有条件格式。
示例
下面的代码示例使用 FormatConditions 属性在 XmlMappedRange 的值小于单元格 A1 的值时改变 XmlMappedRange 的字体。 此代码示例假定当前工作表包含一个名为 CustomerZipCell 的 XmlMappedRange。
Private Sub ModifyFormatConditions()
    Me.Range("A1").Value2 = 99000
    Me.CustomerZipCell.Value2 = 98052
    ' Set conditional formatting to alter the font and interior pattern if 
    ' the CustomerZipCell value is less than the value in A1.
    Dim condition1 As Excel.FormatCondition = _
        Me.CustomerZipCell.FormatConditions.Add( _
            Excel.XlFormatConditionType.xlCellValue, _
            Excel.XlFormatConditionOperator.xlLess, "=$a$1")
    condition1.Font.Bold = True
    condition1.Font.Color = &HFF00
End Sub
private void ModifyFormatConditions()
{
    this.Range["A1", missing].Value2 = 99000;
    this.CustomerZipCell.Value2 = 98052;
    // Set conditional formatting to alter the font and interior pattern if 
    // the CustomerZipCell value is less than the value in A1.
    Excel.FormatCondition condition1 = 
        (Excel.FormatCondition)this.CustomerZipCell.FormatConditions.Add(
        Excel.XlFormatConditionType.xlCellValue,
        Excel.XlFormatConditionOperator.xlLess, "=$a$1", missing, missing, missing, missing, missing);
    condition1.Font.Bold = true;
    condition1.Font.Color = 0xFF00;
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。