如何在水平循环phpexcel时跳过列

时间:2017-08-25 07:13:36

标签: phpexcel

$objPHPExcel->getActiveSheet()->setCellValue('E7', "LAST PURCHASE");
$objPHPExcel->getActiveSheet()->mergeCells('E7:H7');

$objPHPExcel->getActiveSheet()->mergeCells('E9:F9');
$objPHPExcel->getActiveSheet()->mergeCells('G9:H9');
$objPHPExcel->getActiveSheet()->mergeCells('E10:F11');
$objPHPExcel->getActiveSheet()->mergeCells('G10:H11');
$objPHPExcel->getActiveSheet()->getStyle('E7:H11')->applyFromArray($BStyle3);
$objPHPExcel->getActiveSheet()->getStyle('E7:H11')->applyFromArray($BStyle3);
$objPHPExcel->getActiveSheet()->getStyle('E12:H18')->applyFromArray($BStyle2);
$objPHPExcel->getActiveSheet()->mergeCells('E19:F19');
$objPHPExcel->getActiveSheet()->mergeCells('E20:F20');
$objPHPExcel->getActiveSheet()->mergeCells('E21:F21');
$objPHPExcel->getActiveSheet()->mergeCells('G19:H19');
$objPHPExcel->getActiveSheet()->mergeCells('G20:H20');
$objPHPExcel->getActiveSheet()->mergeCells('G21:H21');
$objPHPExcel->getActiveSheet()->getStyle('E19:H21')->applyFromArray($BStyle2);


$sql2= "SELECT * FROM qefvendor"; 
$result2=mysqli_query($conn,$sql2);
$n='E';



while ($row = mysqli_fetch_array($result2)) {

    $roc_no=$row['roc_no'];
    $company_name=$row['company_name'];
    $sql = "SELECT * FROM avl_1 WHERE  roc_no ='$roc_no'";

                    $result = mysqli_query($conn,$sql);

                    while ($row_result = mysqli_fetch_array($result)) {
                        $counter1++;
                         $objPHPExcel->getActiveSheet()->setCellValue($n.'8',$row_result['company_name']);




                $n++;
                }

}

这是我制作表格的代码。我合并了表格中的单元格。

THIS LINK WHERE RESULT of the table and looping

THIS the image reselt i want where it skip the column

0 个答案:

没有答案