Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / NamedStyleCollection Class / Insert Method
Zero-based index at which to insert the named style
Style to insert into the collection

In This Topic
    Insert Method (NamedStyleCollection)
    In This Topic
    Inserts a style into the collection at the specified index.
    Public Overridable Sub Insert( _
       ByVal index As Integer, _
       ByVal style As NamedStyle _
    Dim instance As NamedStyleCollection
    Dim index As Integer
    Dim style As NamedStyle
    instance.Insert(index, style)
    public virtual void Insert( 
       int index,
       NamedStyle style


    Zero-based index at which to insert the named style
    Style to insert into the collection
    Specified index is out of range; must be between 0 and the total number in the collection
    No style specified or specified style is null
    This method inserts a style (NamedStyle object) into the collection of styles.
    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.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.ActiveSheetView.ColumnHeader.DefaultStyle = nsc(i)
    See Also