Merging cells in Excel by rows and columns together using PHPExcel

前端 未结 6 734
悲&欢浪女
悲&欢浪女 2021-02-05 10:25

I need to merge cells in Excel (xlsx) by rows and again by columns using PHPExcel. I tried the following.

$sheet->mergeCells(\"G\".($row_count+1).\":G\".($row         


        
6条回答
  •  轮回少年
    2021-02-05 10:58

    There is one more method for cell merging

        /**
     * Set merge on a cell range by using numeric cell coordinates
     *
     * @param   int $pColumn1   Numeric column coordinate of the first cell
     * @param   int $pRow1      Numeric row coordinate of the first cell
     * @param   int $pColumn2   Numeric column coordinate of the last cell
     * @param   int $pRow2      Numeric row coordinate of the last cell
     * @throws  Exception
     * @return PHPExcel_Worksheet
     */
         public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
    

提交回复
热议问题