From ab693eafcd0349aef36e1a33dedcc44b00948477 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 27 Jul 2014 13:12:44 +0100 Subject: [PATCH] Feature: (bolovincev) Work Item GH-269 - Update Worksheet.php getStyleByColumnAndRow() to allow a range of cells rather than just a single cell --- Classes/PHPExcel/Worksheet.php | 17 ++++++++--------- changelog.txt | 1 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index e40c03f9..e53c2283 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -1405,7 +1405,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable /** * Get style for cell * - * @param string $pCellCoordinate Cell coordinate to get style for + * @param string $pCellCoordinate Cell coordinate (or range) to get style for * @return PHPExcel_Style * @throws PHPExcel_Exception */ @@ -1492,16 +1492,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param int pRow2 Numeric row coordinate of the range cell * @return PHPExcel_Style */ - public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2=null, $pRow2=null) + 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); + } - 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); } /** diff --git a/changelog.txt b/changelog.txt index 4d6b41d1..51fc4a2c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -33,6 +33,7 @@ Planned for v1.8.1 - Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines - Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell - Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions +- Feature: (bolovincev) Work Item GH-269 - Update Worksheet.php getStyleByColumnAndRow() to allow a range of cells rather than just a single cell - Feature: (MBaker) - New methods added for testing cell status within merge groups