Page 1 of 1

PEAR Excel writer

Posted: Mon Sep 11, 2006 4:45 am
by neuron
Hi all, :)

I am having problem using PEAR Excel writer class. I have installed PEAR Spreadsheet_Excel_Writer package on my hosting server using PEAR web frontend tool and tried to run the following sample code:

Code: Select all

<?php
require_once 'Spreadsheet/Excel/Writer.php';

// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer('test.xls');

// 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();
?>
But I get errors like:

Warning: main(Spreadsheet/Excel/Writer/Workbook.php): failed to open stream: No such file or directory in
my path/test/PEAR/PEAR/Spreadsheet/Excel/Writer.php on line 35

Fatal error: main(): Failed opening required 'Spreadsheet/Excel/Writer/Workbook.php' (include_path='.:/usr/local/lib/php') in my path/test/PEAR/PEAR/Spreadsheet/Excel/Writer.php on line 35


Something wrong with my PEAR config? :? Please help me.

Thanks a lot in advance.

Posted: Mon Sep 11, 2006 3:03 pm
by feyd
It would appear your include path(s) are not set correctly to have PEAR.