Page tree
Skip to end of metadata
Go to start of metadata

Description

The ColumnProperties class represents a single column in a worksheet.

C#
vb.net

Remarks

To return a ColumnProperties object, use Worksheet.GetColumnProperties(). The following sample gets the column properties for the first column of the first worksheet.

Examples

C#
vb.net

Properties

Name

Description

ColumnNumber

Returns the column's 0-based index.

Hidden

Sets or returns whether or not the column will be hidden when the workbook is opened in Excel.

OutlineCollapsed

Sets or returns whether the column's outlined column group is collapsed. If the outline is collapsed, the column is hidden.

OutlineLevel

Sets or returns the outline level of the column, as a value between 0 and 7. The outline level is used to control grouping in Excel. For example, to group several columns, set their outline levels to 1; to group a subset of columns within the group, set their outline levels to 2.

PaddingInChars

Returns 'padding' (in characters) that needs to be added to the column width (in characters) to get true width of this column.

Style

Sets or returns a Style object that determines how cells in the column look, including number format, font, orientation, etc.

Width

Sets or returns the width of the column in points (1/72 of an inch).

WidthInChars

Sets or returns the width of the column as a number of '0' characters in the font of the 'Normal' style. This must be a value between 0 - 255.

Methods

Name

Description

ApplyStyle(Style)

Applies a style to the column. When a style is applied - rather than set (see ColumnProperties.Style ) - only the differences between the new style and style properties previously assigned to the column (through the ExcelWriter API or in Microsoft Excel) will take effect. For example, if a cell in the column has a background color and the new style applied does not contain a background color, the cell's color will not be affected.

AutoFitWidth()

Automatically sets the width of the column to the width of the widest cell value in the column.
  • No labels