Spread for ASP.NET 8.0 Product Documentation
Insert Method (NamedStyleCollection)
Example 


Zero-based index at which to insert the named style
Style to insert into the collection
Inserts a style into the collection at the specified index.
Syntax
'Declaration
 
Public Overridable Sub Insert( _
   ByVal index As Integer, _
   ByVal style As NamedStyle _
) 
'Usage
 
Dim instance As NamedStyleCollection
Dim index As Integer
Dim style As NamedStyle
 
instance.Insert(index, style)
public virtual void Insert( 
   int index,
   NamedStyle style
)

Parameters

index
Zero-based index at which to insert the named style
style
Style to insert into the collection
Exceptions
ExceptionDescription
System.IndexOutOfRangeException Specified index is out of range; must be between 0 and the total number in the collection
System.ArgumentNullException No style specified or specified style is null
Remarks
This method inserts a style (NamedStyle object) into the collection of styles.
Example
This example inserts a style at the specified index into the collection.
FarPoint.Web.Spread.NamedStyleCollection nsc = new FarPoint.Web.Spread.NamedStyleCollection();
FarPoint.Web.Spread.NamedStyle ns = new FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault");
FarPoint.Web.Spread.NamedStyle ns1 = new FarPoint.Web.Spread.NamedStyle("HeaderData", "HeaderDefault");
FarPoint.Web.Spread.NamedStyle inserted = new FarPoint.Web.Spread.NamedStyle("Inserted", "HeaderDefault");
ns.BackColor = Color.Yellow;
ns.Border = new FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Blue);
ns1.BackColor = Color.Teal;
ns1.Border = new FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Red);
inserted.BackColor = Color.DarkBlue;
inserted.Border = New FarPoint.Web.Spread.Border(BorderStyle.Double, Color.White);
nsc.AddRange(new Object[] {ns, ns1});
nsc.Insert(1, inserted);
int i;
i = nsc.IndexOf(inserted);
FpSpread1.NamedStyles.Add(nsc[i]);
FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = nsc[i];
Dim nsc As New FarPoint.Web.Spread.NamedStyleCollection
Dim ns As New FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault")
Dim ns1 As New FarPoint.Web.Spread.NamedStyle("HeaderData", "HeaderDefault")
Dim inserted As New FarPoint.Web.Spread.NamedStyle("Inserted", "HeaderDefault")
ns.BackColor = Color.Yellow
ns.Border = New FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Blue)
ns1.BackColor = Color.Teal
ns1.Border = New FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Red)
inserted.BackColor = Color.DarkBlue
inserted.Border = New FarPoint.Web.Spread.Border(BorderStyle.Double, Color.White)
nsc.AddRange(New Object() {ns, ns1})
nsc.Insert(1, inserted)
Dim i As Integer
i = nsc.IndexOf(inserted)
FpSpread1.NamedStyles.Add(nsc(i))
FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = nsc(i)
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

NamedStyleCollection Class
NamedStyleCollection Members
AddRange Method
Add Method
Clear Method
CopyTo Method
Remove Method
RemoveAt Method
Count Property

 

 


Copyright © GrapeCity, inc. All rights reserved.