Phpexcel Demo

时间:2021-08-20 08:46:20
【文件属性】:
文件名称:Phpexcel Demo
文件大小:5KB
文件格式:PHP
更新时间:2021-08-20 08:46:20
phpexcel 将数据库信息,导出excel class Phpexcel { public function actionUpexcel() { $status = Yii::$app->request->get('status'); switch ($status){ case 1 : $data = VipWithdrawDeposit::find()->where(['status'=>1])->all();//待转账记录表 break; case 3 : $data = VipWithdrawDeposit::find()->where(['status'=>3])->all();//已转账记录表 break; default : $data = VipWithdrawDeposit::find()->all();//所有申请记录 } $objPHPExcel = new \PHPExcel(); //设置文件的一些属性,在xls文件——>属性——>详细信息里可以看到这些值,xml表格里是没有这些值的 $objPHPExcel ->getProperties() //获得文件属性对象,给下文提供设置资源 ->setCreator( "MaartenBalliauw") //设置文件的创建者 ->setLastModifiedBy( "MaartenBalliauw") //设置最后修改者 ->setTitle( "Office2007 XLSX Test Document" ) //设置标题 ->setSubject( "Office2007 XLSX Test Document" ) //设置主题 ->setDescription( "Test document for Office2007 XLSX, generated using PHP classes.") //设置备注 ->setKeywords( "office 2007 openxmlphp") //设置标记 ->setCategory( "Test resultfile"); //设置类别 // 位置aaa *为下文代码位置提供锚 //给表格添加数据

网友评论