Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / BorderCollection Class
Example


In This Topic
    BorderCollection Class
    In This Topic
    Defines the collection of Borders for a Style.
    Object Model
    BorderCollection ClassBorder Class
    Syntax
    'Declaration
     
    
    <DefaultMemberAttribute("Item")>
    Public Class BorderCollection 
       Inherits Xceed.Workbooks.NET.StyleBase(Of BorderCollection)
    'Usage
     
    
    Dim instance As BorderCollection
    [DefaultMember("Item")]
    public class BorderCollection : Xceed.Workbooks.NET.StyleBase<BorderCollection> 
    Remarks
    Derives from StyleBase.
    Example
    using( var workbook = Workbook.Create( "AddBorder.xlsx" ) ) 
      { 
        // Gets the first Worksheet; a Workbook always contains at least 1 Worksheet. 
        var worksheet = workbook.Worksheets[ 0 ]; 
    
        // Gets the Border collection for Cell A2. 
        var borders = worksheet.Cells[ "A2" ].Style.Borders; 
    
        // Sets the color and style of the rightmost Border. 
        borders[ BorderType.Right ].Style = LineStyle.Thick; 
        borders[ BorderType.Right ].Color = Color.Red; 
    
        // Saves Workbook to disk; 
        workbook.Save(); 
      }
    Inheritance Hierarchy

    System.Object
       Xceed.Workbooks.NET.StyleBase<T>
          Xceed.Workbooks.NET.BorderCollection

    Public Properties
     NameDescription
    Public PropertyGets or sets a specific Border in the BorderCollection.  
    Top
    Public Methods
     NameDescription
    Public MethodDetermines whether the specified System.Object is equal to the current System.Object.  
    Public MethodServes as a hash function for a particular type.  
    Public MethodSets the DiagonalUp and DiagonalDown Borders using the same LineStyle and Color.  
    Public MethodSets the Horizontal and Vertical Borders using the same LineStyle and Color.  
    Public MethodSets the LeftRightTop and Bottom Borders using the same LineStyle and Color.  
    Public MethodSets the DiagonalUp and DiagonalDown Borders using the same LineStyle and ThemeColor.  
    Public MethodSets the Horizontal and Vertical Borders using the same LineStyle and ThemeColor.  
    Public MethodSets the LeftRightTop and Bottom Borders using the same LineStyle and ThemeColor.  
    Top
    Protected Methods
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also