Spread for ASP.NET 8.0 Product Documentation
Style Property (ConditionalFormat)
Example 


Gets or sets a style for the conditional format.
Syntax
'Declaration
 
Public Property Style As NamedStyle
'Usage
 
Dim instance As ConditionalFormat
Dim value As NamedStyle
 
instance.Style = value
 
value = instance.Style
public NamedStyle Style {get; set;}

Property Value

NamedStyle object containing the style to apply when the conditions are met
Example
This example returns the styles color.
FarPoint.Web.Spread.NamedStyle above = new FarPoint.Web.Spread.NamedStyle(); 
FarPoint.Web.Spread.NamedStyle below = new FarPoint.Web.Spread.NamedStyle(); 
above.BackColor = Color.Red; 
below.BackColor = Color.Yellow; 
FarPoint.CalcEngine.Expression one; 
FarPoint.CalcEngine.Expression two; 
FarPoint.CalcEngine.Expression oneplustwo; 
FarPoint.Web.Spread.Model.DefaultSheetDataModel dm; 
one = new FarPoint.CalcEngine.DoubleExpression(100); 
two = new FarPoint.CalcEngine.DoubleExpression(20); 
oneplustwo = new FarPoint.CalcEngine.BinaryOperatorExpression(FarPoint.CalcEngine.BinaryOperatorInfo.AddOperator, one, two);

dm = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel; 
dm.SetExpression(1, 1, oneplustwo); 
FpSpread1.ActiveSheetView.SetConditionalFormat(1, 1, above, FarPoint.Web.Spread.ComparisonOperator.GreaterThan, one, two);

FpSpread1.ActiveSheetView.SetConditionalFormat(1, 1, below, FarPoint.Web.Spread.ComparisonOperator.LessThan, one, two); 
FarPoint.Web.Spread.ConditionalFormat[] cf; 
FarPoint.Web.Spread.ConditionalFormat item = new FarPoint.Web.Spread.ConditionalFormat(); 
cf = FpSpread1.ActiveSheetView.GetConditionalFormats(1, 1); 
foreach (int item in cf) { 
 string msg = "The style color is " + item.Style.BackColor.ToString(); 
 Response.Write("alert('" + msg + "')"); 
}
Dim above As New FarPoint.Web.Spread.NamedStyle
Dim below As New FarPoint.Web.Spread.NamedStyle
above.BackColor = Color.Red
below.BackColor = Color.Yellow

Dim one As FarPoint.CalcEngine.Expression
Dim two As FarPoint.CalcEngine.Expression
Dim oneplustwo As FarPoint.CalcEngine.Expression
Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel
one = New FarPoint.CalcEngine.DoubleExpression(100.0)
two = New FarPoint.CalcEngine.DoubleExpression(20.0)
oneplustwo = New FarPoint.CalcEngine.BinaryOperatorExpression(FarPoint.CalcEngine.BinaryOperatorInfo.AddOperator, one, two)
dm = FpSpread1.ActiveSheetView.DataModel
dm.SetExpression(1, 1, oneplustwo)

FpSpread1.ActiveSheetView.SetConditionalFormat(1, 1, above, FarPoint.Web.Spread.ComparisonOperator.GreaterThan, one, two)
FpSpread1.ActiveSheetView.SetConditionalFormat(1, 1, below, FarPoint.Web.Spread.ComparisonOperator.LessThan, one, two)


Dim cf As FarPoint.Web.Spread.ConditionalFormat()
Dim item As New FarPoint.Web.Spread.ConditionalFormat
cf = FpSpread1.ActiveSheetView.GetConditionalFormats(1, 1)
For Each item In cf
Dim msg As String = "The style color is " & item.Style.BackColor.ToString()
Response.Write("alert('" & msg & "')")
Next
Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

ConditionalFormat Class
ConditionalFormat Members

 

 


Copyright © GrapeCity, inc. All rights reserved.