Перебор массива имеет вот такой лист.
можно ли уменьшить время выполнения ?
$objPHPExcel = PHPExcel_IOFactory::load($dir.$filename);
......
$number = 1;
$counter = 7;
$horizontal = array ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R');
foreach ($tovars AS $shtrih => $values) {
$objPHPExcel->getActiveSheet()->mergeCells('J'.$counter.':K'.$counter);
$objPHPExcel->getActiveSheet()->mergeCells('P'.$counter.':R'.$counter);
$objPHPExcel->getActiveSheet()->getStyle('A'.$counter.':P'.$counter)->getFont()->setSize(8);
$objPHPExcel->getActiveSheet()->setCellValue('A'.$counter, $number);
$objPHPExcel->getActiveSheet()->getStyle('B'.$counter)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->setCellValue('B'.$counter, htmlspecialchars_decode(htmlspecialchars_decode($values['name']).', '.$values['color'].', '.$values['size']));
$objPHPExcel->getActiveSheet()->mergeCells('C'.$counter.':D'.$counter);
$objPHPExcel->getActiveSheet()->getStyle('C'.$counter)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT); // FORMAT_NUMBER
$objPHPExcel->getActiveSheet()->setCellValue('C'.$counter, ' '.$shtrih);
$objPHPExcel->getActiveSheet()->getStyle('E'.$counter)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->setCellValue('E'.$counter, 'шт');
$objPHPExcel->getActiveSheet()->setCellValue('F'.$counter, $values['raznica']);
$objPHPExcel->getActiveSheet()->getStyle('G'.$counter)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1);
$objPHPExcel->getActiveSheet()->setCellValue('G'.$counter, $values['raznica']*$values['price']);
$objPHPExcel->getActiveSheet()->setCellValue('H'.$counter, '-');
$objPHPExcel->getActiveSheet()->setCellValue('I'.$counter, '-');
$objPHPExcel->getActiveSheet()->setCellValue('L'.$counter, '-');
$objPHPExcel->getActiveSheet()->setCellValue('N'.$counter, '-');
foreach ($horizontal AS $value) {
$objPHPExcel->getActiveSheet()->getStyle($value.$counter.':'.$value.$counter)->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle($value.$counter.':'.$value.$counter)->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle($value.$counter.':'.$value.$counter)->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
}
$number++;
$counter++;
}