previousWorkbook::&addWorksheet (Previous) (Next) Workbook::setCountrynext

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

Workbook::&addFormat

Workbook::&addFormat – Excel ワークブックに新しい書式を追加する

Synopsis

require_once "Spreadsheet/Excel/Writer.php";

object reference Workbook::&addFormat ( array $properties=array() )

Description

Excel ワークブックに新しい書式を追加します。 さらに任意のフォーマットプロパティを書式のコンストラクタに渡します。 有効なプロパティは下記の通りです。

  • Align

  • Bold

  • Bottom

  • Top

  • Left

  • Right

  • Border

  • BorderColor

  • BottomColor

  • TopColor

  • RightColor

  • LeftColor

  • FgColor

  • BgColor

  • Color

  • Pattern

  • Underline

  • TextRotation

  • Size

  • NumFormat

  • Script

Parameter

  • array $properties - 書式の初期化の為のプロパティの配列を指定します。

Return value

object reference - Excel の書式へのリファレンスを返します。

Note

This function can not be called statically.

Example

&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(10"Magenta Hello"$format);
$workbook->close();
?>
previousWorkbook::&addWorksheet (Previous) (Next) Workbook::setCountrynext

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: alex@angelov.co.uk
You can also set the 'locked' format property using &addFormat(). This can be done in the same way like 'bold' by assigning to 'locked' a value of 1.
$format =& $workbook->addFormat(array('locked' => 1));
Note by: Elliott Brueggeman
Properties that don't have obvious arguments, such as bold and underline, require a value of 1 in the array to make them function properly.

Example:

(to make a format bold and underlined)

$myFormat=&$workbook->addFormat(
array('bold'=>1,
'underline'=>1 ));