FormatCondition Class |
Namespace: Aspose.Cells
The FormatCondition type exposes the following members.
Name | Description | |
---|---|---|
![]() | AboveAverage |
Get the conditional formatting's "AboveAverage" instance.
The default instance's rule highlights cells that are
above the average for all values in the range.
Valid only for type = AboveAverage.
|
![]() | ColorScale |
Get the conditional formatting's "ColorScale" instance.
The default instance is a "green-yellow-red" 3ColorScale .
Valid only for type = ColorScale.
|
![]() | DataBar |
Get the conditional formatting's "DataBar" instance.
The default instance's color is blue.
Valid only for type is DataBar.
|
![]() | Formula1 |
Gets and sets the value or expression associated with conditional formatting.
|
![]() | Formula2 |
Gets and sets the value or expression associated with conditional formatting.
|
![]() | IconSet |
Get the conditional formatting's "IconSet" instance.
The default instance's IconSetType is TrafficLights31.
Valid only for type = IconSet.
|
![]() | Operator |
Gets and sets the conditional format operator type.
|
![]() | Priority |
The priority of this conditional formatting rule. This value is used to determine which
format should be evaluated and rendered. Lower numeric values are higher priority than
higher numeric values, where '1' is the highest priority.
|
![]() | StopIfTrue |
True, no rules with lower priority may be applied over this rule, when this rule evaluates to true.
Only applies for Excel 2007;
|
![]() | Style |
Gets or setts style of conditional formatted cell ranges.
|
![]() | Text |
The text value in a "text contains" conditional formatting rule.
Valid only for type = containsText, notContainsText, beginsWith and endsWith.
The default value is null.
|
![]() | TimePeriod |
The applicable time period in a "date occurring¡" conditional formatting rule.
Valid only for type = timePeriod.
The default value is TimePeriodType.Today.
|
![]() | Top10 |
Get the conditional formatting's "Top10" instance.
The default instance's rule highlights cells whose
values fall in the top 10 bracket.
Valid only for type is Top10.
|
![]() | Type |
Gets and sets whether the conditional format Type.
|
Name | Description | |
---|---|---|
![]() | Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetFormula1(Boolean, Boolean) |
Gets the value or expression associated with this format condition.
|
![]() | GetFormula1(Int32, Int32) |
Gets the formula of the conditional formatting of the cell.
|
![]() | GetFormula1(Boolean, Boolean, Int32, Int32) |
Gets the value or expression of the conditional formatting of the cell.
|
![]() | GetFormula2(Boolean, Boolean) |
Gets the value or expression associated with this format condition.
|
![]() | GetFormula2(Int32, Int32) |
Gets the formula of the conditional formatting of the cell.
|
![]() | GetFormula2(Boolean, Boolean, Int32, Int32) |
Gets the value or expression of the conditional formatting of the cell.
|
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | SetFormula1 |
Sets the value or expression associated with this format condition.
|
![]() | SetFormula2 |
Sets the value or expression associated with this format condition.
|
![]() | SetFormulas |
Sets the value or expression associated with this format condition.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
[C#] //Instantiating a Workbook object Workbook workbook = new Workbook(); Worksheet sheet = workbook.Worksheets[0]; //Adds an empty conditional formatting int index = sheet.ConditionalFormattings.Add(); FormatConditionCollection fcs = sheet.ConditionalFormattings[index]; //Sets the conditional format range. CellArea ca = new CellArea(); ca.StartRow = 0; ca.EndRow = 0; ca.StartColumn = 0; ca.EndColumn = 0; fcs.AddArea(ca); ca = new CellArea(); ca.StartRow = 1; ca.EndRow = 1; ca.StartColumn = 1; ca.EndColumn = 1; fcs.AddArea(ca); //Adds condition. int conditionIndex = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.Between, "=A2", "100"); //Adds condition. int conditionIndex2 = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.Between, "50", "100"); //Sets the background color. FormatCondition fc = fcs[conditionIndex]; fc.Style.BackgroundColor = Color.Red; //Saving the Excel file workbook.Save("C:\\output.xls"); [VB.NET] 'Instantiating a Workbook object Dim workbook As Workbook = New Workbook() Dim sheet As Worksheet = workbook.Worksheets(0) ' Adds an empty conditional formatting Dim index As Integer = sheet.ConditionalFormattings.Add() Dim fcs As FormatConditionCollection = sheet.ConditionalFormattings(index) 'Sets the conditional format range. Dim ca As CellArea = New CellArea() ca.StartRow = 0 ca.EndRow = 0 ca.StartColumn = 0 ca.EndColumn = 0 fcs.AddArea(ca) ca = New CellArea() ca.StartRow = 1 ca.EndRow = 1 ca.StartColumn = 1 ca.EndColumn = 1 fcs.AddArea(ca) 'Adds condition. Dim conditionIndex As Integer = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.Between, "=A2", "100") 'Adds condition. Dim conditionIndex2 As Integer = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.Between, "50", "100") 'Sets the background color. Dim fc As FormatCondition = fcs(conditionIndex) fc.Style.BackgroundColor = Color.Red 'Saving the Excel file workbook.Save("C:\output.xls")