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 object by column index. The Column object of given column index will be instantiated if it does not exist before. | ||
| Method Summary | ||
|---|---|---|
function | add(value) | → inherited from CollectionBase |
| Reserved for internal use. | ||
function | clear() | → inherited from CollectionBase |
function | contains(value) | → inherited from CollectionBase |
| Reserved for internal use. | ||
function | get(index) | → inherited from CollectionBase |
| Reserved for internal use. | ||
function | getByIndex(index) | |
| Gets the column object by the index. | ||
function | getColumnByIndex(index) | |
|
Gets the |
||
function | indexOf(value) | → inherited from CollectionBase |
| Reserved for internal use. | ||
function | iterator() | → inherited from CollectionBase |
function | removeAt(index) | → inherited from CollectionBase |
| Property Getters/Setters Detail |
|---|
getCount : Number | |
function getCount() | |
get : Column | |
function get(columnIndex) | |
| Method Detail |
|---|
getByIndex | |
function getByIndex(index) | |
index: Number - getColumnByIndex | |
function getColumnByIndex(index) | |
index: Number - The position in the list.clear | |
function clear() | |
removeAt | |
function removeAt(index) | |
iterator | |
function iterator() | |
get | |
function get(index) | |
contains | |
function contains(value) | |
add | |
function add(value) | |
indexOf | |
function indexOf(value) | |