Compartilhar via


XmlMappedRange.FormatConditions Property

Definition

Gets a FormatConditions collection that represents all the conditional formats for the XmlMappedRange control.

public:
 property Microsoft::Office::Interop::Excel::FormatConditions ^ FormatConditions { Microsoft::Office::Interop::Excel::FormatConditions ^ get(); };
public Microsoft.Office.Interop.Excel.FormatConditions FormatConditions { get; }
member this.FormatConditions : Microsoft.Office.Interop.Excel.FormatConditions
Public ReadOnly Property FormatConditions As FormatConditions

Property Value

A FormatConditions collection that represents all the conditional formats for the XmlMappedRange control.

Examples

The following code example uses the FormatConditions property to alter the font of an XmlMappedRange if the value of the XmlMappedRange is less than the value of cell A1. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerZipCell.

private void ModifyFormatConditions()
{
    this.Range["A1"].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");

    condition1.Font.Bold = true;
    condition1.Font.Color = 0xFF00;
}
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

Applies to