Why is there a blank space at the bottom of the table exported by PHPexecl?

Why is there a blank at the bottom of the table exported by PHPexecl?

clipboard.png

 public function export_order_bill() 
    {
        $objPHPExcel = new PHPExcel();
        
        // Set the excel property
        $objPHPExcel->getProperties()->setCreator("wboll")
        ->setLastModifiedBy("wboll")
        ->setTitle("Office 2007 XLSX Document")
        ->setSubject("Office 2007 XLSX Document")
        ->setDescription("Document for Office 2007 XLSX, generated using PHP classes.")
        ->setKeywords("office 2007 openxml php")
        ->setCategory("Test result file");

        if ( $this->thead ) {
            foreach ( $this->thead as $key => $value ) {
                // 
                $objPHPExcel->createSheet();
                $objPHPExcel->setActiveSheetIndex($key);

                // 
                $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(11);
                $objPHPExcel->getDefaultStyle()->getFont()->setName("");

                // 
                for ($i=0; $i < count($value); $iPP) { 
                     // 
                     $objPHPExcel->getActiveSheet()->getColumnDimension($this->letters[$i])->setWidth(22);
                     // 
                     $objPHPExcel->getActiveSheet()->getRowDimension($i+1)->setRowHeight(16);
                }

                if ( $this->mergearray ) {
                    foreach ( $this->mergearray[$key] as $k => $v) {
                       
                        $merge = explode(":", $k);
                        $objPHPExcel->getActiveSheet()->setCellValue($merge[0], $v);
                        //
                        $objPHPExcel->getActiveSheet()->mergeCells($k);
                        //
                        $objPHPExcel->getActiveSheet()->getStyle($k)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                        $objPHPExcel->getActiveSheet()->getStyle($k)->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
                    }
                }
                
                //
                // 
                foreach ($value as $kk => $vv) {
                    $letters = "";
                    $letters = $this->letters[$kk];
                    // 
                    $objPHPExcel->getActiveSheet()->setCellValue($letters."2", $vv);
                    //
                    $objPHPExcel->getActiveSheet()->getStyle($letters."2")->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                    $objPHPExcel->getActiveSheet()->getStyle($letters."2")->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
                
                    if ( $this->data ) {
                        foreach ($this->data[$key] as $kkk => $vvv) {
                            // 
                            $objPHPExcel->getActiveSheet()->setCellValue($letters.(3+$kkk), $vvv[$this->fieldname[$key][$kk]]);
                            //
                            $objPHPExcel->getActiveSheet()->getStyle($letters.(3+$kkk))->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                            $objPHPExcel->getActiveSheet()->getStyle($letters.(3+$kkk))->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
                            
                        }
                    }
                }
                $objPHPExcel->getActiveSheet()->setTitle($this->ismerge[$key]);
            }
        }

        // Set active sheet index to the first sheet, so Excel opens this as the first sheet
        $objPHPExcel->setActiveSheetIndex(0);
        // ob_end_clean();

        // 
        // header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        header("Content-Type: application/vnd.ms-excel");
        // header("Content-Disposition: attachment;filename="" . $this->exportfilename.date("YmdHis") . ".xls"");
        header("Content-Disposition: attachment;filename="" . date("YmdHis") . ".xls"");
        header("Cache-Control: max-age=0");
        
        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel5");
        // $objWriter->save("php://output");
        $objWriter->save("/tmp/".$this->exportfilename);
    }
Php
Jun.05,2021

how do you solve this problem?


Excel5 is changed to Excel2007


recommend a feature-rich, compatible and high-performance Excel document base library Excelize: https://github.com/xuri/excelize

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59a32-65b5f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59a32-65b5f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?