欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

合并单元格导出

程序员文章站 2022-06-14 08:09:42
...
$num_arr = array_column($result,'order_num');
$arr = array_count_values($num_arr);
foreach ($arr as $kk=>$vv) {
  if($vv>1){
    $keys = array_keys($num_arr,$kk);
    $end = $keys[count($keys)-1]+2;
    $start = $end-$vv+1;
    $objSheet->mergeCells('A'.$start.":".'A'.$end);
    $objSheet->mergeCells('P'.$start.":".'P'.$end);
    $objSheet->mergeCells('Q'.$start.":".'Q'.$end);
                    ......
   }
  }
 }

转载于:https://www.jianshu.com/p/10d99a8cd1ff