I am trying to format a column and as per the examples i need to access Columns collection and i cannot seem to find one.
Thanks for your posting and using Aspose.Cells.
You can access your column using the Worksheet.Cells.Columns collection. Once you access your column, you can apply style to it using the ApplyStyle() method.
Please see the following code. It applies the style to column K. It fills the column with Yellow color and apply the number format on it.
I have attached the source excel file used in this code and output excel file generated by it for your reference.
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets;
Style style = workbook.CreateStyle();
style.Custom = “0.00_);[Red]\(0.00\)”;
style.ForegroundColor = Color.Yellow;
style.Pattern = BackgroundType.Solid;
StyleFlag flag = new StyleFlag();
flag.CellShading = true;
flag.NumberFormat = true;
//Access Column K and apply style on it
Column col = worksheet.Cells.Columns;