Excel Cell Text alignment
- EPPlus supports main two categories of (Horizontal & Vertical) text alignments.
- Each alignment is respectively assigned by ExcelHorizontalAlignment& ExcelVerticalAlignment enum.


Example
- ExcelRange Rng = new ExcelRange();
- Rng.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
- Rng.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
*By default, EPPlus supports Left Horizontal & Bottom Vertical text alignment, if you are not specifying any alignment.
Excel Row Height
Excel Row Height
- ExcelWorkSheet wsSheet1 = ExcelPkg.Workbook.Worksheets.Add("Sheet1");
- wsSheet1.Row(4).Height = 30;
*In this example, Row method accepts value 4 as a parameter for row number & height properties assigns 30 as double type.
Column Width
Column Width
- wsSheet1.Cells[wsSheet1.Dimension.Address].AutoFitColumns();
*In this example, dimension property is the address of the worksheet from left to right cell & AutoFitColumns() is responsible to set columns width, as per the length of content of the cell range.
Output on an Excel sheet is given below.

Source code
Output on an Excel sheet is given below.

Source code

vijilaPosted Feb 27, 2023, 6:09 AM
What is alternte method for Eppplus. Since epplus is licensed now
Brady KellyPosted Nov 11, 2019, 2:56 AM
Your post heading basically says, ..."set column width", and I really expected you to show how to set column width, and not be lazy and just use autosize. Very disappointed in the whole post in fact.
Bidyasagar MishraPosted Aug 6, 2019, 4:57 AM
How to append data to an existing excel