ExcelColumn Class
Excel column contains column options and cell range with column cells.
public sealed class ExcelColumn : ExcelColumnRowBase
Public NotInheritable Class ExcelColumn
Inherits ExcelColumnRowBase
- Inheritance:
- ExcelColumn
Remarks
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 AllocatedCells property.
If you want to find last column occupied with data, use CalculateMaxUsedColumns() method.
Properties
Width
Gets or sets column width.
Property Value
Remarks
Unit is 1/256th of the width of the zero character in default font.
See Also
Methods
AutoFit()
Automatically fits column width to the minimum size required for all data in the column to be visible.
Remarks
Auto-fit column width is a MS Excel feature and not a file format feature. Autofit method uses methods from System.Drawing to determine the real data width.
AutoFit(Double)
Automatically fits column width to the minimum size required for all data in the column to be visible.
[ComVisible(true)]
public void AutoFit(double scaling)
<ComVisible(True)>
Public Sub AutoFit(scaling As Double)
Parameters
scaling
- Double
Scaling factor.
Remarks
Auto-fit column width is a MS Excel feature and not a file format feature. Autofit method uses methods from System.Drawing to determine the real data width.
Scaling factor is used to adjust the width of the column. Resulting column width is equal to CalculatedWidth * scaling. Default scaling is 1.
AutoFit(Double, ExcelRow, ExcelRow)
Automatically fits column width by checking only the cells in the column that are specified by row range.
[ComVisible(false)]
public void AutoFit(double scaling, ExcelRow firstRow, ExcelRow lastRow)
<ComVisible(False)>
Public Sub AutoFit(scaling As Double, firstRow As ExcelRow, lastRow As ExcelRow)
Parameters
scaling
- Double
Scaling factor.
firstRow
- ExcelRow
First row.
lastRow
- ExcelRow
Last row.
Remarks
Auto-fit column width is a MS Excel feature and not a file format feature. Autofit method uses methods from System.Drawing to determine the real data width.
Scaling factor is used to adjust the width of the column. Resulting column width is equal to CalculatedWidth * scaling. Default scaling is 1.
GetWidth(LengthUnit)
Gets the width of column in arbitrary length unit.
public double GetWidth(LengthUnit lengthUnit)
Public Function GetWidth(lengthUnit As LengthUnit) As Double
Parameters
lengthUnit
- LengthUnit
The length unit in which to return column width.
Returns
The width of column in arbitrary length unit.
SetWidth(Double, LengthUnit)
Sets the width of column in arbitrary length unit.
public void SetWidth(double value, LengthUnit lengthUnit)
Public Sub SetWidth(value As Double, lengthUnit As LengthUnit)
Parameters
value
- Double
Column width value.
lengthUnit
- LengthUnit
The length unit in which value
is specified.
Inherited Properties
Cells | Gets cell range with column / row cells. (Inherited from ExcelColumnRowBase) |
Collapsed | Gets or sets whether object is collapsed in outlining. (Inherited from ExcelColumnRowBase) |
Hidden | Gets or sets whether excel object is hidden. (Inherited from ExcelColumnRowBase) |
Index | Gets the row / column zero-based index which represents its position in a worksheet. (Inherited from ExcelColumnRowBase) |
Name | Gets the name of ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
OutlineLevel | Gets or sets outline level. (Inherited from ExcelColumnRowBase) |
Style | Gets or sets the cell formatting of cells in this column / row. (Inherited from ExcelColumnRowBase) |
Inherited Methods
Equals(Object) | Determines whether the specified Object is equal to this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
GetHashCode() | Returns a hash code for this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
ToString() | Returns a String that represents this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |