Click or drag to resize

ExcelWorksheetColumns Property

Gets collection of all columns (ExcelColumn) in the worksheet.

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version:
public ExcelColumnCollection Columns { get; }

Property Value

Type: ExcelColumnCollection

Note that the cells are internally allocated in rows and not in columns. ExcelColumn objects are created only if they have non-standard width or style, or they are accessed directly. So, while ExcelRowCollection.Count shows number of rows occupied with data, ExcelColumnCollection.Count does not say which Column is the last one occupied with data!

If you want to read all data in a sheet, use ExcelRow.AllocatedCells property.

If you want to find last column occupied with data, use CalculateMaxUsedColumns method.

See Also