[Column].HorizontalAlignment doesn't work?

Hello,

if I set a value to the member "HorizontalAlignment" of an column object (p.e Center), it has no effect ...
The debugger shows, that the value is still "General"

Is it a bug or a feature? ;-)

regards
Michael

Hi Mike,

Thanks for considering Aspose.

Yes, it is supported but there is a proper way to do that. You should utilize Cells.ApplyColumnStyle() method for the task. Please consult the following sample code for your requirement. Note: this procedure is more optimized and put up good show related performance in the long run.

Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
Style style;
StyleFlag flag;

style = wb.Styles[wb.Styles.Add()];
style.HorizontalAlignment = TextAlignmentType.Center;
flag = new StyleFlag();
flag.HorizontalAlignment = true;
sheet.Cells.ApplyColumnStyle(0,style, flag);

wb.Save("d:\\test\\halign_column.xls", FileFormatType.ExcelXP);

Thank you.