Tag:trim .sh Buffer cat encode each fun ++ logic
/** * Excel download. Job seekers under a single position */Public Function test () {$deliveryIds = Trim ($this->_param[' deliveryids '), ', '); if (empty ($deliveryIds)) {return JSON ($this->_format_return_data ([], FAILED, ' parameter not ')); }//Take the user under this position $res = $this->delivery_logic->getexcellist ($deliveryIds); if (empty ($res)) {return JSON ($this->_format_return_data ([], FAILED, ' parameter not ')); } foreach ($res as & $val) {//Calculate age $val [' ages '] = $this->getage (strtotime ($val [' Birthda Y '])); $val [' sex '] =!empty ($val [' sex '])? config (' Status.sex ') [$val [' Sex ']]: '; $val [' education '] =!empty ($val [' education '])? config (' status.education ') [$val [' Education ']]: '; $val [' jobType '] =!empty ($val [' JobType '])? config (' status. ') [$val [' JobType ']: '; $val [' trace '] =!empty ($val [' Trace '])? config (' Status.trace ') [$val [' Trace ']]: '; $val [' yearsalary '] =!empty ($val [' YearsalaRy '])? config (' status.hopesalary ') [$val [' Yearsalary ']: '; }//Introduction of core file vendor ("Util.phpexcel"); $objPHPExcel = new \phpexcel (); $objPHPExcel->getproperties ()->setcreator (' Http://www.jb51.net ')->setlastmodifiedby (' HTTP://WWW.J B51.net ')->settitle (' Office $ xlsx Document ')->setsubject (' Office $ xlsx Docum Ent ')->setdescription (' Document for Office ' XLSX, generated using PHP classes. ') ->setkeywords (' Office openxml php ')->setcategory (' Result file '); $objPHPExcel->getactivesheet ()->getstyle (' A1:s1 ')->getfont ()->setbold (true); $objPHPExcel->setactivesheetindex (0)->setcellvalue (' A1 ', ' name ')->setcellvalue (' B1 ') , ' sex ')->setcellvalue (' C1 ', ' age ')->setcellvalue (' D1 ', ' education ')->setc Ellvalue (' E1 ', ' Application Time ') ->setcellvalue (' F1 ', ' Resume Progress ')->setcellvalue (' G1 ', ' working Years ')->setcellvalue (' H1 ', ' work Type ')->setcellvalue (' I1 ', ' expected salary '); $i = 2; foreach ($res as $v) {$objPHPExcel->setactivesheetindex (0)->setcellvalue (' A '. $i, $ v[' name '])->setcellvalue (' B '. $i, $v [' sex '])->setcellvalue (' C ' $i, $v [' AG E '])->setcellvalue (' D '. $i, $v [' Education '])->setcellvalue (' E '. $i, $v [' De Liverytime '])->setcellvalue (' F '. $i, $v [' Trace '])->setcellvalue (' G '. $i, $ v[' Workexp ')->setcellvalue (' H '. $i, $v [' JobType '])->setcellvalue (' I ' $i, $v [' yearsalary ']); $i + +; } $objPHPExcel->getactivesheet ()->settitle (' Mall member Information '); $objPHPExcel->setactivesheetindex (0); $filename = UrlEncode (' Applicant columnTable '). ‘_‘ . Date (' Y-m-dhis '); * Generate xlsx File/* Ob_end_clean ();//clear buffer, avoid garbled header (' Content-type:application/vnd.openxmlformats-officedocu Ment.spreadsheetml.sheet '); Header (' Content-disposition:attachment;filename= '. $filename. '. Xlsx "'); Header (' cache-control:max-age=0 '); $objWriter =phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel2007 '); */* Generate XLS file */Ob_end_clean (); Clear buffer, avoid garbled header (' content-type:application/vnd.ms-excel;charset=utf-8 '); Header ("Content-disposition:attachment;filename=test_data.xls"); Header (' Content-disposition:attachment;filename= '. $filename. '. xls '); Header (' cache-control:max-age=0 '); Vendor ("Util.phpexcel"); $objWriter = \phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel5 '); $objWriter->save ($filename); $objWriter->save (' php://output '); }
Phpexcel Export Table