Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPPlus namedstyle horizontalAlignment

I have problem implementing the following code:

var newNamedStyle=_workbook.Styles.CreateNamedStyle("testStyle");     
newNamedStyle.Style.HorizontalAlignment=ExcelHorizontalAlignment.Center; 
newNamedStyle.Style.Font.Size=15; 

but EPPlus doesn't seem to be able to capture the Horizontal Alignment properly.

Could this be a bug with EPPlus?

Any work around for that?

like image 976
jxnim Avatar asked Mar 19 '13 09:03

jxnim


1 Answers

I was able to horizontally center a cell with EPPlus (3.1.3) like this.

 xlWorkSheet.Cells["A1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
like image 191
pintosack Avatar answered Sep 20 '22 03:09

pintosack