在PHPExcel中我合并三个单元格并具有foreach循环。合并后未打印结果下一个值

时间:2017-04-19 12:11:46

标签: php joomla phpexcel

$ periodOne =阵列(阵列(' SNO''评价'' TOT'' AVG',' CLS TOT',' CLS AVG',' DIFF'));

    $rowID = 7;
    foreach($periodOne as $rowArray) {
       $columnID = 'A';
       foreach($rowArray as $columnValue) {

            $this->setActiveSheetIndex(0)->mergeCells('B7:D7');
            $this->getActiveSheet()->setCellValue($columnID.$rowID,$columnValue);



           $columnID++;     


       }
       $rowID++;
    }

1 个答案:

答案 0 :(得分:0)

$periodOne=array(array('SNO','Appraisal','TOT','AVG','CLS TOT','CLS AVG','DIFF'));      

    $rowID = 7;
    foreach($periodOne as $rowArray) {
       $columnID = 'A';
       foreach($rowArray as $columnValue) {
        if($columnID.$rowID == 'C7')
        {
            $columnID = 'E';



            $this->getActiveSheet()->setCellValue($columnID.$rowID,$columnValue);



        }
        else
        {   

            $this->getActiveSheet()->setCellValue($columnID.$rowID,$columnValue);


         }      
         $columnID++;

       }
       $rowID++;
    }