aspose.cells

Class Column

Represents a single column in a worksheet.

Example:

//Instantiating a Workbook object
var workbook = new aspose.cells.Workbook();

//Obtaining the reference of the first worksheet
var worksheet = workbook.getWorksheets().get(0);

//Add new Style to Workbook
var style = workbook.getStyles().get(workbook.getStyles().add());

//Setting the background color to Blue
style.setBackgroundColor(aspose.cells.Color.getBlue());

//Setting the foreground color to Red
style.setForegroundColor(aspose.cells.Color.getRed());

//setting Background Pattern
style.setPattern(aspose.cells.BackgroundType.DIAGONAL_STRIPE);

//New Style Flag
var styleFlag = new aspose.cells.StyleFlag();

//Set All Styles
styleFlag.setAll(true);

//Get first Column
var column = worksheet.getCells().getColumns().get(0);

//Apply Style to first Column
column.applyStyle(style, styleFlag);

//Saving the Excel file
workbook.save("Book1.xls");

Property Getters/Setters Summary
functiongetGroupLevel()
Gets the group level of the column.
functiongetIndex()
Gets the index of this column.
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.
    • 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.