Bugfix: (ccorliss) Work item GH-105 - Fixed number format fatal error

This commit is contained in:
Mark Baker 2013-03-01 21:38:13 +00:00
parent a49b3c4834
commit 6145cf326b
3 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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