com.aspose.cells
Class ColumnCollection

java.lang.Object
  extended by CollectionBase
      extended by com.aspose.cells.ColumnCollection
All Implemented Interfaces:
com.aspose.cells.c.b.a.a.a.c.b.e

public class ColumnCollection 
extends CollectionBase

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

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

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

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

//Setting the background color to Blue
style.setForegroundColor(Color.getBlue());

//setting Background Pattern
style.setPattern(BackgroundType.SOLID);

//New Style Flag
StyleFlag styleFlag = new StyleFlag();

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

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

//Get the Column with non default formatting
ColumnCollection columns = worksheet.getCells().getColumns();

for (Column column : (Iterable<Column>) columns)
{
    //Apply Style to first ten Columns
    column.applyStyle(style, styleFlag);
}

//Saving the Excel file
workbook.save("D:\\book1.xls");
See Also:
Column

Property Getters/Setters Summary
intgetCount()→ inherited from com.aspose.cells.CollectionBase
          
Columnget(int 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
intadd(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
voidclear()→ inherited from com.aspose.cells.CollectionBase
          
booleancontains(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
java.lang.Objectget(int index)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
ColumngetByIndex(int index)
           Gets the column object by the index.
ColumngetColumnByIndex(int index)
           Gets the Column object by the position in the list.
intindexOf(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
java.util.Iteratoriterator()→ inherited from com.aspose.cells.CollectionBase
          
voidremoveAt(int index)→ inherited from com.aspose.cells.CollectionBase
          
 

Property Getters/Setters Detail

getCount

→ inherited from com.aspose.cells.CollectionBase
public int getCount()

get

public Column get(int 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

public Column getByIndex(int 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 -
Returns:
Returns the column object.

getColumnByIndex

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

clear

→ inherited from com.aspose.cells.CollectionBase
public void clear()

removeAt

→ inherited from com.aspose.cells.CollectionBase
public void removeAt(int index)

iterator

→ inherited from com.aspose.cells.CollectionBase
public java.util.Iterator iterator()

get

→ inherited from com.aspose.cells.CollectionBase
public java.lang.Object get(int index)
Reserved for internal use.

contains

→ inherited from com.aspose.cells.CollectionBase
public boolean contains(java.lang.Object value)
Reserved for internal use.

add

→ inherited from com.aspose.cells.CollectionBase
public int add(java.lang.Object value)
Reserved for internal use.

indexOf

→ inherited from com.aspose.cells.CollectionBase
public int indexOf(java.lang.Object 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.