PHPExcel格式

I need some help regarding PHPExcel, we have a script that inputs logs of our web-application such as searches, keywords, etc into an excel file. I want the script to display the logs in a such a way that few parameters are Black, few in green. Here si the part of the script that I need to modify:

$data = parse_command($log_command, $content);
$command = $data['command'];

            $params = $data['params'];

            if ($command == 'skip')
                continue;

            $curr_row++;

            if ($save_to_excel)
            {
                $objPHPExcel->getActiveSheet()->getStyle('A'.$curr_row.':C'.$curr_row)->getFont()->setSize(10);
                $objPHPExcel->getActiveSheet()->getStyle('A'.$curr_row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
                    $objPHPExcel->setActiveSheetIndex(0)
                    ->setCellValue('A'.$curr_row, $request_time)
                    ->setCellValue('B'.$curr_row, $command)
                    ->setCellValue('C'.$curr_row, $params);

            }

The excel file has logs that contains dates, type of searches, keywords. so I want few types of searches in Black such as Venue searches in black, event searches in Blue, I hope I am clear enough. Thanks in advance.

To set the text color through phpexcel you could use:

$sheet->getStyle("A".$cur_row)->getFont()->getColor()->applyFromArray(array("rgb" => $color))

Chose the color depending on your keywords. Phpexcel also supports conditional formatting, its described in section 4.6.23 of the "developer documentation" contained in the download package.

Usage:

Assuming you want to color the second column based on its content:

$color = "000000";
switch ($command) {
     case "keyword_yellow" : $color = "FFA500"; break;
     case "keyword_red" : $color = "FF0000"; break;
     case "keyword_green" : $color = "008000"; break;
}
$objPHPExcel->getActiveSheet()->getStyle("B".$cur_row)->getFont()->getColor()->applyFromArray(array("rgb" => $color))

$objPHPExcel->getActiveSheet()->getStyle('A'.$linha.':I'.$linha.'')->getFont()->getColor()->applyFromArray(array("rgb" => '$color'));

Then Set value $color.