using cache with copy or clone bug?

Aug 8, 2010 at 3:23 PM

I am trying to use a template sheet that I load for multiple sheets in a resulting workbook.

    // The template excel file, with the template in it's only sheet

    $objTemplate = PHPExcel_IOFactory::load($template);
    $templateSheet = $objTemplate->setActiveSheetIndex(0);     

    // the result workbook
    $objPHPExcel = new PHPExcel();
   
    // foreach project copy the template sheet and then fill in the details
    foreach ($projects as $aproject)
    {
      $cloneSheet = $templateSheet->copy();     
      $cloneSheet->SetTitle($aProject['Project']['Project']['name']);
      $newSheet = $objPHPExcel->addExternalSheet($cloneSheet);
      // fill in the data for the $newSheet here, etc...
    }

 

This results in a cache error after the copy where the DiscISAM cache is referencing a zero file descriptor ala

 

storing -- Resource id #1488  (<-- some debugging I added)
storing -- 0
Warning (2): fseek(): supplied argument is not a valid stream resource [APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 46]
Code
fseek - [internal], line ??
PHPExcel_CachedObjectStorage_DiscISAM::_storeData() - APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 46
PHPExcel_CachedObjectStorage_DiscISAM::getCacheData() - APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 87
PHPExcel_Worksheet::getCell() - APP\vendors\PHPExcel\Worksheet.php, line 910
PHPExcel::addExternalSheet() - APP\vendors\PHPExcel.php, line 437
ExcelExporter::exportProject() - APP\vendors\excel_exporter.php, line 326
ProjectsController::project_report() - APP\controllers\projects_controller.php, line 758
Object::dispatchMethod() - CORE\cake\libs\object.php, line 118
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88
Warning (2): ftell(): supplied argument is not a valid stream resource [APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 47]
Code
ftell - [internal], line ??
PHPExcel_CachedObjectStorage_DiscISAM::_storeData() - APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 47
PHPExcel_CachedObjectStorage_DiscISAM::getCacheData() - APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 87
PHPExcel_Worksheet::getCell() - APP\vendors\PHPExcel\Worksheet.php, line 910
PHPExcel::addExternalSheet() - APP\vendors\PHPExcel.php, line 437
ExcelExporter::exportProject() - APP\vendors\excel_exporter.php, line 326
ProjectsController::project_report() - APP\controllers\projects_controller.php, line 758
Object::dispatchMethod() - CORE\cake\libs\object.php, line 118
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88
Warning (2): fwrite(): supplied argument is not a valid stream resource [APP\vendors\PHPExcel\CachedObjectStorage\DiscISAM.php, line 48]


Any ideas? suggestions? is there a better way to do this? I am fairly sure the problem has to do with something in the copy or clone that I am trying to do.

Thanks
Ken
Coordinator
Aug 14, 2010 at 12:21 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Aug 20, 2010 at 1:15 PM

Fixed in latest SVN code