|
Posted by sumana.m21 on 10/08/07 18:41
On Oct 4, 7:13 am, "Paul" <l...@invalid.com> wrote:
> When I try examples from the docs, it writes out a 0 byte *.xls file. For
> example:
> <?php
> require_once 'Spreadsheet/Excel/Writer.php';
> $workbook = new Spreadsheet_Excel_Writer();
>
> $format_bold =& $workbook->addFormat();
> $format_bold->setBold();
>
> $format_title =& $workbook->addFormat();
> $format_title->setBold();
> $format_title->setColor('yellow');
> $format_title->setPattern(1);
> $format_title->setFgColor('blue');
>
> $worksheet =& $workbook->addWorksheet();
> $worksheet->write(0, 0, "Quarterly Profits for Dotcom.Com", $format_title);
> // While we are at it, why not throw some more numbers around
> $worksheet->write(1, 0, "Quarter", $format_bold);
> $worksheet->write(1, 1, "Profit", $format_bold);
> $worksheet->write(2, 0, "Q1");
> $worksheet->write(2, 1, 0);
> $worksheet->write(3, 0, "Q2");
> $worksheet->write(3, 1, 0);
>
> $workbook->send('test.xls');
> $workbook->close();
> ?>My installation is:
> PHP 4.3
> OpenOffice 2.3 (but it doesn't open in MS Excel either)
> OLE 0.5 beta
> Spreadsheet_Excel_Writer 0.9.1 beta
>
> Any ideas what's going wrong?
Yeah you need to specify a filename for the Spreadsheet_Excel_Writer
$workbook = new Spreadsheet_Excel_Writer('filename');
Navigation:
[Reply to this message]
|