spreadsheet_excel_writer Cannot modify header information error
| From: | David Shumway | Date: | Wed, 04 Oct 2006 03:52:24 +0000 |
| Subject: | spreadsheet_excel_writer Cannot modify header information error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-25338@lists.php.net to get a copy of this message | ||
Hi,
This is my first time using pear so I'm not totally sure about all this.
Basically, I'm trying to use spreadsheet_excel_writer to create xls files.
So I installed pear and then installed OLE-0.5 and spreadsheet_excel_writer
0.9.1. I'm running php version 4.4.4.
Here's my code:
<?php
phpinfo();
require_once 'Spreadsheet/Excel/Writer.php';
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// sending HTTP headers
$workbook->send('test.xls');
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('My first worksheet');
// The actual data
$worksheet->write(0, 0, 'Name');
$worksheet->write(0, 1, 'Age');
$worksheet->write(1, 0, 'John Smith');
$worksheet->write(1, 1, 30);
$worksheet->write(2, 0, 'Johann Schmidt');
$worksheet->write(2, 1, 31);
$worksheet->write(3, 0, 'Juan Herrera');
$worksheet->write(3, 1, 32);
// Let's send the file
$workbook->close();
?>
When I run this I get the following error:
*Warning*: Cannot modify header information - headers already sent by
(output started at C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\test.php:2) in *
C:\PHP\pear\Spreadsheet\Excel\Writer.php* on line *67
*and then below this a bunch of weird characters. Can you help? Thanks. :)