diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index 90e1dd27..784c313e 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -533,18 +533,15 @@ class PHPExcel_Shared_String public static function CountCharacters($value, $enc = 'UTF-8') { if (self::getIsIconvEnabled()) { - $count = iconv_strlen($value, $enc); - return $count; + return iconv_strlen($value, $enc); } if (self::getIsMbstringEnabled()) { - $count = mb_strlen($value, $enc); - return $count; + return mb_strlen($value, $enc); } // else strlen - $count = strlen($value); - return $count; + return strlen($value); } /** @@ -558,18 +555,15 @@ class PHPExcel_Shared_String public static function Substring($pValue = '', $pStart = 0, $pLength = 0) { if (self::getIsIconvEnabled()) { - $string = iconv_substr($pValue, $pStart, $pLength, 'UTF-8'); - return $string; + return iconv_substr($pValue, $pStart, $pLength, 'UTF-8'); } if (self::getIsMbstringEnabled()) { - $string = mb_substr($pValue, $pStart, $pLength, 'UTF-8'); - return $string; + return mb_substr($pValue, $pStart, $pLength, 'UTF-8'); } // else substr - $string = substr($pValue, $pStart, $pLength); - return $string; + return substr($pValue, $pStart, $pLength); } diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 5f551620..44a95774 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -2089,22 +2089,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (is_array($source)) { // start coordinate list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($pCell); - $startColumn = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // Loop through $source - $currentRow = $startRow - 1; - $rowData = null; foreach ($source as $rowData) { - ++$currentRow; - - $rowCount = count($rowData); - for ($i = 0; $i < $rowCount; ++$i) { - if ($rowData[$i] != $nullValue) { + $currentColumn = $startColumn; + foreach($rowData as $cellValue) { + if ($cellValue != $nullValue) { // Set cell value - $this->getCell(PHPExcel_Cell::stringFromColumnIndex($i + $startColumn) . $currentRow) - ->setValue($rowData[$i]); + $this->getCell($currentColumn . $startRow)->setValue($cellValue); } + ++$currentColumn; } + ++$startRow; } } else { throw new Exception("Parameter \$source should be an array.");