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


In This Topic
    Style Class
    In This Topic
    Represents the style that is used to display a CellCells from a Column or Cells from a Row.
    Syntax
    'Declaration
     
    
    Public Class Style 
       Inherits Xceed.Workbooks.NET.StyleBase(Of IReadonlyStyle)
       Implements IReadonlyStyle 
    'Usage
     
    
    Dim instance As Style
    Remarks
    This class derives from StyleBase<IReadonlyStyle> and IReadonlyStyle.
    Example
    using( var doc = Workbook.Load( "test.xlsx") )
      {
        var worksheet = doc.Worksheets[ 0 ];        
        worksheet.Cells[ 1, 1 ].Value = 25.6;    // Sets “B2” Value.
        worksheet.Cells[ 1, 1 ].Style.CustomFormat = "$0.0000";    // Sets “B2” display format to show “$25.6000”.
        worksheet.Cells[ 2, 2 ].Value = new DateTime( 2021, 7, 1, 10, 22, 33 );  // Sets “C3” Value.
        worksheet.Cells[ 2, 2 ].Style.CustomFormat = "h:mm AM/PM";  // Sets “C3” display format to show “10:22 AM”.
        worksheet.Cells[ “D4” ].Value = 33.5;
        worksheet.Cells[ “D4” ].Style.PredefinedNumberFormatId = 2;  // Sets “D4” display format to “0.00” to show “33.50”.
        doc.Save();
      }
    Inheritance Hierarchy

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

    Public Constructors
     NameDescription
    Public Constructor  
    Top
    Public Properties
     NameDescription
    Public PropertyGets or sets the HorizontalVertical Alignment used to align the content of a Cell.  
    Public PropertyGets the collection of active Borders in a Style.  
    Public PropertyGets or sets the BuiltinStyleType.  
    Public PropertyGets or sets the format used to display the content of a Cell, the Cells in a Column or the Cells in a Row.  
    Public PropertyGets or sets the Fill used to fill the background of a CellColumnRow or range.     
    Public PropertyGets or sets the Font that will be used by the Style.  
    Public PropertyGets or sets the predefined number format that will be used to format the content of a Cell, the Cells in a Column or the Cells in a Row.  
    Public PropertyGets or sets the Protection associated with the Style.  
    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 MethodResets the Style of the CellRow or Column back to its default setting.  
    Top
    Protected Methods
    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