shuchkin / simplexlsxgen

Export data to Excel. PHP XLSX generator
MIT License
936 stars 198 forks source link

xlsx defect #140

Open elschman opened 4 months ago

elschman commented 4 months ago

Something is wrong so that my excel 365 needs to repair the xlsx I created out of the array

var_export($ergArray,true) "array ( 0 => array ( 0 => 'Sortieren', 1 => 'Startnummer', 2 => 'Wettbewerb', 3 => 'Nachname', 4 => 'Vorname', 5 => 'Titel', 6 => 'Jahrgang', 7 => 'Geschlecht', 8 => 'Verein', ), 1 => array ( 0 => '', 1 => '', 2 => '2', 3 => 'Braune', 4 => 'Beate', 5 => '', 6 => 1924, 7 => 'w', 8 => 'HSG Uni – Triathlon / Laufgruppe', ), 2 => array ( 0 => 1, 1 => 'P1', 2 => '2', 3 => 'An', 4 => 'ds', 5 => '', 6 => 1924, 7 => 'm', 8 => '', ), 3 => array ( 0 => 2, 1 => 'P1', 2 => '2', 3 => 'Anders', 4 => 'Christian', 5 => '', 6 => 2018, 7 => 'w', 8 => '', ), )"

Shuchkin\SimpleXLSXGen::fromArray($ergArray)->downloadAs('failure.xlsx');

Excel shows that image

image

shuchkin commented 4 months ago

may be extra spaces or linebreaks saving in the file try exit() after ->downloadAs

shuchkin commented 1 month ago

see the current code https://github.com/shuchkin/simplexlsxgen/blob/master/src/SimpleXLSXGen.php#L155

where there error?

adoptimize commented 1 month ago

I got an equal error. the XML of some elements in the $this->template are broken when unpacking. eg in [Content_Types].xml The file content ends with: ksheet+xml"/><p I played around with the linebreaks and managed to get </Types> at the end. But this needs much more playing. It might be cause of my old php 5.6 version where I'm using this. other pages are broken aswell and strings/Tags at the end are missing or cut off like the above.

shuchkin commented 1 month ago

https://www.php.net/manual/en/mbstring.overload.php ?