java.lang.Object
CollectionBase
com.aspose.cells.ColumnCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class ColumnCollection
- extends CollectionBase
Collection of the objects that represent the individual column(setting)s in a worksheet.
The Column object only represents the settings such as column width, styles, .etc. for the whole column,
has nothing to do with the fact that there are non-empty cells(data) or not in corresponding column.
And the "Count" of this collection only represents the count Column objects that have been instantiated in this collection,
has nothing to do with the fact that there are non-empty cells(data) or not in the 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.createStyle();
//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 |
int | getCount() | → inherited from com.aspose.cells.CollectionBase
|
| |
Column | get(int) | |
|
Gets a object by column index.
The Column object of given column index will be instantiated if it does not exist before.
|
|
Method Summary |
int | add(java.lang.Object value) | → inherited from com.aspose.cells.CollectionBase
|
| Reserved for internal use. |
void | clear() | → inherited from com.aspose.cells.CollectionBase
|
| |
boolean | contains(java.lang.Object value) | → inherited from com.aspose.cells.CollectionBase
|
| Reserved for internal use. |
Column | getByIndex(int index) | |
|
Gets the column object by the index.
|
Column | getColumnByIndex(int index) | |
|
Gets the Column object by the position in the list.
|
int | indexOf(java.lang.Object value) | → inherited from com.aspose.cells.CollectionBase
|
| Reserved for internal use. |
java.util.Iterator | iterator() | → inherited from com.aspose.cells.CollectionBase
|
| |
void | removeAt(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
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() |
-
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.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.