Collection of the Column objects that represent the individual column(setting)s in a worksheet. The Column object only represents the settings such as column width, styles, .etc. for the whole column, has nothing to do with the fact that there are non-empty cells(data) or not in corresponding column. And the “Count” of this collection only represents the count Column objects that have been instantiated in this collection, has nothing to do with the fact that there are non-empty cells(data) or not in the worksheet.
Aspose::Cells::Startup();//Instantiating a Workbook object
Workbookworkbook;//Obtaining the reference of the first worksheet
Worksheetworksheet=workbook.GetWorksheets().Get(0);//Add new Style to Workbook
Stylestyle=workbook.CreateStyle();//Setting the background color to Blue
style.SetForegroundColor(Color{0xff,0,0,0xff});//setting Background Pattern
style.SetPattern(BackgroundType::Solid);//New Style Flag
StyleFlagstyleFlag;//Set All Styles
styleFlag.SetAll(true);//Change the default width of first ten columns
for(inti=0;i<10;i++){worksheet.GetCells().GetColumns().Get(i).SetWidth(20);}//Get the Column with non default formatting
ColumnCollectioncolumns=worksheet.GetCells().GetColumns();for(inti=0;i<columns.GetCount();++i){Columncolumn=columns.Get(i);//Apply Style to first ten Columns
column.ApplyStyle(style,styleFlag);}//Saving the Excel file
workbook.Save(u"book1.xls");Aspose::Cells::Cleanup();