Load method fails on some .xls files

Topics: Developer Forum, User Forum
Apr 16, 2015 at 2:18 PM
Hi,

I am generating big .xls files in steps, meaning I first process writes 3000 records than a new process writes the next 3000 records ans so on.
This means that each process has to load the file and append to it.
Somewhere along the way a process fails to load the generated file and floods the error output with this type of errors :

Uninitialized string offset: 2315297283 on line 307 in file ...../phpoffice\/phpexcel\/Classes\/PHPExcel\/Shared\/OLERead.php
followed by the excel file binary content.

and the process enters an infinite loop.

I guess some illegal char is written in the file and the load fails because of it.

The writing is done with
setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING) method
and the object is PHPExcel_IOFactory::createReader('Excel5');

If I use utf8_encode($value) it works, but the text inside the excel is wrong because the content coming from the db is already in utf-8 format. The content is in Hungarian language.

Also the file is corrupted and can't be oppened in Excel.

What could be wrong and what could break the .xls file ?
Apr 20, 2015 at 8:27 AM
Try opening the corrupted file in the excel. Most of the time, the php error is written inside it.
Apr 20, 2015 at 9:46 AM
I was unable to open the corrupted file in Excel. Excel doesn't seem to be able to recover it.

The error seems to be this one :

Uninitialized string offset: 2315297283 on line 307 in file ...../phpoffice\/phpexcel\/Classes\/PHPExcel\/Shared\/OLERead.php
followed by the excel file binary content.