OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLColumn Class Reference

#include <XLColumn.hpp>

Public Member Functions

 XLColumn (XMLNode columnNode)
 Constructor.
 
float width () const
 Get the width of the column.
 
void setWidth (float width)
 Set the width of the column.
 
void autoFit ()
 Auto fit the column width based on the content of its cells.
 
bool isHidden () const
 Is the column hidden?
 
void setHidden (bool state)
 Set the column to be shown or hidden.
 
uint8_t outlineLevel () const
 Get the outline level of the column.
 
void setOutlineLevel (uint8_t level)
 Set the outline level of the column.
 
bool isCollapsed () const
 Is the column collapsed?
 
void setCollapsed (bool state)
 Set the column to be collapsed or expanded.
 
XMLNode columnNode () const
 Get the XMLNode object for the column.
 
XLStyleIndex format () const
 Get the array index of xl/styles.xml:<styleSheet>:<cellXfs> for the style assigned to the column. This value is stored in the col attributes like so: style="2".
 
bool setFormat (XLStyleIndex cellFormatIndex)
 Set the column style as a reference to the array index of xl/styles.xml:<styleSheet>:<cellXfs>
 

Constructor & Destructor Documentation

◆ XLColumn()

XLColumn::XLColumn ( XMLNode  columnNode)
explicit

Constructor.

Parameters
columnNodeThe XMLNode for the column.

Assumes each node only has data for one column.

Member Function Documentation

◆ autoFit()

void XLColumn::autoFit ( )

Auto fit the column width based on the content of its cells.

Note
This is a convenience method that internally delegates to XLWorksheet.

◆ columnNode()

XMLNode XLColumn::columnNode ( ) const

Get the XMLNode object for the column.

Returns
The XMLNode for the column

◆ format()

XLStyleIndex XLColumn::format ( ) const

Get the array index of xl/styles.xml:<styleSheet>:<cellXfs> for the style assigned to the column. This value is stored in the col attributes like so: style="2".

Returns
The index of the applicable format style

Determine the value of the style attribute - if attribute does not exist, return default value

◆ isCollapsed()

bool XLColumn::isCollapsed ( ) const

Is the column collapsed?

Returns
true if the column is collapsed.

Is the column collapsed?

◆ isHidden()

bool XLColumn::isHidden ( ) const

Is the column hidden?

Returns
The state of the column.

◆ outlineLevel()

uint8_t XLColumn::outlineLevel ( ) const

Get the outline level of the column.

Returns
The outline level (0-7).

Get the outline level of the column.

◆ setCollapsed()

void XLColumn::setCollapsed ( bool  state)

Set the column to be collapsed or expanded.

Parameters
stateThe collapsed state of the column.

Set the column to be collapsed or expanded.

◆ setFormat()

bool XLColumn::setFormat ( XLStyleIndex  cellFormatIndex)

Set the column style as a reference to the array index of xl/styles.xml:<styleSheet>:<cellXfs>

Set the column style as a reference to the array index of xl/styles.xml:<styleSheet>:<cellXfs> If the style attribute does not exist, create it.

Parameters
cellFormatIndexThe style to set, corresponding to the index of XLStyles::cellStyles()
Returns
true on success, false on failure

◆ setHidden()

void XLColumn::setHidden ( bool  state)

Set the column to be shown or hidden.

Parameters
stateThe state of the column.

◆ setOutlineLevel()

void XLColumn::setOutlineLevel ( uint8_t  level)

Set the outline level of the column.

Parameters
levelThe outline level (0-7).

Set the outline level of the column.

◆ setWidth()

void XLColumn::setWidth ( float  width)

Set the width of the column.

Parameters
widthThe width of the column

◆ width()

float XLColumn::width ( ) const

Get the width of the column.

Returns
The width of the column.

The documentation for this class was generated from the following files: