Spread for ASP.NET 8.0 Product Documentation
SetDirectAltRowName Method (DefaultSheetStyleModel)
Example 


Index of the alternating row style to set
Name of the style to set
Sets the name of the specified alternating row style in the model to the specified named style.
Syntax
'Declaration
 
Public Overridable Sub SetDirectAltRowName( _
   ByVal index As Integer, _
   ByVal styleName As String _
) 
'Usage
 
Dim instance As DefaultSheetStyleModel
Dim index As Integer
Dim styleName As String
 
instance.SetDirectAltRowName(index, styleName)
public virtual void SetDirectAltRowName( 
   int index,
   string styleName
)

Parameters

index
Index of the alternating row style to set
styleName
Name of the style to set
Exceptions
ExceptionDescription
System.IndexOutOfRangeException Specified index is not valid; must be between 0 and the total number of styles
System.ArgumentNullExceptionNo style is specified or specified style is null
System.ArgumentExceptionNo style is specified or specified style is empty
Remarks
The index must be between 0 and the value of the AltRowCount property minus 1.
Example
This example creates a new NamedStyle object. The name and the background color properties of the NamedStyle are set, and the name of the NamedStyle is retrieved using this method.
private void Page_Load(object sender,System.EventArgs e)
{
if(this.IsPostBack)return;

FarPoint.Web.Spread.Model.DefaultSheetStyleModel model=(FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
FarPoint.Web.Spread.NamedStyle style=new FarPoint.Web.Spread.NamedStyle();
style.Name="YellowCell";
style.BackColor=Color.Yellow;

model.SetDirectAltRowInfo(0,style);
ListBox1.Items.Add("StyleName:"+model.GetDirectAltRowName(0));

FarPoint.Web.Spread.StyleInfostyle1=model.GetDirectAltRowInfo(0,null);
ListBox1.Items.Add("BackColor:"+style1.BackColor.ToString());
}
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If(IsPostBack)Then Return

Dim model As FarPoint.Web.Spread.Model.DefaultSheetStyleModel=FpSpread1.Sheets(0).StyleModel
Dim style As New FarPoint.Web.Spread.NamedStyle()
style.Name="YellowCell"
style.BackColor=Color.Yellow

model.SetDirectAltRowInfo(0,style)
ListBox1.Items.Add("StyleName:"&model.GetDirectAltRowName(0))

Dim style1 As FarPoint.Web.Spread.StyleInfo=model.GetDirectAltRowInfo(0,NoThing)
ListBox1.Items.Add("BackColor:"&style1.BackColor.ToString())
End Sub
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

DefaultSheetStyleModel Class
DefaultSheetStyleModel Members
GetDirectAltRowInfo Method
GetDirectAltRowName Method
SetDirectName Method
AltRowCount Property
NamedStyles Property

 

 


Copyright © GrapeCity, inc. All rights reserved.