Partager via


XmlMappedRange.FormatConditions, propriété

Obtient une collection FormatConditions qui représente tous les formats conditionnels du contrôle XmlMappedRange.

Espace de noms :  Microsoft.Office.Tools.Excel
Assembly :  Microsoft.Office.Tools.Excel (dans Microsoft.Office.Tools.Excel.dll)

Syntaxe

'Déclaration
ReadOnly Property FormatConditions As FormatConditions
FormatConditions FormatConditions { get; }

Valeur de propriété

Type : Microsoft.Office.Interop.Excel.FormatConditions
Collection FormatConditions qui représente tous les formats conditionnels du contrôle XmlMappedRange.

Exemples

L'exemple de code suivant utilise la propriété FormatConditions pour modifier la police de XmlMappedRange si la valeur de XmlMappedRange est inférieure à celle de la cellule A1.Cet exemple de code suppose que la feuille de calcul active contient un contrôle XmlMappedRange nommé 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;
}

Sécurité .NET Framework

Voir aussi

Référence

XmlMappedRange Interface

Microsoft.Office.Tools.Excel, espace de noms