Table of Contents

Class ExcelColumn

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

Represents one or more columns within the worksheet

public class ExcelColumn
Inheritance
ExcelColumn
Inherited Members

Constructors

ExcelColumn(ExcelWorksheet, int)

Creates a new instance of the ExcelColumn class.
For internal use only!

protected ExcelColumn(ExcelWorksheet Worksheet, int col)

Parameters

Worksheet ExcelWorksheet
col int

Properties

BestFit

If set to true a column automaticlly resize(grow wider) when a user inputs numbers in a cell.

public bool BestFit { get; set; }

Property Value

bool

Collapsed

If the column is collapsed in outline mode

public bool Collapsed { get; set; }

Property Value

bool

ColumnMax

Sets the last column the definition refers to.

public int ColumnMax { get; set; }

Property Value

int

ColumnMin

Sets the first column the definition refers to.

public int ColumnMin { get; }

Property Value

int

Hidden

Defines if the column is visible or hidden

public bool Hidden { get; set; }

Property Value

bool

Merged

Merges all cells of the column

public bool Merged { get; set; }

Property Value

bool

OutlineLevel

Outline level. Zero if no outline

public int OutlineLevel { get; set; }

Property Value

int

PageBreak

Adds a manual page break after the column.

public bool PageBreak { get; set; }

Property Value

bool

Phonetic

Phonetic

public bool Phonetic { get; set; }

Property Value

bool

Style

The Style applied to the whole column. Only effects cells with no individual style set. Use Range object if you want to set specific styles.

public ExcelStyle Style { get; }

Property Value

ExcelStyle

StyleID

Sets the style for the entire column using the style ID.

public int StyleID { get; set; }

Property Value

int

StyleName

Sets the style for the entire column using a style name.

public string StyleName { get; set; }

Property Value

string

Width

Sets the width of the column in the worksheet

public double Width { get; set; }

Property Value

double

Methods

AutoFit()

Set the column width from the content of the range. The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property. Note: Cells containing formulas are ignored unless a calculation is performed. Wrapped and merged cells are also ignored.

public void AutoFit()

AutoFit(double)

Set the column width from the content. Note: Cells containing formulas are ignored unless a calculation is performed. Wrapped and merged cells are also ignored.

public void AutoFit(double MinimumWidth)

Parameters

MinimumWidth double

Minimum column width

AutoFit(double, double)

Set the column width from the content. Note: Cells containing formulas are ignored unless a calculation is performed. Wrapped and merged cells are also ignored.

public void AutoFit(double MinimumWidth, double MaximumWidth)

Parameters

MinimumWidth double

Minimum column width

MaximumWidth double

Maximum column width

ToString()

Returns the range of columns covered by the column definition.

public override string ToString()

Returns

string

A string describing the range of columns covered by the column definition.