asposecells.api

Class ColumnCollection

Collects the objects that represent the individual columns 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.setForegroundColor(Color.getBlue())
# setting Background Pattern
style.setPattern(BackgroundType.SOLID)
# New Style Flag
styleFlag = StyleFlag()
# Set All Styles
styleFlag.setAll(True)

# Change the default width of first ten columns
for i in range(0, 10):
    worksheet.getCells().getColumns().get(i).setWidth(20)

# Get the Column with non default formatting
columns = worksheet.getCells().getColumns()
o = columns.iterator()
while o.hasNext():
    column = o.next()
    # Apply Style to first ten Columns
    column.applyStyle(style, styleFlag)

# Saving the Excel file
workbook.save("Book1.xls")
See Also:
Column

Property Getters/Setters Summary
methodgetCount()
methodget(columnIndex)
Gets a object by column index. The Column object of given column index will be instantiated if it does not exist before.
 
Method Summary
methodadd(value)
Reserved for internal use.
methodclear()
methodcontains(value)
Reserved for internal use.
methodget(index)
Reserved for internal use.
methodgetByIndex(index)
Gets the column object by the index.
methodgetColumnByIndex(index)
Gets the Column object by the position in the list.
methodindexOf(value)
Reserved for internal use.
methoditerator()
methodremoveAt(index)
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
      • get : Column 

        Column get(columnIndex)
        
        Gets a object by column index. The Column object of given column index will be instantiated if it does not exist before.
        See Also:
        Column
    • Method Detail

      • getByIndex

        Column getByIndex(index)
        Gets the column object by the index. NOTE: This member is now obsolete. Instead, please use Columns.GetColumnByIndex() method. This property will be removed 12 months later since June 2010. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        index: int -
        Returns:
        Returns the column object.
      • getColumnByIndex

        Column getColumnByIndex(index)
        Gets the Column object by the position in the list.
        Parameters:
        index: int - The position in the list.
        Returns:
        Returns the column object.
      • clear

         clear()
      • removeAt

         removeAt(index)
      • iterator

        Iterator iterator()
      • get

        Object get(index)
        Reserved for internal use.
      • contains

        boolean contains(value)
        Reserved for internal use.
      • add

        int add(value)
        Reserved for internal use.
      • indexOf

        int indexOf(value)
        Reserved for internal use.