共用方式為


XmlMappedRange.FormatConditions Property

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

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

Syntax

'Declaration
ReadOnly Property FormatConditions As FormatConditions
FormatConditions FormatConditions { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.FormatConditions
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 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"].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;
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace