Help with Spreadsheet_Excel_Writer

From: Date: Thu, 09 Oct 2008 08:37:11 +0000
Subject: Help with Spreadsheet_Excel_Writer
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29321@lists.php.net to get a copy of this message
Hello everyone, I am new to Pear and I have a couple of newbie questions. I would like to know why does the first example (Example 43-1. Typical usage) in the end user documentation doesn't work and the second one does. I don't understand really what the difference is. Is this an error in the documentation? or have I make a mistake in the configuration form Pear? Thank you for your help. Sincerely, Rodolfo Rieckhof Here is the code to example Example 43-1 (doesn't work) <?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('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(); ?> Example 43-2. Saving to a regular file (this works) <?php require_once 'Spreadsheet/Excel/Writer.php'; // We give the path to our file here $workbook = new Spreadsheet_Excel_Writer('test.xls'); $worksheet =& $workbook->addWorksheet('My first worksheet'); $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); // We still need to explicitly close the workbook $workbook->close(); ?>

« previous php.pear.general (#29321) next »