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');

(未完待续...)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容