aspose.cells

Class ColumnCollection

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

//Change the default width of first ten columns
for (var i = 0; i < 10; i++)
{
    worksheet.getCells().getColumns().get(i).setWidth(20);
}

//Get the Column with non default formatting
var columns = worksheet.getCells().getColumns();
for (var o = columns.iterator(); o.hasNext();)
{
    var 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
functiongetCount()
functionget(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
functionadd(value)
Reserved for internal use.
functionclear()
functioncontains(value)
Reserved for internal use.
functionget(index)
Reserved for internal use.
functiongetByIndex(index)
Gets the column object by the index.
functiongetColumnByIndex(index)
Gets the Column object by the position in the list.
functionindexOf(value)
Reserved for internal use.
functioniterator()
functionremoveAt(index)
 

    • Property Getters/Setters Detail

      • getCount : Number 

        function getCount()
        
      • get : Column 

        function 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

        function 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: Number -
        Returns:
        Returns the column object.
      • getColumnByIndex

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

        function clear()
      • removeAt

        function removeAt(index)
      • iterator

        function iterator()
      • get

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

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

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

        function indexOf(value)
        Reserved for internal use.