asposecells.api

Class Column

Represents a single column in a worksheet.

Example:

# Instantiating a Workbook object
workbook = Workbook()

# Obtaining the reference of the first worksheet
worksheet = workbook.getWorksheets().get(0)

# Add new Style to Workbook
style = workbook.createStyle()

# Setting the background color to Blue
style.setBackgroundColor(Color.getBlue())

# Setting the foreground color to Red
style.setForegroundColor(Color.getRed())

# setting Background Pattern
style.setPattern(BackgroundType.DIAGONAL_STRIPE)

# New Style Flag
styleFlag = 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)

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

Property Getters/Setters Summary
methodgetGroupLevel()
Gets the group level of the column.
methodgetIndex()
Gets the index of this column.
methodisHidden()
method
setHidden(value)
           Indicates whether the column is hidden.
methodgetStyle()
Gets the style of this column.
methodgetWidth()
method
setWidth(value)
           Gets and sets the column width in unit of characters.
 
Method Summary
methodapplyStyle(style, flag)
Applies formats for a whole column.
 

    • Property Getters/Setters Detail

      • getIndex : int 

        int getIndex()
        
        Gets the index of this column.
      • getWidth/setWidth : float 

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

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

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

        Style 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

         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.