For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > Problem Getting Spreadsheet_Excel_Writer to Work









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem Getting Spreadsheet_Excel_Writer to Work
troyhartman

2005-05-11, 1:19 pm

Pear newbie here...running PHP 4.2.2 on apache and recently installed the Pear OLE and the Pear Spreadsheet_Excel_Writer modules. I copied and pasted the basic sample code posted in many tutorials (see attached text file) and all I am getting is gibberish (see attached text file) in my IE browser. Any help would be greatly appreciated.
troyhartman

2005-05-11, 1:24 pm

quote:
Originally posted by troyhartman
Pear newbie here...running PHP 4.2.2 on apache and recently installed the Pear OLE and the Pear Spreadsheet_Excel_Writer modules. I copied and pasted the basic sample code posted in many tutorials (see attached text file) and all I am getting is gibberish (see attached text file) in my IE browser. Any help would be greatly appreciated.


Code:
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();
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com