Class ExcelRangeColumn
Represents a range of columns
Implements
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public class ExcelRangeColumn : IEnumerable<ExcelRangeColumn>, IEnumerable, IEnumerator<ExcelRangeColumn>, IEnumerator, IDisposable
Properties
BestFit
Indicates that the column should resize when numbers are entered into the column to fit the size of the text. This only applies to columns where the size has not been set.
Declaration
public bool BestFit { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Collapsed
If the column is collapsed in outline mode
Declaration
public bool Collapsed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Current
The current range when enumerating
Declaration
public ExcelRangeColumn Current { get; }
Property Value
Type | Description |
---|---|
ExcelRangeColumn |
EndColumn
The last column in the collection
Declaration
public int EndColumn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Hidden
If the column is hidden.
Declaration
public bool Hidden { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
OutlineLevel
Outline level. Zero if no outline. Can not be negative.
Declaration
public int OutlineLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PageBreak
Adds a manual page break after the column.
Declaration
public bool PageBreak { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Phonetic
True if the column should show phonetic
Declaration
public bool Phonetic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Range
Reference to the cell range of the column(s)
Declaration
public ExcelRangeBase Range { get; }
Property Value
Type | Description |
---|---|
ExcelRangeBase |
StartColumn
The first column in the collection
Declaration
public int StartColumn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Style
The Style applied to the whole column(s). Only effects cells with no individual style set. Use Range object if you want to set specific styles.
Declaration
public ExcelStyle Style { get; }
Property Value
Type | Description |
---|---|
ExcelStyle |
StyleID
Sets the style for the entire column using the style ID.
Declaration
public int StyleID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
StyleName
Sets the style for the entire column using a style name.
Declaration
public string StyleName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Width
Row width of the column.
Declaration
public double Width { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
AutoFit()
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored. The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
Declaration
public void AutoFit()
Remarks
Cells containing formulas must be calculated before autofit is called. Wrapped and merged cells are also ignored.
AutoFit(Double)
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
Declaration
public void AutoFit(double MinimumWidth)
Parameters
Type | Name | Description |
---|---|---|
System.Double | MinimumWidth | Minimum column width |
Remarks
This method will not work if you run in an environment that does not support GDI. Cells containing formulas are ignored if no calculation is made. Wrapped and merged cells are also ignored.
AutoFit(Double, Double)
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
Declaration
public void AutoFit(double MinimumWidth, double MaximumWidth)
Parameters
Type | Name | Description |
---|---|---|
System.Double | MinimumWidth | Minimum column width |
System.Double | MaximumWidth | Maximum column width |
Remarks
This method will not work if you run in an environment that does not support GDI. Cells containing formulas are ignored if no calculation is made. Wrapped and merged cells are also ignored.
CollapseChildren(Boolean)
Collapses and hides the column's children. Children are columns immegetaly to the right or left of the column depending on the OutLineSummaryRight
allLevels
Declaration
public void CollapseChildren(bool allLevels = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | allLevels |
Dispose()
Disposes this object
Declaration
public void Dispose()
ExpandChildren(Boolean)
Expands and shows the column's children. Children are columns immegetaly to the right or left of the column depending on the OutLineSummaryRight
allLevels
Declaration
public void ExpandChildren(bool allLevels = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | allLevels |
GetEnumerator()
Gets the enumerator
Declaration
public IEnumerator<ExcelRangeColumn> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ExcelRangeColumn> |
Group()
Groups the columns using an outline. Adds one to OutlineLevel for each column if the outline level is less than 8.
Declaration
public void Group()
MoveNext()
Iterate to the next row
Declaration
public bool MoveNext()
Returns
Type | Description |
---|---|
System.Boolean | False if no more row exists |
Reset()
Reset the enumerator
Declaration
public void Reset()
SetVisibleOutlineLevel(Int32, Boolean)
Expands the rows to the OutlineLevel supplied.
Declaration
public void SetVisibleOutlineLevel(int level, bool collapseChildren = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | level | Expand all rows with a OutlineLevel Equal or Greater than this number. |
System.Boolean | collapseChildren | Collapse all children with a greater OutlineLevel than |
UnGroup()
Ungroups the columns from the outline. Subtracts one from OutlineLevel for each column if the outline level is larger that zero.
Declaration
public void UnGroup()
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Gets the enumerator
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
IEnumerator.Current
The current range when enumerating
Declaration
object IEnumerator.Current { get; }
Returns
Type | Description |
---|---|
System.Object |