Re: I've got a question about Spreadsheet Excel.

From: Date: Tue, 25 Oct 2005 08:02:58 +0000
Subject: Re: I've got a question about Spreadsheet Excel.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21628@lists.php.net to get a copy of this message
sunho baek wrote:
In the below, that is my test page that is same example codes on the pear site. I only appended one line. (echo "Test!!";) But, I couldn't see "Test!!" on the web page. Spreadsheet_Excel_Writer is sending an excel http header not a html header when it sends the excel file. I'm not sure how Spreadsheet_Excel_Writer works internally, but it probably has output buffering on, so the text you echoed isn't sent until the headers have been sent, in which case they will never be displayed in your web browser.
Simply you can't send the file and html text in the same request. Aaron
----------- test page --------------- <?php echo "Test!!"; require_once("../config.php"); require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer(); $format_bold =& $workbook->addFormat(); $format_bold->setBold(); $format_bold->setAlign("right"); $format_title =& $workbook->addFormat(); $format_title->setBold(); $format_title->setSize(15); // let's merge //$format_title->setAlign('merge'); $worksheet =& $workbook->addWorksheet(); $worksheet->write(0, 0, "Quarterly Profits for Dotcom.Com", $format_title); // Couple of empty cells to make it look better $worksheet->write(0, 1, "", $format_title); $worksheet->write(0, 2, "", $format_title); $worksheet->write(2, 0, "Quarter", $format_bold); $worksheet->write(2, 1, "Profit", $format_bold); $worksheet->write(3, 0, "Q1"); $worksheet->write(3, 1, 0); $worksheet->write(4, 0, "Q2"); $worksheet->write(4, 1, 0); $workbook->send('test.xls'); $workbook->close(); ?> ----------- test page --------------- -- * --------------------------------------------------------------- * Sun Ho, Baek KOICA Volunteer


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