Update Worksheet.php getStyleByColumnAndRow()

http://phpexcel.codeplex.com/discussions/263626

$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(1, 2, 5, 2)->applyFromArray($styleArray);

It is very convenient in cycles
This commit is contained in:
bolovincev 2013-11-19 22:51:11 +03:00
parent f5bd6dc0f2
commit f505648ec5

View File

@ -1486,10 +1486,19 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @param int $pColumn Numeric column coordinate of the cell * @param int $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell * @param int $pRow Numeric row coordinate of the cell
* @param int pColumn2 Numeric column coordinate of the range cell
* @param int pRow2 Numeric row coordinate of the range cell
* @return PHPExcel_Style * @return PHPExcel_Style
*/ */
public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1) public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2=null, $pRow2=null)
{ {
if(!is_null($pColumn2) && !is_null($pRow2))
{
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->getStyle($cellRange);
}
return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }