Spreadsheet_Excel_Writer problem
| From: | Ammar Ibrahim | Date: | Thu, 06 Jan 2005 03:09:25 +0000 |
| Subject: | Spreadsheet_Excel_Writer problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16718@lists.php.net to get a copy of this message | ||
I'm using Spreadsheet_Excel_Writer to generate a simple spreadsheet. When I test my code on my local server everything worked just fine, but when I uploaded the script to the remote host it keeps sending 0 bytes. And excel generates an error "unable to read file". I don't think there's a problem with the code, I think it has to do with the webserver, any clue guys?
Ammar Ibrahim
Anyway, here's the code
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('prices');
$row = 0;
foreach( $prices as $price ){
// The actual data, 2 columns, first netcoms code, second product retail price
$worksheet->write($row, 0, $price->netcoms_code);
$worksheet->write($row, 1, $price->retail_price);
++$row;
}
// sending HTTP headers
$workbook->send( 'db_extract.xls');
// Let's send the file
$workbook->close();