Laravel-Excel: Can't export xlsx or xls (set-up issue?)
Excited to find this package – thanks for sharing! Followed all of the install instructions but when I try to test export to xls or xlsx, I’m getting junk. CSV export works fine.
What am I doing wrong?
I’m using the standard config files created by Aritsan, and I’m using UTF-8 in LibreOffice for viewing.
// Export data function
public function exportData()
{
Excel::create('Testing Export', function($excel) {
$excel->sheet('Data', function($sheet) {
$sheet->fromArray(array(
array('data1', 'data2'),
array('data3', 'data4')
));
});
})->download('xls');
}
I’m using Ubuntu 14.04 with PHP 5.5.9 and Laravel 4.1. PHP modules listed include xml and zip.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 18 (2 by maintainers)
the problem was solved add these lines ob_end_clean(); ob_start(); Excel::create…
here solucion http://stackoverflow.com/questions/29692749/cant-export-xlsx-or-xls-in-proper-format-all-data-are-jumbled
That empty line is likely to be the cause of the problem if it’s being injected into the php://output stream; typically caused by an echo or print statement, or a blank line after a closing
?>
or before an opening<?php
in a script fileHave the exact same problem here. It opens up jumbled in Microsoft excel too. Not sure what the problem is.
CSV works fine but i find that it inserts an empty line on top of the file each time for some reason. At least it works.
Any idea whats the problem here?