Why is there a blank at the bottom of the table exported by PHPexecl?
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);
}