Set Background cell color in PHPExcel
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to set specific color to active cell when creating XLS document in PHPExcel? 回答1: $sheet->getStyle('A1')->applyFromArray( array( 'fill' => array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FF0000') ) ) ); Source: http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/ 回答2: function cellColor($cells,$color){ global $objPHPExcel; $objPHPExcel->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array( 'rgb