Hi,
I'd like to use spreadsheet-excel-writer.p
hp, but it's not working! :-(
http://pear.php.net/manual/de/package.fileformats.spreadsheet-excel-writer.php
I tried to implement the following example:
<?php
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('M
y 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();
?>
But unfortunately, the excel file is empty! The file opens and the filename "test.xls" appears (as it should), but the fields are empty. There is no php error, so where's the problem?
Here my example:
http://web182.theta.ibone.ch/adressliste.temp/test5.php
Thanks a lot!
$workbook->send('test.xls'
like this
<?php
require_once 'Spreadsheet/Excel/Writer.
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer()
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('M
// 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);
// sending HTTP headers to the browser
$workbook->send('test.xls'
// Let's close the file
$workbook->close();
?>
You can find more information here.
http://www.php-editors.com/pear_manual/p_package.fileformats.spreadsheet-excel-writer.intro-format.html
figure 29-4 gives a good example