Format::setColor
Format::setColor – Sets the color of a cell's content
Synopsis
require_once "Spreadsheet/Excel/Writer.php";
void Format::setColor (
mixed $color
)
Description
Sets the color of a cell's content
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 setColor()
<?php
require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer();
$worksheet = &$workbook->addWorksheet('SetColor');
for ($inc =0; $inc<64; $inc++) {
// Sets the color of a cell's content
$format = $workbook->addFormat();
$format->setColor($inc);
$worksheet->write($inc, 0, 'Color (index '.$inc.')', $format);
}
$workbook->send('setColor.xls');
$workbook->close();
?>