NamedRange.FormatConditions Property (2007 System)
Gets a FormatConditions collection that represents all the conditional formats for the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property FormatConditions As FormatConditions
'Usage
Dim instance As NamedRange
Dim value As FormatConditions
value = instance.FormatConditions
[BrowsableAttribute(false)]
public FormatConditions FormatConditions { get; }
[BrowsableAttribute(false)]
public:
property FormatConditions^ FormatConditions {
FormatConditions^ get ();
}
public function get FormatConditions () : FormatConditions
Property Value
Type: FormatConditions
A FormatConditions collection that represents all the conditional formats for the NamedRange control.
Examples
The following code example creates a NamedRange and then uses the FormatConditions property to alter the font in the NamedRange if the value in the NamedRange is less than the value of cell A1.
This example is for a document-level customization.
Private formatConditionsRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub ModifyFormatConditions()
formatConditionsRange = Me.Controls.AddNamedRange( _
Me.Range("B1"), "formatConditionsRange")
Me.Range("A1").Value2 = 99000
Me.formatConditionsRange.Value2 = 98052
' Set conditional formatting to alter the font if
' the formatConditionsRange value is less than the value in A1.
Dim condition1 As Excel.FormatCondition = _
Me.formatConditionsRange.FormatConditions.Add( _
Excel.XlFormatConditionType.xlCellValue, _
Excel.XlFormatConditionOperator.xlLess, "=$a$1", )
condition1.Font.Bold = True
condition1.Font.Color = &HFF00
End Sub
Microsoft.Office.Tools.Excel.NamedRange formatConditionsRange;
private void ModifyFormatConditions()
{
formatConditionsRange = this.Controls.AddNamedRange(
this.Range["B1", missing], "formatConditionsRange");
this.Range["A1", missing].Value2 = 99000;
this.formatConditionsRange.Value2 = 98052;
// Set conditional formatting to alter the font if
// the formatConditionsRange value is less than the value in A1.
Excel.FormatCondition condition1 =
(Excel.FormatCondition)this.formatConditionsRange.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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.