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")
Property Getters/Setters Summary | ||
---|---|---|
method | getCount() | |
method | get(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 | ||
---|---|---|
method | add(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | clear() | → inherited from CollectionBase |
method | contains(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | get(index) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | getByIndex(index) | |
Gets the column object by the index. | ||
method | getColumnByIndex(index) | |
Gets the |
||
method | indexOf(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | iterator() | → inherited from CollectionBase |
method | removeAt(index) | → inherited from CollectionBase |
Property Getters/Setters Detail |
---|
getCount : int | |
int getCount() |
get : Column | |
Column get(columnIndex) |
Method Detail |
---|
getByIndex | |
Column getByIndex(index) |
index: int
- getColumnByIndex | |
Column getColumnByIndex(index) |
index: int
- The position in the list.clear | |
clear() |
removeAt | |
removeAt(index) |
iterator | |
Iterator iterator() |
get | |
Object get(index) |
contains | |
boolean contains(value) |
add | |
int add(value) |
indexOf | |
int indexOf(value) |