Difference between #6 and #7 of
Export query content to excel through any of your controllers, also can set cssClass for header/odd/even rows, auto download

Changes

Title unchanged

Export query content to excel through any of your controllers, also can set cssClass for header/odd/even rows, auto download

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Hzl, Excel, Export, Download, Behavior, ScottHuangZL

Content changed

[...]
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$tempDir = Yii::getAlias('@webroot') . '/uploads/temp/';
if (!is_dir($tempDir)) {
mkdir(Yii::getAlias('@webroot').'/uploads');//need 2 steps to avoid error
 
mkdir($tempDir);
chmod($tempDir, 0755);
// the default implementation makes it under 777 permission, which you could possibly change recursively before deployment, but here's less of a headache in case you don't
}
$file_name = $tempDir . yii::$app->user->identity->username . '-' . str_replace(array('/', '*', '?', '\\', ':', '[', ']'), array('_', '_', '_', '_', '_', '_', '_'), $excel_file) . '-' . date('Ymd-His') . '.xlsx';
[...]
2 0
2 followers
Viewed: 25 555 times
Version: 2.0
Category: Tutorials
Written by: Scott_Huang
Last updated by: Scott_Huang
Created on: Jun 16, 2015
Last updated: 8 years ago
Update Article

Revisions

View all history