previousWorkbook::close (Previous) (Next) Workbook::&addFormatnext

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

Workbook::&addWorksheet

Workbook::&addWorksheet – Excel ワークブックに新しいワークシートを追加する

Synopsis

require_once "Spreadsheet/Excel/Writer.php";

object reference Workbook::&addWorksheet ( string $name='' )

Description

Excel ワークブックに新しいワークシートを追加します。 もし名前を指定しなかった場合は、ワークシート名は Sheeti になります (i には 1、2、3、…が入ります)。

Parameter

  • string $name - ワークシートの名前 (オプション)。 31 文字より長い名前は指定できません。

Return value

returns 成功した場合にワークシートオブジェクトへのリファレンス、 失敗した場合に PEAR_Error を返します。

Note

This function can not be called statically.

Example

&addWorksheet() の使用法

<?php
require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer('test.xls');
$worksheet =& $workbook->addWorksheet('My first worksheet');
if (
PEAR::isError($worksheet)) {
    die(
$worksheet->getMessage());
}
$workbook->close();
?>
previousWorkbook::close (Previous) (Next) Workbook::&addFormatnext

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: srfotograf@web.de
you also can not name a sheet in excel with a slash in it... so it is not a bug...
Note by: Kiezpro
Seems like the worksheet name can't contain a slash ... at least I got a "File Corrupt" message from Excel when I tried to open a generated Excel file containing a worksheet with a slash in it's name. My version of Spreadsheet_Excel_Writer is 0.91.