//合并
$objPHPExcel->getActiveSheet()->mergeCells('L5:L'.$zong);//合并
$objPHPExcel->getActiveSheet()->mergeCells('M5:M'.$zong);//合并
//居中
$objPHPExcel->getActiveSheet()->getStyle('M5:M'.$zong)->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);//垂直居中 $objPHPExcel->getActiveSheet()->getStyle('M5:M'.$zong)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);//左右居中
//加颜色
$objPHPExcel->getActiveSheet()->getStyle('A4:M4')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle('A4:M4')->getFill()->getStartColor()->setARGB('3399cc');
//所有数据加边框
$styleThinBlackBorderOutline = array(
'borders' => array(
'allborders' => array( //设置全部边框
'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
),
),
);
$objPHPExcel->getActiveSheet()->getStyle('A1:M'.$zong)->applyFromArray($styleThinBlackBorderOutline);
网友评论