Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / Border Class / Style Property
Example


In This Topic
    Style Property (Border)
    In This Topic
    Gets or sets the style of the Border.
    Syntax
    'Declaration
     
    
    Public Property Style As LineStyle
    'Usage
     
    
    Dim instance As Border
    Dim value As LineStyle
     
    instance.Style = value
     
    value = instance.Style
    public LineStyle Style {get; set;}
    Remarks

    The default value is None.

    Note that if the Color property is not defined, it will automatically be set to Black.

    Example
    var workbook = Workbook.Create("test.xlsx" )
    
    // Get the first worksheet. A workbook contains at least 1 worksheet.
    var cellWorksheet = workbook.Worksheets[ 0 ];
    
    // Set cell content and Border styles.
    cellWorksheet.Cells[ "C5" ].Value = "Bottom";
    cellWorksheet.Cells[ "C5" ].Style.Borders[ BorderType.Bottom ].Style = LineStyle.Double;
    cellWorksheet.Cells[ "C5" ].Style.Borders[ BorderType.Bottom ].Color = Color.Red;
    
    cellWorksheet.Cells[ "C8" ].Value = "Top";
    cellWorksheet.Cells[ "C8" ].Style.Borders[ BorderType.Top ].Style = LineStyle.DashDot;
    
    cellWorksheet.Cells[ "C11" ].Value = "Right";
    cellWorksheet.Cells[ "C11" ].Style.Borders[ BorderType.Right ] = new Border() { Style = LineStyle.MediumDashed, Color = Color.Green };
    
    // Save workbook to disk.
    workbook.Save();
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also