Visual Basic (Declaration) | |
---|---|
Public Overloads Function SetConditionalFormat( _ ByVal row As Integer, _ ByVal column As Integer, _ ByVal style As NamedStyle, _ ByVal op As ComparisonOperator, _ ByVal firstCondition As String, _ ByVal lastCondition As String _ ) As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As SheetView Dim row As Integer Dim column As Integer Dim style As NamedStyle Dim op As ComparisonOperator Dim firstCondition As String Dim lastCondition As String Dim value As Boolean value = instance.SetConditionalFormat(row, column, style, op, firstCondition, lastCondition) |
C# | |
---|---|
public bool SetConditionalFormat( int row, int column, NamedStyle style, ComparisonOperator op, string firstCondition, string lastCondition ) |
Parameters
- row
- Row index of the cell
- column
- Column index of the cell
- style
- Style to be applied to the cell if the condition is satisfied
- op
- Comparison operator to apply to the cell value and the parameter values
- firstCondition
- First condition value
- lastCondition
- Last condition value
Return Value
Boolean: true if successful; false otherwiseException | Description |
---|---|
System.ArgumentNullException | No condition is specified or specified condition is empty |
System.ArgumentException | Specified condition is not valid; must be a string |
This example sets the format for the specified cell.
C# | Copy Code |
---|---|
FarPoint.Win.Spread.NamedStyle styleCold = new FarPoint.Win.Spread.NamedStyle(); FarPoint.Win.Spread.NamedStyle styleCool = new FarPoint.Win.Spread.NamedStyle(); FarPoint.Win.Spread.NamedStyle styleMild = new FarPoint.Win.Spread.NamedStyle(); FarPoint.Win.Spread.NamedStyle styleWarm = new FarPoint.Win.Spread.NamedStyle(); FarPoint.Win.Spread.NamedStyle styleHot = new FarPoint.Win.Spread.NamedStyle(); styleCold.BackColor = Color.Blue; styleCold.ForeColor = Color.White; styleCool.BackColor = Color.Cyan; styleMild.BackColor = Color.Lime; styleWarm.BackColor = Color.Yellow; styleHot.BackColor = Color.Red; fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCold, FarPoint.Win.Spread.ComparisonOperator.LessThan, "32"); fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCool, FarPoint.Win.Spread.ComparisonOperator.Between, "32", "55"); fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleMild, FarPoint.Win.Spread.ComparisonOperator.Between, "55", "75"); fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleWarm, FarPoint.Win.Spread.ComparisonOperator.Between, "75", "85"); fpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleHot, FarPoint.Win.Spread.ComparisonOperator.GreaterThan, "85"); fpSpread1.ActiveSheet.Cells[1, 1].Value = 38; |
Visual Basic | Copy Code |
---|---|
Dim styleCold As New FarPoint.Win.Spread.NamedStyle Dim styleCool As New FarPoint.Win.Spread.NamedStyle Dim styleMild As New FarPoint.Win.Spread.NamedStyle Dim styleWarm As New FarPoint.Win.Spread.NamedStyle Dim styleHot As New FarPoint.Win.Spread.NamedStyle styleCold.BackColor = Color.Blue styleCold.ForeColor = Color.White styleCool.BackColor = Color.Cyan styleMild.BackColor = Color.Lime styleWarm.BackColor = Color.Yellow styleHot.BackColor = Color.Red Dim co As New FarPoint.Win.Spread.ComparisonOperator FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCold, co.LessThan, "32") FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCool, co.Between, "32", "55") FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleMild, co.Between, "55", "75") FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleWarm, co.Between, "75", "85") FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleHot, co.GreaterThan, "85") FpSpread1.ActiveSheet.Cells(1, 1).Value = 38 |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2