Free Support Forum -

Center between several columns


Is there a method that do the same thing that the excel option : In format\Cell text alignment, horizontal : Center between several columns.

I would like avoid to use merge function.



Please try the following sample code:

Excel excel = new Excel();

Cells cells = excel.Worksheets[0].Cells;

for(int i = 0; i < 5; i ++)
cells[0, i].Style.HorizontalAlignment = TextAlignmentType.CenterAcross;

cells[0, 0].PutValue("Hello World");