Syncfusion.XlsIO.Base
Example 


HAlignment Property

Horizontal alignment of the text.
Syntax
'Declaration
 
Property HAlignment As ExcelCommentHAlign
'Usage
 
Dim instance As ITextBox
Dim value As ExcelCommentHAlign
 
instance.HAlignment = value
 
value = instance.HAlignment
ExcelCommentHAlign HAlignment {get; set;}
Example
By default ExcelHorizontalAlignment.Left is set to HAlignment. Here for example, we set ExcelHorizontalAlignment.Center to HAlignment property.
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];
            
            //Add textbox
            ITextBox textbox = worksheet.TextBoxes.AddTextBox(5, 5, 40, 100);
            
            //Set text
            textbox.Text = "Text";
            
            //Set alignment
            textbox.HAlignment = ExcelCommentHAlign.Left;
            
            //Save and dispose
            workbook.SaveAs("Shapes.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also