Column style

Is it possible to merge style of the column and the style of the cell ?

I set the style of some cells and later I set the style of the column.

For the cells in the column where I already set a style, the column’s style have no effect, it keeps the style of the cell.

For example

xlSheet.Cells[0,0].PutValue(123);

xlSheet.Cells[1,0].PutValue(456);

xlSheet.Cells[0,0].Style.Font.IsBold = true;

xlSheet.Cells.Columns[Convert.ToByte(0)].Style.Font.IsItalic = true;

I would like to have the cell A1 in italic.

Is it possible?

Thank you

Alexandre

You can try:

xlSheet.Cells[0,0].PutValue(123);

xlSheet.Cells[1,0].PutValue(456);

xlSheet.Cells[0,0].Style.Font.IsBold = true;

Style style = xlSheet.Cells.Columns[Convert.ToByte(0)].Style;

style.Font.IsItalic = true;

xlSheet.Cells.Columns[Convert.ToByte(0)].Style = style;

Why the result is different? (if there is a short answer!)

I tried with your code and I have a problem with the combination of HorizontalAlignment and Right Border:

xlSheet.Cells[0,0].PutValue(123);

xlSheet.Cells[1,0].PutValue(456);

xlSheet.Cells[0,0].Style.HorizontalAlignment = Aspose.Cells.TextAlignmentType.Center;

Style style = xlSheet.Cells.Columns[Convert.ToByte(0)].Style;

style.Borders[Aspose.Cells.BorderType.RightBorder].LineStyle = Aspose.Cells.CellBorderType.Medium;

xlSheet.Cells.Columns[Convert.ToByte(0)].Style = style;

The cell A1... I don't have the right border in the cell A1.

When you use Column.Style get property to change the column style, it only changes the column formattings. It cannot change the formattings on cells. When you use Column.Style set property to re-set it again, it can notify to change the individual cell's formattings.

However, this action still has some problems. So I plan to add a new method to apply styles for a whole column.