Syncfusion.XlsIO.Base
Example 


VerticalAlignment Property (IExtendedFormat)

Vertical alignment.
Syntax
'Declaration
 
Property VerticalAlignment As ExcelVAlign
'Usage
 
Dim instance As IExtendedFormat
Dim value As ExcelVAlign
 
instance.VerticalAlignment = value
 
value = instance.VerticalAlignment
ExcelVAlign VerticalAlignment {get; set;}
Example
By default ExcelVAlign.VAlignBottom is set to VerticalAlignment. Here for example, we set ExcelVAlign.VAlignCenter to VerticalAlignment.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Set text
            worksheet["C2"].Text = "Sample";
            worksheet["C5"].Text = "Sample";
            
            //Set row height
            worksheet["C2"].RowHeight = 25;
            worksheet["C5"].RowHeight = 25;
            
            //Add style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set alignment
            style.VerticalAlignment = ExcelVAlign.VAlignCenter;
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Get extended format
            IExtendedFormat format = worksheet["C5"].CellStyle;
            
            //Set alignment
            format.VerticalAlignment = ExcelVAlign.VAlignCenter;
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also