Why is PHPExcel trying to create a class name from an Excel file name when used internally by Kohana?

I am trying to create a PHPExcel library in an application built with the Kohana framework .

In a test application outside the Kohana framework, I can perfectly create and read Excel files.

And inside the Kohana application, creating the file works:

$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Test Generator")
    ->setTitle("Test Excel5 File");
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->setTitle('Test Sheet');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('test123.xls'); //created in the root directory of application

However, when inside the Kohana structure, when I try to read a file using this code:

$objReader = PHPExcel_IOFactory::createReader('test123.xls');

I get this error :

alt text

How can I prevent PHPExcel / Kohana from trying to create a class name from an Excel file name?

+3
1

createReader() (, Excel2007, Excel5, Excel2003XML, OOCalc, Gnumeric, CSV), .

// Use the IOFactory to instantiate a reader of the correct type
$objReader = PHPExcel_IOFactory::createReader('Excel5'); 
// Use the reader to load the file, and return a PHPExcel object
$objPHPExcel = $objReader->load('test123.xls'); 
+1

Source: https://habr.com/ru/post/1782577/


All Articles