Problem with Excel5 Reader

Topics: Developer Forum, User Forum
Jun 3, 2010 at 6:13 PM

Im trying to make a parsing program that is compatible with both Excel 5.0 files and Excel 2007 files.

So far i've been having no problems with the Excel2007 it works like a charm but, when I tried to load a Excel 5.0 file i got the following errors:

Notice: Undefined offset: 0 in /xxx/xxx/xxx/xxx/xxx/PHPExcel/Reader/Excel5.php on line 1338

Fatal error: Argument 1 passed to PHPExcel_Style::setFont() must not be null, called in /xxx/xxx/xxx/xxx/xxx/PHPExcel/Reader/Excel5.php on line 1338 and defined in /xxx/xxx/xxx/xxx/xxx/PHPExcel/Style.php on line 563

Software Versions:

php 5.1.6

Apache 2,0

This are my include paths:


And this is the script:

        $objReader = PHPExcel_IOFactory::createReader('Excel5');

        $objReader = PHPExcel_IOFactory::createReader('Excel2007');
        echo('Invalid file format');

$objPHPExcel = $objReader->load($filepath);
$val = ($objPHPExcel->getActiveSheet()->getCell('A1'));
$temp = $val->getvalue();
echo $temp;

Basically what im doing here is ask for the MIME type of the file and depending on that I'll create the corresponding reader.

Like I said before it works with Excel 2007 but not with Excel 5.0


Any help would be appreciated.

Kind Regards.

Jun 3, 2010 at 8:45 PM

Is the MIME type of an Excel file really 'application/msword'.

That looks more like an MS Word file to me.

Jun 8, 2010 at 3:32 AM

Thats what the files commmand in linux says when I ask for a xls file.

The error has something to do with setting font styles apparently but I can't figure out how to fix this.

Jun 8, 2010 at 9:01 AM

It's really not very much for us to work with.

Which version of PHPExcel? 1.7.3?

Is it possible for you to upload (or email us) a copy of the file?