[CLOSED] Unable to setReadFilter

Topics: Developer Forum, User Forum
Jun 28, 2012 at 11:27 AM
Edited Jun 28, 2012 at 1:21 PM

Hi,

I have a huge Excel (55 Mb) file to read and it does'nt load because of memory limitations.

After spending 2 days reading all possible tricks, I try to implement filtering but it does'nt seem to work.

My code :

class chunkReadFilter implements PHPExcel_Reader_IReadFilter {
  public function readCell($column, $row, $worksheetName = '') {
    print "I'm in the filter\n";
    return false;
  }
}

$objReader  = PHPExcel_IOFactory::createReader("Excel5");
$objReader->setReadDataOnly(true);
$objReader->setReadFilter(new chunkReadFilter());

$objPhpExcel = $objReader->load($filename);
$objWorksheet = $objPhpExcel->getActiveSheet();

// Do the job

 

As my filter returns always false, It should run but still I have a memory problem (crash at load time).

I return false because I have the feeling that it does not walk through my filter.

What am I doing wrong?

 

Regards,

Olivier

 

Conf : PHP 5.2.9 and PhpExcel 1.7.7

 

EDIT : Sorry for this message. It worked fine. It was just that someone corrupted my Excel file and I did'nt recheck it. Now that I have a correct file, the script walks correctly through the filter.