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

    Public Constructors
     NameDescription
    Public ConstructorOverloaded.   
    Top
    Public Properties
     NameDescription
    Public PropertyGets or sets the alignment used to align the content of a Cell horizontally.  
    Public PropertyGets or sets the indentation for the content of the Cell.  
    Public PropertyGets or sets if the text is shrunk to fit within the Cell or not.  
    Public PropertyGets or sets if the text content of a Cell is wrapped or not.  
    Public PropertyGets or sets the angle of rotation.  
    Public PropertyKeeps the text flowing in the specified direction.  
    Public PropertyGets or sets the alignment used to align the content of a Cell vertically.  
    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.  
    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