Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlsx defect #140

Open
elschman opened this issue Mar 5, 2024 · 5 comments
Open

xlsx defect #140

elschman opened this issue Mar 5, 2024 · 5 comments

Comments

@elschman
Copy link

elschman commented Mar 5, 2024

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
Copy link
Owner

shuchkin commented Mar 5, 2024

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

@shuchkin
Copy link
Owner

shuchkin commented May 15, 2024

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

where there error?

@adoptimize
Copy link

adoptimize commented May 15, 2024

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
Copy link
Owner

@kiszoli
Copy link

kiszoli commented Aug 19, 2024

i had the same problem on a proxmox vm with ubuntu 22.04 and php 8.1.2
saveAs() returned a correct output. downloadAs() returned an incorrect output.
exit() after downloadAs() was the solution for me.
thanks shuchkin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants