XmlMappedRange.FormatConditions Property (2007 System)

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

[BrowsableAttribute(false)]
public FormatConditions FormatConditions { get; }

Property Value

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

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", 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;
}

Community Additions

ADD
Show: