object reference Workbook::&addFormat (
array $properties=array()
)
Add a new format to the Excel workbook. Also, pass any properties to the Format constructor. Valid properties are:
Align
Bold
Bottom
Top
Left
Right
Border
BorderColor
BottomColor
TopColor
RightColor
LeftColor
FgColor
BgColor
Color
Pattern
Underline
TextRotation
Size
NumFormat
Script
array $properties
-
array with properties for initializing the format.
object reference
- to an Excel Format
This function can not be called statically.
Using &addFormat()
<?php
require_once "Spreadsheet/Excel/Writer.php";
$workbook = new Spreadsheet_Excel_Writer();
$format =& $workbook->addFormat(array('Size' => 10,
'Align' => 'center',
'Color' => 'white',
'Pattern' => 1,
'FgColor' => 'magenta'));
$worksheet =& $workbook->addWorksheet();
$worksheet->writeString(1, 0, "Magenta Hello", $format);
$workbook->close();
?>