PEAR Manual
This manual is provided as a courtesy. It is not an official source. Please check pear.php.net for updated information.
require_once "Spreadsheet/Excel/Writer.php";
void Format::setBgColor (mixed $color)
void Format::setBgColor
Sets the cell's "background color".
The term "background color" is misleading. 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.
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.
This function can not be called statically.
Example 37-1. Using setBgColor()
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();
setFgColor(), setPattern(), setColor()