previousFormat::setBgColor (Previous) (Next) Format::setPatternnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

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($inc0'Color (index '.$inc.')'$format);
}
$workbook->send('setColor.xls');
$workbook->close();
?>
previousFormat::setBgColor (Previous) (Next) Format::setPatternnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.