Column Class
Represents a single column in a worksheet.
Inheritance Hierarchy
SystemObject
  Aspose.CellsColumn

Namespace: Aspose.Cells
Assembly: Aspose.Cells (in Aspose.Cells.dll) Version: 19.10.0.0 (19.10)
Syntax
public class Column

The Column type exposes the following members.

Properties
  NameDescription
Public propertyGroupLevel
Gets the group level of the column.
Public propertyIndex
Gets the index of this column.
Public propertyIsHidden
Indicates whether the column is hidden.
Public propertyStyle
Gets the style of this column.
Public propertyWidth
Gets and sets the column width in unit of characters.
Methods
  NameDescription
Public methodApplyStyle
Applies formats for a whole column.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
Style style = workbook.CreateStyle();

//Setting the background color to Blue
style.BackgroundColor = Color.Blue;

//Setting the foreground color to Red
style.ForegroundColor= Color.Red;

//setting Background Pattern
style.Pattern = BackgroundType.DiagonalStripe;

//New Style Flag
StyleFlag styleFlag = new StyleFlag();

//Set All Styles
styleFlag.All = true;

//Get first Column
Column column = worksheet.Cells.Columns[0];

//Apply Style to first Column
column.ApplyStyle(style, styleFlag);

//Saving the Excel file
workbook.Save("D:\\book1.xls");

[VB.NET]

'Instantiating a Workbook object
Dim workbook As New Workbook()

'Obtaining the reference of the first worksheet
Dim worksheet As Worksheet = workbook.Worksheets(0)

Dim style As Style = workbook.CreateStyle()

'Setting the background color to Blue
style.BackgroundColor = Color.Blue

'Setting the foreground color to Red
style.ForegroundColor = Color.Red

'setting Background Pattern
style.Pattern = BackgroundType.DiagonalStripe

'New Style Flag
Dim styleFlag As New StyleFlag()

'Set All Styles
styleFlag.All = True

'Get first Column
Dim column As Column = worksheet.Cells.Columns(0)

'Apply Style to first Column
column.ApplyStyle(style, styleFlag)

'Saving the Excel file
workbook.Save("D:\book1.xls")
See Also