CodeIgniter Forums

Full Version: Download excelsheet error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

hello ,
i m trying download data into excelsheet with codeigniter i follow following steps which i found in following link

1. enable hooks in config fle.
2. create 'my_classes' folder in system/application & copy & classes(excel) folder in that.
3. in config/hooks.php i wriiten folleing code.
$hook['pre_controller'][] = array(
'class' => 'MyClasses',
'function' => 'index',
'filename' => 'MyClasses.php',
'filepath' => 'hooks'
4. in hook folder i created MyClasses.php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Myclasses
* includes the directory application\my_classes\Classes in your includes directory
function index()
//includes the directory application\my_classes\Classes\
ini_set('include_path', ini_get('include_path').':'.BASEPATH.'application/my_classes/Classes/');
in controller i wrte follwing code.

class Writeexcel extends Controller
function Writeexcel()

function testexcel()
include 'PHPExcel.php';
/** PHPExcel_Writer_Excel2007 */
include 'PHPExcel/Writer/Excel5.php';

// Create new PHPExcel object
echo date('H:iConfused') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

when i run controller it gives me follwing eroor

Message: Writeexcel::include(PHPExcel.php) [function.Writeexcel-include]: failed to open stream: No such file or directory

Filename: controllers/writeexcel.php

Line Number: 11

Message: Writeexcel::include() [function.include]: Failed opening ‘PHPExcel.php’ for inclusion (include_path=’.;C:\php5\pear:C:\Program Files\Apache Group\Apache2\htdocs\Mysimpleprofit/system/application/my_classes/Classes/’)

Filename: controllers/writeexcel.php

Line Number: 11

Class ‘PHPExcel’ not found in C:\Program Files\Apache Group\Apache2\htdocs\Mysimpleprofit\system\application\controllers\writeexcel.php on line 17

Please tell me how to resolve these error. i have tried lot. but enable to solve errors...

El Forum

put all the files in the application instead of the system files and then do the bleow i have done

ini_set('include_path', ini_get('include_path').':'.BASEPATH.'application/my_classes/Classes/');

remove the BASEPATH from the above.that's it
i was also getting the same problem i just did what i have written in the answer, and it worked