Format::setBgColor
Synopsis
void Format::setBgColor (
mixed $color
)
Description
Sets the cell's "background color".
The term "background color" is misleading. Here, "background" means the bottom layer of a cell's background.
This method only comes into play when creating patterns via the setPattern() method. In general, chances are you are more interested in using the setFgColor() method.
The example entitled "How background and foreground colors interact with patterns" is very helpful.
Parameter
-
mixed
$color
- either a string (like 'blue'), or an integer (range is [8...63]).Please see the "Using colors" section of the manual for more information.
Note
This function can not be called statically.
Example
Using setBgColor()
<?php
require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer();
$worksheet =& $workbook->addWorksheet('testing bg color');
$worksheet->setRow(1, 30);
$format6 =& $workbook->addFormat();
$format6->setBgColor('green');
$format6->setPattern(6);
$worksheet->write(1, 1, 'the bg', $format6);
$workbook->send('setBgColor.xls');
$workbook->close();
?>