$PHPExcel=new \PHPExcel(); //实例化PHPExcel类,类似于在桌面上新建一个Excel表格
$PHPSheet= $PHPExcel->getActiveSheet(); //获取当前活动sheet的操作对象
$PHPSheet->setTitle('配货产品列表'); //给当前活动sheet设置名称
//设置列宽
$PHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
$PHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(35);
$PHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(35);
$PHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
$PHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(25);
$PHPExcel->getActiveSheet()->setCellValueExplicit('A1', date('md', time()))
->getStyle('A1')->getFont()->setSize(14)->setBold(true);//字号、加粗
$PHPExcel->getActiveSheet()->mergeCells('A1:E1' . $last);//合并A1-E1之间的单元格
$PHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);//居中显示,HORIZONTAL_RIGHT 居右,HORIZONTAL_LEFT 居左
$PHPExcel->getActiveSheet()->getRowDimension($last)->setRowHeight(30);//设置行高,$last表示行号
$PHPExcel->getActiveSheet()->getStyle('A' . $last)->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);//水平居中