aspose.cells
Class ColumnCollection

Collects the objects that represent the individual columns in a worksheet.

Example:

//Instantiating a Workbook object
$workbook = new cells\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(cells\Color::getBlue());
//setting Background Pattern
$style->setPattern(cells\BackgroundType::SOLID);
//New Style Flag
$styleFlag = new cells\StyleFlag();
//Set All Styles
$styleFlag->setAll(true);

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

//Get the Column with non default formatting
$columns = $worksheet->getCells()->getColumns();
for ($o = $columns->iterator(); java_values($o->hasNext());)
{
    $column = $o->next();
    echo "Apply style to column-".$column->getIndex()."\n";
    //Apply Style to first ten Columns
    $column->applyStyle($style, $styleFlag);
}
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)→ inherited from CollectionBase
          Reserved for internal use.
functionclear()→ inherited from CollectionBase
          
functioncontains(value)→ inherited from CollectionBase
          Reserved for internal use.
functionget(index)→ inherited from CollectionBase
          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)→ inherited from CollectionBase
          Reserved for internal use.
functioniterator()→ inherited from CollectionBase
          
functionremoveAt(index)→ inherited from CollectionBase
          
 

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.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.