diff --git a/Classes/PHPExcel/Style/NumberFormat.php b/Classes/PHPExcel/Style/NumberFormat.php index ed6ace90..dde1ad99 100644 --- a/Classes/PHPExcel/Style/NumberFormat.php +++ b/Classes/PHPExcel/Style/NumberFormat.php @@ -439,7 +439,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P * @param array $callBack Callback function for additional formatting of string * @return string Formatted string */ - public static function toFormattedString($value = '', $format = '', $callBack = null) + public static function toFormattedString($value = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $format = '', $callBack = null) { // For now we do not treat strings although section 4 of a format code affects strings if (!is_numeric($value)) return $value; diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 738d1674..5357a938 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -2438,7 +2438,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ($formatData) { $style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString( - $returnValue[$rRef][$cRef], $style->getNumberFormat()->getFormatCode() + $returnValue[$rRef][$cRef], + ($style->getNumberFormat()) ? + $style->getNumberFormat()->getFormatCode() : + PHPExcel_Style_NumberFormat::FORMAT_GENERAL ); } } else { diff --git a/changelog.txt b/changelog.txt index e02c3a4a..600a33fd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -51,6 +51,7 @@ Fixed in develop branch: - Feature: (Progi1984) Work item GH-8/CP11704 : Conditional formatting in Excel 5 Writer - Bugfix: (MBaker) Work item GH-113 - canRead() Error for GoogleDocs ODS files: in ODS files from Google Docs there is no mimetype file - Bugfix: (MBaker) Work item GH-80 - "Sheet index is out of bounds." Exception +- Bugfix: (ccorliss) Work item GH-105 - Fixed number format fatal error -------------------------------------------------------------------------------- BREAKING CHANGE! As part of the planned changes for handling array formulae in