diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index cbf09545..a1060ae6 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -192,7 +192,7 @@ class PHPExcel_Calculation { ); private static $_localeArgumentSeparator = ','; private static $_localeFunctions = array(); - private static $_localeBoolean = array( 'TRUE' => 'TRUE', + public static $_localeBoolean = array( 'TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL' ); @@ -1686,6 +1686,26 @@ class PHPExcel_Calculation { } // function __clone() + /** + * Return the locale-specific translation of TRUE + * + * @access public + * @return string locale-specific translation of TRUE + */ + public static function getTRUE() { + return self::$_localeBoolean['TRUE']; + } + + /** + * Return the locale-specific translation of FALSE + * + * @access public + * @return string locale-specific translation of FALSE + */ + public static function getFALSE() { + return self::$_localeBoolean['FALSE']; + } + /** * Set the Array Return Type (Array or Value of first element in the array) * diff --git a/Classes/PHPExcel/Cell/AdvancedValueBinder.php b/Classes/PHPExcel/Cell/AdvancedValueBinder.php index 5bee95d7..7ec6ecc7 100644 --- a/Classes/PHPExcel/Cell/AdvancedValueBinder.php +++ b/Classes/PHPExcel/Cell/AdvancedValueBinder.php @@ -54,6 +54,15 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder // Style logic - strings if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { + // Test for booleans using locale-setting + if ($value == PHPExcel_Calculation::getTRUE()) { + $cell->setValueExplicit( True, PHPExcel_Cell_DataType::TYPE_BOOL); + return true; + } elseif($value == PHPExcel_Calculation::getFALSE()) { + $cell->setValueExplicit( False, PHPExcel_Cell_DataType::TYPE_BOOL); + return true; + } + // Check for number in scientific format if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); diff --git a/changelog.txt b/changelog.txt index e6bcfa5b..05adfc17 100644 --- a/changelog.txt +++ b/changelog.txt @@ -30,6 +30,7 @@ Fixed in SVN: - Feature: (MBaker) Support for Extended Workbook Properties in Excel2007, Excel5 and OOCalc Readers; support for User-defined Workbook Properties in Excel2007 and OOCalc Readers - Feature: (MBaker) Support for Extended and User-defined Workbook Properties in Excel2007 Writer - Feature: (MBaker) Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML +- Feature: (MBaker) Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent - Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant