荣誉表格

This commit is contained in:
小松树 committed 2019-03-07 16:44:46 +08:00
1 parent 82f5e74744
commit 4a9a729a1a
4 files changed
+25

No files matched your search

@@ -343,4 +343,7 @@ class DwRongyu extends Base
return json($data);
}
}
@@ -7,6 +7,11 @@ use app\common\controller\Base;
// 引用教师数据模型类
use app\rongyu\model\JsRongyuInfo as ryinfo;
// 引用PhpSpreadsheet类
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory;
class JsRongyuInfo extends Base
{
/**
@@ -400,4 +405,21 @@ class JsRongyuInfo extends Base
// 返回信息
return json($data);
}
// 下载荣誉信息
public function outXlsx($id)
{
//通过工厂模式创建内容
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('jsRongyu.xlsx');
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->getCell('A1')->setValue('John');
$worksheet->getCell('A2')->setValue('Smith');
//通过工厂模式来写内容
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
$writer->save('write.xls');;
}
}
Binary file not shown.
Loaded 3 of 4 files, more files were not shown because too many files have changed in this diff. Show more