Difference between #11 and #12 of
Yii v2 snippet guide II

Revision #12 has been created by rackycz on Sep 8, 2020, 7:14:04 PM with the memo:

Composer and PhpExcel
« previous (#11) next (#13) »

Changes

Title unchanged

Yii v2 snippet guide II

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2,snippets

Content changed

[...]
$sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);

//
will be saved in "web" folder
 
$writer->save('hello world
You can save the file on the server:
 
// $writer->save('hello world.xlsx'); 
 
 
// Or you can send the file directly to the browser so user can download it:
 
//header('Content-Type: application/vnd.ms-excel'); // This is probably for older XLS files.
 
header('Content-Type: application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // This is for XLSX files (they are basically zip files).
 
header('Content-Disposition: attachment;filename="filename
.xlsx"'); 
 
$writer->save($outputFileName);
 
exit();
```
4 0
3 followers
Viewed: 75 363 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Aug 26, 2020
Last updated: 3 years ago
Update Article

Revisions

View all history