Note that there are some explanatory texts on larger screens.

plurals
  1. POClass 'PHPExcel_IOFactory' not found - CakePHP & PHPExcel
    primarykey
    data
    text
    <p><strong>Background</strong></p> <p>I have issues using PHPExcel's IOFactory in my app. My PHPExcel helper works if I want to generate an excel document from scratch (my app creates about 20 excel sheets per week, with no issues).</p> <p><strong>Why do you need It?</strong></p> <p>I need to now combine some sheets (uploaded and generated to a general sheet and then send that off to who-ever. Problem is that all the sheets are generated by a different person. So they upload all these sheets to the app, and it combines the sheets and sends it out.</p> <p><strong>What's the problem then?</strong></p> <p>In my <code>PHPExcelHelper.php</code> file, I've added the following function:</p> <pre><code>public function createMasterFile($ExcelFile) { $MasterFile = PHPExcel_IOFactory::load($ExcelFile); return $MasterFile; } </code></pre> <p>This is basically just supposed to take a file, to which it will add all the other files as spreadsheets. I'm using <a href="https://stackoverflow.com/questions/16801732/combine-two-or-more-xls-files-as-worksheets-phpexcel">this</a> question as a guide.</p> <p>However, it throws the following error:</p> <pre><code>Error: Class 'PHPExcel_IOFactory' not found </code></pre> <p>This tells me that it can't find that class (<em>duh</em>) and that I need to include it.</p> <p><strong>What have you tried?</strong></p> <p>I've tried to add it directly by adding <code>require_once('PHPExcel/IOFactory.php');</code> to the end of the <code>PHPExcel.php</code> file located in the <code>Vendors</code>-folder. No luck.</p> <p>Then I tried adding it to my <code>loadEssentials()</code>-function in my <code>PHPExcelHelper.php</code>-file, which was like <a href="https://stackoverflow.com/a/14849526/1238303">this one</a> and then I just added this:</p> <pre><code>App::import('Vendor', 'PHPExcel/IOFactory'); if (!class_exists('PHPExcel/IOFactory')) { throw new CakeException('Vendor class IOFactory not found!'); } </code></pre> <p>No luck.</p> <p>And I've also tried calling it by using <code>public $helpers = array('PHPExcel','PHPExcel/IOFactory');</code> in my Controller, but this just asked for a helper which didn't exist. So that also gave me no luck.</p> <p><strong>What do you want from us?</strong></p> <p>Any assistance in getting this to work really. I have tried what I thought would be the logical ways to include IOFactory, but have had no success. Could someone please show me how to get PHPExcel's IOFactory to work?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload