FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > NamedStyleCollection Class : Insert Method |
'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 )
Exception | Description |
---|---|
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 |
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)
Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional