1
$objPHPExcel->getActiveSheet()->setCellValue('A1', "No");
$objPHPExcel->getActiveSheet()->setCellValue('B1', "Name");
$objPHPExcel->getActiveSheet()->setCellValue('C1', "Age");
$objPHPExcel->getActiveSheet()->setCellValue('D1', "Job");
$styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THICK,'color' => array('argb' => '808080'),),),);
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->applyFromArray($styleArray);
$sql="SELECT * FROM CUBA";
$query_c = mysqli_query($conn,$sql);
$n=2;
while($row_result=mysqli_fetch_assoc($query_c)){
$objPHPExcel->getActiveSheet()->setCellValue('A'.$n,$row_result['id']);
$objPHPExcel->getActiveSheet()->setCellValue('B'.$n,$row_result['name']);
$objPHPExcel->getActiveSheet()->setCellValue('C'.$n,$row_result['age']);
$objPHPExcel->getActiveSheet()->setCellValue('D'.$n,$row_result['job']);
$n++;
}
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
這是我所做的表的代碼,我想將其更改爲水平。如何製作水平表phpexcel?
當你使用$n
的行數我的願望想 horizontal table
語法錯誤,意想不到的」 1.1' (T_DNUMBER) –
然後加上引號 –
行數它的工作謝謝... –