Laravel-excel: Strange characters in export

Created on 20 Apr 2015  路  5Comments  路  Source: Maatwebsite/Laravel-Excel

Hello, when I export to xls I have this result

excelraro

my code is here

if (isset($_POST['excel'])) {

    Excel::create('Report', function ($excel) use ($result,$orderView,$arrayOrder) {
        $excel->sheet('Shit', function ($sheet) use ($result,$orderView,$arrayOrder) {
            $sheet->loadView('globalreport.excel',array('result' => $result));
        });
    })->download('xls');
}else {
    return View::make('globalreport.excel2')->with('result', $result)->with('order', $orderView)->with('tabla', $arrayOrder);
}

}

my view code:

chusta

Most helpful comment

put it before Excel::create

ob_clean();

works like a charm ;)

All 5 comments

Check similiar issues like https://github.com/Maatwebsite/Laravel-Excel/issues/52

Most likely there's a file which has a whitespace before <?php

My problem persists, did not detect any failure related to issue # 52, if you provides me an email I'll send the code, thanks.

Trust me on this one, the only fix for this problem is checking every created file for whitespaces or characters before <php and after ?>. Also you make sure you don't echo anything before Excel::create();

put it before Excel::create

ob_clean();

works like a charm ;)

@marlonbbernal Thanks very much, every things look so nice.

Was this page helpful?
0 / 5 - 0 ratings