diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index eb90590f..45556764 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -1024,11 +1024,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) { $cell = $this->getCell($pCoordinate)->setValue($pValue); - - if ($returnCell) { - return $cell; - } - return $this; + return ($returnCell) ? $cell : $this; } /** @@ -1043,11 +1039,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) { $cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValue($pValue); - - if ($returnCell) { - return $cell; - } - return $this; + return ($returnCell) ? $cell : $this; } /** @@ -1056,13 +1048,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param string $pCoordinate Coordinate of the cell * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type - * @return PHPExcel_Worksheet + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified */ - public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) { // Set value - $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); - return $this; + $cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); + return ($returnCell) ? $cell : $this; } /** @@ -1072,11 +1065,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable * @param string $pRow Numeric row coordinate of the cell * @param mixed $pValue Value of the cell * @param string $pDataType Explicit data type - * @return PHPExcel_Worksheet + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified */ - public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) { - return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType); + $cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType); + return ($returnCell) ? $cell : $this; } /** diff --git a/changelog.txt b/changelog.txt index dea27dd3..1ac81085 100644 --- a/changelog.txt +++ b/changelog.txt @@ -80,6 +80,7 @@ Fixed in develop branch: - Feature: (Progi1984) & (blazzy) Work items 9605 - Implement support for AutoFilter in PHPExcel_Writer_Excel5 - Feature: (MBaker) Modified ERF and ERFC Engineering functions to accept Excel 2010's modified acceptance of negative arguments - General: (alexgann) Add Currency detection to the Advanced Value Binder +- General: (MBaker) Work item 18404 - setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - Bugfix: (cyberconte) Patch 12318 - OOCalc cells containing inside the tag - Bugfix: (schir1964) Fix to listWorksheetInfo() method for OOCalc Reader - Bugfix: (MBaker) Support for "e" (epoch) date format mask