aspose.cells

Class Column

Represents a single column in a worksheet.

Example:

//Instantiating a Workbook object
//Instantiating a Workbook object
$workbook = new cells\Workbook();
//Obtaining the reference of the first worksheet
$worksheet = $workbook->getWorksheets()->get(0);
$style = $workbook->createStyle();
//Setting the background color to Blue
$style->setBackgroundColor(cells\Color::getBlue());

//Setting the foreground color to Red
$style->setForegroundColor(cells\Color::getRed());

//setting Background Pattern
$style->setPattern(cells\BackgroundType::DIAGONAL_STRIPE);

//New Style Flag
$styleFlag = new cells\StyleFlag();

//Set All Styles
$styleFlag->setAll(true);

//Get first Column
$column = $worksheet->getCells()->getColumns()->get(0);

//Apply Style to first Column
$column->applyStyle($style, $styleFlag);

Property Getters/Setters Summary
functiongetGroupLevel()
Gets the group level of the column.
functiongetIndex()
Gets the index of this column.
functionisCollapsed()
function
           whether the column is collapsed
functionisHidden()
function
setHidden(value)
           Indicates whether the column is hidden.
functiongetStyle()
Gets the style of this column.
functiongetWidth()
function
setWidth(value)
           Gets and sets the column width in unit of characters.
 
Method Summary
functionapplyStyle(style, flag)
Applies formats for a whole column.
 

    • Property Getters/Setters Detail

      • getIndex : Number 

        function getIndex()
        
        Gets the index of this column.
      • getWidth/setWidth : Number 

        function getWidth() / function setWidth(value)
        
        Gets and sets the column width in unit of characters.
      • getGroupLevel : byte 

        function getGroupLevel()
        
        Gets the group level of the column.
      • isHidden/setHidden : boolean 

        function isHidden() / function setHidden(value)
        
        Indicates whether the column is hidden.
      • getStyle : Style 

        function getStyle()
        
        Gets the style of this column. You have to call Column.ApplyStyle() method to save your changing with the row style, otherwise it will not effect.
      • isCollapsed/setCollapsed : boolean 

        function isCollapsed() / function setCollapsed(value)
        
        whether the column is collapsed
    • Method Detail

      • applyStyle

        function applyStyle(style, flag)
        Applies formats for a whole column.
        Parameters:
        style: Style - The style object which will be applied.
        flag: StyleFlag - Flags which indicates applied formatting properties.