Excel导出

创建一个文件,使用第一个参数作为文件名。
Excel::create('Filename');
可以使用回调函数操作创建的文件。

Excel::create('Filename', function($excel) {

// Call writer methods here

 });

更改属性
有几个属性可以改变 大多数设置了默认。

Excel::create('Filename', function($excel) {

// Set the title  设置标题

      $excel->setTitle('Our new awesome title');

// Chain the setters  设置创作人

       $excel->setCreator('Maatwebsite') ->setCompany('Maatwebsite');

    // Call them separately   设置 介绍说明

      $excel->setDescription('A demonstration to change the file properties');
});

Exporting导出

To download the created file, use->export($ext) or ->download($ext).

下载创建的excel
Export to Excel5 (xls)格式

Excel::create('Filename', function($excel) {

})->export('xls');
// or

    ->download('xls');

Export to Excel2007 (xlsx)格式

    ->export('xlsx');

// or

    ->download('xlsx');

Export to CSV格式

    ->export('csv');

// or

    ->download('csv');

(未完待续...)

你可能感兴趣的:(Excel导出)