Spread for ASP.NET 7.0 Product Documentation
Insert Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > NamedStyleCollection Class : Insert Method


index
Zero-based index at which to insert the named style
style
Style to insert into the collection

Glossary Item Box

Inserts a style into the collection at the specified index.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub Insert( _
   ByVal index As Integer, _
   ByVal style As NamedStyle _
) 
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollection
Dim index As Integer
Dim style As NamedStyle
 
instance.Insert(index, style)
C# 
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.
C#Copy Code
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];
VB.NETCopy Code
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

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.