aVadim483 / fast-excel-writer

Lightweight and very fast XLSX Excel Spreadsheet Writer in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bugfix: Linux not identifying .xlsx as correct mimetype...

AzzaAzza69 opened this issue · comments

In order to differentiate from regular .zip files, the mimetype looks for files added to the .xlsx in order (as per Office 2007+), in particular:
[Content_Types].xml needs to be first followed by at least one file in the xl/ folder...

reference:
https://stackoverflow.com/questions/7274030/detect-excel-xlsx-file-mimetype-via-php

Can you tweak the saveToFile function?

PS. It may be more prudent to move the exception for "No worksheets defined" BEFORE the file_exists/unlink check as no worksheets will result in the file being deleted without creating any output!
<Maybe even just before the $zip->close() in case any other problems/exceptions cause the .zip not to be created?>

Thanx for the link, I'll explore this pronlem

The order of writing entries to the XLSX-file has been changed in v.4.7
And mimetype must be correct now

Fixed :)