Skip to content

XLSX files edited and saved in Libre Office can not be loaded #686

@BlackMambaCoder

Description

@BlackMambaCoder

I noticed that there are problems with loading XLSX files edited and saved in Libre Office (on MacBook and Ubuntu). Files saved as XLS are not throwing any errors.

The error displayed: Cell coordinate can not be zero-length string
The stack trace:
...
#0 /.../phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(1260): PhpOffice\PhpSpreadsheet\Cell\Coordinate::coordinateFromString('')
#1 /.../phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(1220): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->createNewCell('')
#2 /.../phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(1693): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->getCell('')
#3 /.../phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(1151): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->mergeCells('1:1')
.....

I noticed it happened on the $objReader->load($path).

protected function loadSpreadsheet($path)
{
        /**  Identify the type of $inputFileName  **/
        $inputFileType = IOFactory::identify($path);

        /**  Create a new Reader of the type that has been identified  **/
        $objReader = IOFactory::createReader($inputFileType);

        /**  Load $inputFileName to a PHPExcel Object  **/
        return $objReader->load($path);
}

Files edited and saved on Windows Excel are not throwing any errors too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions