PEAR Excel writer

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neuron
Forum Newbie
Posts: 1
Joined: Mon Sep 11, 2006 4:41 am

PEAR Excel writer

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It would appear your include path(s) are not set correctly to have PEAR.
Post Reply