Example:
//Instantiating a Workbook object
$workbook = new cells\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(cells\Color::getBlue());
//setting Background Pattern
$style->setPattern(cells\BackgroundType::SOLID);
//New Style Flag
$styleFlag = new cells\StyleFlag();
//Set All Styles
$styleFlag->setAll(true);
//Change the default width of first ten columns
for ($i = 0; $i < 10; $i++)
{
$worksheet->getCells()->getColumns()->get($i)->setWidth(20);
}
//Get the Column with non default formatting
$columns = $worksheet->getCells()->getColumns();
for ($o = $columns->iterator(); java_values($o->hasNext());)
{
$column = $o->next();
echo "Apply style to column-".$column->getIndex()."\n";
//Apply Style to first ten Columns
$column->applyStyle($style, $styleFlag);
}
| Property Getters/Setters Summary | ||
|---|---|---|
function | getCount() | |
function | get(columnIndex) | |
Gets a |
||
| Method Summary | ||
|---|---|---|
function | add(value) | |
Reserved for internal use. |
||
function | clear() | |
function | contains(value) | |
Reserved for internal use. |
||
function | get(index) | |
Reserved for internal use. |
||
function | getByIndex(index) | |
Gets the column object by the index.
|
||
function | getColumnByIndex(index) | |
Gets the |
||
function | indexOf(value) | |
Reserved for internal use. |
||
function | iterator() | |
function | removeAt(index) | |
function getCount()
function get(columnIndex)
function getByIndex(index)
index: Number - function getColumnByIndex(index)
index: Number - The position in the list.function clear()
function removeAt(index)
function iterator()
function get(index)
function contains(value)
function add(value)
function indexOf(value)