Problems in cache

Topics: Developer Forum
Nov 9, 2011 at 6:29 AM
Edited Nov 9, 2011 at 7:30 AM

Hello all,

I have a some problem with caching. Here is my code, input xls file have 5000 rows and 7 columns.

 

<?php

echo date('H:i:s') . " Write to CSV format\n";

set_include_path(get_include_path() . PATH_SEPARATOR .
'/home/localhost/www/Classes/');

include_once 'PHPExcel.php';
include_once 'PHPExcel/IOFactory.php';

$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
$cacheSettings = array( ' memoryCacheSize '  => '8MB' );
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);

$objPHPExcel = PHPExcel_IOFactory::load("xls/nprice.xls");
$objPHPExcel->setActiveSheetIndex(0);
$aSheet = $objPHPExcel->getActiveSheet();

$aSheet->removeColumn('D');
$aSheet->removeColumn('E');
$aSheet->removeColumn('F');
$aSheet->removeColumn('H');
$aSheet->removeColumn('D');

$aSheet->setCellValue('A6', "product_sku");
$aSheet->setCellValue('B6', "product_s_desc");
$aSheet->setCellValue('C6', "product_price");
$aSheet->setCellValue('D6', "product_manufaqturer");

$aSheet->unmergeCells('A1:E1');
$aSheet->unmergeCells('A2:E2');
$aSheet->unmergeCells('A3:E3');
$aSheet->unmergeCells('A4:E4');
$aSheet->unmergeCells('A5:E5');

$aSheet->removeRow(1);
$aSheet->removeRow(1);
$aSheet->removeRow(1);
$aSheet->removeRow(1);
$aSheet->removeRow(1);

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')
    ->setDelimiter('^')
    ->setEnclosure('~')
    ->setLineEnding("\r\n")
    ->setSheetIndex(0)
    ->save(str_replace('.php', '.csv', __FILE__));
    
echo date('H:i:s') . " Done writing files.\r\n";
?>

 

But my browser writing an error:

Fatal error: Call to a member function getCellCacheController() on a non-object in W:\home\localhost\www\Classes\PHPExcel\Cell.php on line 107

Whats wrong?