当前位置:   article > 正文

导出execl文件_博奥v17怎么导出excel的步骤

博奥v17怎么导出excel的步骤

类库在资源中下载

public function explodePdVisit($info){

    import("Org.Util.PHPExcel");
    import("Org.Util.PHPExcel.IOFactory");
    import("Org.Util.PHPExcel.PHPExcel");
    $objPHPExcel = new \PHPExcel();
    $list = array('A','B','C','D','E');
    $value = array('排序','终端名称','未拜访天数','业务员名称','业务员手机');
    //   dump($info);
    foreach($list as $k =>$v){
    $objPHPExcel->setActiveSheetIndex(0)
    ->setCellValue($v.'1',$value[$k]);
         }
    
    //$info = json_decode($info,true);
    //dump($info);
    $i = 2;
    foreach($info as &$v){
    $objPHPExcel->getActiveSheet(0)->setCellValue('A' . $i, $v['order']);
    $objPHPExcel->getActiveSheet(0)->setCellValue('B' . $i, $v['cust_name']);
    $objPHPExcel->getActiveSheet(0)->setCellValue('C' . $i, $v['days']);
    $objPHPExcel->getActiveSheet(0)->setCellValue('D' . $i, $v['staff_name']);
    $objPHPExcel->getActiveSheet(0)->setCellValue('E' . $i, $v['mobile']);
    $i++;
    }
    $objPHPExcel->setActiveSheetIndex(0);
    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment;filename="qqqqq.xls"');//文件名称
header('Cache-Control: max-age=0');
header("Pragma: no-cache");
    $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
    $objWriter->save('php://output');
    }
    
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/770599
推荐阅读
相关标签
  

闽ICP备14008679号