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


In This Topic
    Alignment Class
    In This Topic
    Represents the horizontal and vertical alignment used to align the content of a Cell.
    Syntax
    'Declaration
     
    
    Public Class Alignment 
       Inherits Xceed.Workbooks.NET.StyleBase(Of IReadonlyAlignment)
       Implements IReadonlyAlignment 
    'Usage
     
    
    Dim instance As Alignment
    Remarks

    This class derives from StyleBase<IReadonlyAlignment> and IReadonlyAlignment.

    Note that alignements are added throught the Style.Alignment property.

    Example
    using( var doc = Workbook.Load( "test.xlsx") )
      {
        var worksheet = doc.Worksheets[ 0 ];        
        worksheet.Cells[ 0, 1 ].Value =  new DateTime( 2021, 7, 1, 10, 22, 33 );  
        worksheet.Cells[ 0, 1].Style.Alignment.Horizontal = HorizontalAlignment.Center;
    
        worksheet.Cells[ 0, 2 ].Value =  “abc”;
        worksheet.Cells[ 0, 2].Style.Alignment = new Alignment( HorizontalAlignment.Justify, VerticalAlignment.Center);
    
        doc.Save();
      }
    Inheritance Hierarchy

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

    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