Spread ASP.NET 14
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / NamedStyleCollection Class / Add Method / Add(NamedStyle) Method
Name of the style to add
Example


In This Topic
    Add(NamedStyle) Method
    In This Topic
    Adds a style (NamedStyle object) to the collection.
    Syntax
    'Declaration
     
    Public Overloads Overridable Function Add( _
       ByVal style As NamedStyle _
    ) As Integer
    'Usage
     
    Dim instance As NamedStyleCollection
    Dim style As NamedStyle
    Dim value As Integer
     
    value = instance.Add(style)
    public virtual int Add( 
       NamedStyle style
    )

    Parameters

    style
    Name of the style to add

    Return Value

    Integer with the index of the named style added to the collection

    Exceptions
    ExceptionDescription
    No style specified or specified style is null
    Remarks
    This method adds a NamedStyle object to the collection and returns its index in the collection.
    Example
    This example adds a style to the NamedStyleCollection object.
    FarPoint.Web.Spread.NamedStyleCollection nsc = new FarPoint.Web.Spread.NamedStyleCollection();
    FarPoint.Web.Spread.NamedStyle ns = new FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault");
    ns.BackColor = Color.Yellow;
    ns.Border = new FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Blue);
    nsc.Add(ns);
    FpSpread1.NamedStyles.Add(nsc[0]);
    FpSpread1.ActiveSheetView.DefaultStyle = nsc[0];
    
    Dim nsc As New FarPoint.Web.Spread.NamedStyleCollection
    Dim ns As New FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault")
    ns.BackColor = Color.Yellow
    ns.Border = New FarPoint.Web.Spread.Border(BorderStyle.Double, Color.Blue)
    nsc.Add(ns)
    FpSpread1.NamedStyles.Add(nsc.Item(0))
    FpSpread1.ActiveSheetView.DefaultStyle = nsc(0)
    See Also