public class Column
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
Style style = workbook.createStyle();
//Setting the background color to Blue
style.setBackgroundColor(Color.getBlue());
//Setting the foreground color to Red
style.setForegroundColor(Color.getRed());
//setting Background Pattern
style.setPattern(BackgroundType.DIAGONAL_STRIPE);
//New Style Flag
StyleFlag styleFlag = new StyleFlag();
//Set All Styles
styleFlag.setAll(true);
//Get first Column
Column column = worksheet.getCells().getColumns().get(0);
//Apply Style to first Column
column.applyStyle(style, styleFlag);
//Saving the Excel file
workbook.save("D:\\book1.xls");
Property Getters/Setters Summary | ||
---|---|---|
byte | getGroupLevel() | |
Gets the group level of the column.
|
||
int | getIndex() | |
Gets the index of this column.
|
||
boolean | isHidden() | |
void | setHidden(booleanvalue) | |
Indicates whether the column is hidden. | ||
Style | getStyle() | |
Gets the style of this column.
|
||
double | getWidth() | |
void | setWidth(doublevalue) | |
Gets and sets the column width in unit of characters. |
Method Summary | ||
---|---|---|
void | applyStyle(Style style, StyleFlag flag) | |
Applies formats for a whole column.
|
public int getIndex()
public double getWidth() / public void setWidth(double value)
public byte getGroupLevel()
public boolean isHidden() / public void setHidden(boolean value)
public Style getStyle()