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

    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