Xceed Workbooks for .NET v1.4 Documentation
Alignment Class
Members  Example 


Xceed.Workbooks.NET Assembly > Xceed.Workbooks.NET Namespace : Alignment Class
An alignment represents the horizontal and vertical alignment used to align the content of a Cell. Alignment is available through these properties: Cell.Style, Row.Style or Column.Style.
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.
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

Reference

Alignment Members
Xceed.Workbooks.NET Namespace