Example:
//Instantiating a Workbook object //Instantiating a Workbook object $workbook = new cells\Workbook(); //Obtaining the reference of the first worksheet $worksheet = $workbook->getWorksheets()->get(0); $style = $workbook->createStyle(); //Setting the background color to Blue $style->setBackgroundColor(cells\Color::getBlue()); //Setting the foreground color to Red $style->setForegroundColor(cells\Color::getRed()); //setting Background Pattern $style->setPattern(cells\BackgroundType::DIAGONAL_STRIPE); //New Style Flag $styleFlag = new cells\StyleFlag(); //Set All Styles $styleFlag->setAll(true); //Get first Column $column = $worksheet->getCells()->getColumns()->get(0); //Apply Style to first Column $column->applyStyle($style, $styleFlag);
Property Getters/Setters Summary | ||
---|---|---|
function | getGroupLevel() | |
function | setGroupLevel(value) | |
Gets the group level of the column. | ||
function | hasCustomStyle() | |
Indicates whether this column has custom style settings(different from the default one inherited from workbook).
|
||
function | getIndex() | |
Gets the index of this column.
|
||
function | isCollapsed() | |
function | setCollapsed(value) | |
whether the column is collapsed | ||
function | isHidden() | |
function | setHidden(value) | |
Indicates whether the column is hidden. | ||
function | getWidth() | |
function | setWidth(value) | |
Gets and sets the column width in unit of characters. |
Method Summary | ||
---|---|---|
function | applyStyle(style, flag) | |
Applies formats for a whole column.
|
||
function | getStyle() | |
Gets the style of this column.
|
||
function | setStyle(style) | |
Sets the style of this column.
|
function getIndex()
function getWidth() / function setWidth(value)
function getGroupLevel() / function setGroupLevel(value)
function isHidden() / function setHidden(value)
function hasCustomStyle()
function isCollapsed() / function setCollapsed(value)
function applyStyle(style, flag)
style: Style
- The style object which will be applied.flag: StyleFlag
- Flags which indicates applied formatting properties.function getStyle()
function setStyle(style)
style: Style
- the style to be used as the default style for cells in this column.