mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 14:56:04 +03:00
Minor tweaks and bugfixes
This commit is contained in:
parent
7760d5ffc6
commit
d8debd0966
@ -349,13 +349,13 @@ class PHPExcel
|
|||||||
$this->_workSheetCollection,
|
$this->_workSheetCollection,
|
||||||
$oldIndex,
|
$oldIndex,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
array_splice(
|
array_splice(
|
||||||
$this->_workSheetCollection,
|
$this->_workSheetCollection,
|
||||||
$newIndex,
|
$newIndex,
|
||||||
0,
|
0,
|
||||||
$pSheet
|
$pSheet
|
||||||
);
|
);
|
||||||
return $newIndex;
|
return $newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
PHPExcel_Autoloader::Register();
|
PHPExcel_Autoloader::Register();
|
||||||
// As we always try to run the autoloader before anything else, we can use it to do a few
|
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||||
// simple checks and initialisations
|
// simple checks and initialisations
|
||||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||||
// check mbstring.func_overload
|
// check mbstring.func_overload
|
||||||
if (ini_get('mbstring.func_overload') & 2) {
|
if (ini_get('mbstring.func_overload') & 2) {
|
||||||
@ -39,47 +39,47 @@ PHPExcel_Shared_String::buildCharacterSets();
|
|||||||
/**
|
/**
|
||||||
* PHPExcel_Autoloader
|
* PHPExcel_Autoloader
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Autoloader
|
class PHPExcel_Autoloader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Register the Autoloader with SPL
|
* Register the Autoloader with SPL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function Register() {
|
public static function Register() {
|
||||||
if (function_exists('__autoload')) {
|
if (function_exists('__autoload')) {
|
||||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||||
spl_autoload_register('__autoload');
|
spl_autoload_register('__autoload');
|
||||||
}
|
}
|
||||||
// Register ourselves with SPL
|
// Register ourselves with SPL
|
||||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
||||||
} // function Register()
|
} // function Register()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoload a class identified by name
|
* Autoload a class identified by name
|
||||||
*
|
*
|
||||||
* @param string $pClassName Name of the object to load
|
* @param string $pClassName Name of the object to load
|
||||||
*/
|
*/
|
||||||
public static function Load($pClassName){
|
public static function Load($pClassName){
|
||||||
if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||||
// Either already loaded, or not a PHPExcel class request
|
// Either already loaded, or not a PHPExcel class request
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pClassFilePath = PHPEXCEL_ROOT .
|
$pClassFilePath = PHPEXCEL_ROOT .
|
||||||
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
||||||
'.php';
|
'.php';
|
||||||
|
|
||||||
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
|
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
|
||||||
// Can't load
|
// Can't load
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
require($pClassFilePath);
|
require($pClassFilePath);
|
||||||
} // function Load()
|
} // function Load()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,239 +1,239 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2012 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_CachedObjectStorageFactory
|
* PHPExcel_CachedObjectStorageFactory
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorageFactory
|
class PHPExcel_CachedObjectStorageFactory
|
||||||
{
|
{
|
||||||
const cache_in_memory = 'Memory';
|
const cache_in_memory = 'Memory';
|
||||||
const cache_in_memory_gzip = 'MemoryGZip';
|
const cache_in_memory_gzip = 'MemoryGZip';
|
||||||
const cache_in_memory_serialized = 'MemorySerialized';
|
const cache_in_memory_serialized = 'MemorySerialized';
|
||||||
const cache_igbinary = 'Igbinary';
|
const cache_igbinary = 'Igbinary';
|
||||||
const cache_to_discISAM = 'DiscISAM';
|
const cache_to_discISAM = 'DiscISAM';
|
||||||
const cache_to_apc = 'APC';
|
const cache_to_apc = 'APC';
|
||||||
const cache_to_memcache = 'Memcache';
|
const cache_to_memcache = 'Memcache';
|
||||||
const cache_to_phpTemp = 'PHPTemp';
|
const cache_to_phpTemp = 'PHPTemp';
|
||||||
const cache_to_wincache = 'Wincache';
|
const cache_to_wincache = 'Wincache';
|
||||||
const cache_to_sqlite = 'SQLite';
|
const cache_to_sqlite = 'SQLite';
|
||||||
const cache_to_sqlite3 = 'SQLite3';
|
const cache_to_sqlite3 = 'SQLite3';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the method used for cell cacheing
|
* Name of the method used for cell cacheing
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private static $_cacheStorageMethod = NULL;
|
private static $_cacheStorageMethod = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the class used for cell cacheing
|
* Name of the class used for cell cacheing
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private static $_cacheStorageClass = NULL;
|
private static $_cacheStorageClass = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of all possible cache storage methods
|
* List of all possible cache storage methods
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private static $_storageMethods = array(
|
private static $_storageMethods = array(
|
||||||
self::cache_in_memory,
|
self::cache_in_memory,
|
||||||
self::cache_in_memory_gzip,
|
self::cache_in_memory_gzip,
|
||||||
self::cache_in_memory_serialized,
|
self::cache_in_memory_serialized,
|
||||||
self::cache_igbinary,
|
self::cache_igbinary,
|
||||||
self::cache_to_phpTemp,
|
self::cache_to_phpTemp,
|
||||||
self::cache_to_discISAM,
|
self::cache_to_discISAM,
|
||||||
self::cache_to_apc,
|
self::cache_to_apc,
|
||||||
self::cache_to_memcache,
|
self::cache_to_memcache,
|
||||||
self::cache_to_wincache,
|
self::cache_to_wincache,
|
||||||
self::cache_to_sqlite,
|
self::cache_to_sqlite,
|
||||||
self::cache_to_sqlite3,
|
self::cache_to_sqlite3,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default arguments for each cache storage method
|
* Default arguments for each cache storage method
|
||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodDefaultParameters = array(
|
private static $_storageMethodDefaultParameters = array(
|
||||||
self::cache_in_memory => array(
|
self::cache_in_memory => array(
|
||||||
),
|
),
|
||||||
self::cache_in_memory_gzip => array(
|
self::cache_in_memory_gzip => array(
|
||||||
),
|
),
|
||||||
self::cache_in_memory_serialized => array(
|
self::cache_in_memory_serialized => array(
|
||||||
),
|
),
|
||||||
self::cache_igbinary => array(
|
self::cache_igbinary => array(
|
||||||
),
|
),
|
||||||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||||
),
|
),
|
||||||
self::cache_to_discISAM => array( 'dir' => NULL
|
self::cache_to_discISAM => array( 'dir' => NULL
|
||||||
),
|
),
|
||||||
self::cache_to_apc => array( 'cacheTime' => 600
|
self::cache_to_apc => array( 'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
||||||
'memcachePort' => 11211,
|
'memcachePort' => 11211,
|
||||||
'cacheTime' => 600
|
'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_wincache => array( 'cacheTime' => 600
|
self::cache_to_wincache => array( 'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_sqlite => array(
|
self::cache_to_sqlite => array(
|
||||||
),
|
),
|
||||||
self::cache_to_sqlite3 => array(
|
self::cache_to_sqlite3 => array(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments for the active cache storage method
|
* Arguments for the active cache storage method
|
||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodParameters = array();
|
private static $_storageMethodParameters = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current cache storage method
|
* Return the current cache storage method
|
||||||
*
|
*
|
||||||
* @return string|NULL
|
* @return string|NULL
|
||||||
**/
|
**/
|
||||||
public static function getCacheStorageMethod()
|
public static function getCacheStorageMethod()
|
||||||
{
|
{
|
||||||
return self::$_cacheStorageMethod;
|
return self::$_cacheStorageMethod;
|
||||||
} // function getCacheStorageMethod()
|
} // function getCacheStorageMethod()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current cache storage class
|
* Return the current cache storage class
|
||||||
*
|
*
|
||||||
* @return PHPExcel_CachedObjectStorage_ICache|NULL
|
* @return PHPExcel_CachedObjectStorage_ICache|NULL
|
||||||
**/
|
**/
|
||||||
public static function getCacheStorageClass()
|
public static function getCacheStorageClass()
|
||||||
{
|
{
|
||||||
return self::$_cacheStorageClass;
|
return self::$_cacheStorageClass;
|
||||||
} // function getCacheStorageClass()
|
} // function getCacheStorageClass()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of all possible cache storage methods
|
* Return the list of all possible cache storage methods
|
||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
**/
|
**/
|
||||||
public static function getAllCacheStorageMethods()
|
public static function getAllCacheStorageMethods()
|
||||||
{
|
{
|
||||||
return self::$_storageMethods;
|
return self::$_storageMethods;
|
||||||
} // function getCacheStorageMethods()
|
} // function getCacheStorageMethods()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of all available cache storage methods
|
* Return the list of all available cache storage methods
|
||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
**/
|
**/
|
||||||
public static function getCacheStorageMethods()
|
public static function getCacheStorageMethods()
|
||||||
{
|
{
|
||||||
$activeMethods = array();
|
$activeMethods = array();
|
||||||
foreach(self::$_storageMethods as $storageMethod) {
|
foreach(self::$_storageMethods as $storageMethod) {
|
||||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
||||||
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
||||||
$activeMethods[] = $storageMethod;
|
$activeMethods[] = $storageMethod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $activeMethods;
|
return $activeMethods;
|
||||||
} // function getCacheStorageMethods()
|
} // function getCacheStorageMethods()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify the cache storage method to use
|
* Identify the cache storage method to use
|
||||||
*
|
*
|
||||||
* @param string $method Name of the method to use for cell cacheing
|
* @param string $method Name of the method to use for cell cacheing
|
||||||
* @param array of mixed $arguments Additional arguments to pass to the cell caching class
|
* @param array of mixed $arguments Additional arguments to pass to the cell caching class
|
||||||
* when instantiating
|
* when instantiating
|
||||||
* @return boolean
|
* @return boolean
|
||||||
**/
|
**/
|
||||||
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
||||||
{
|
{
|
||||||
if (!in_array($method,self::$_storageMethods)) {
|
if (!in_array($method,self::$_storageMethods)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
||||||
if (!call_user_func(array( $cacheStorageClass,
|
if (!call_user_func(array( $cacheStorageClass,
|
||||||
'cacheMethodIsAvailable'))) {
|
'cacheMethodIsAvailable'))) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
||||||
foreach($arguments as $k => $v) {
|
foreach($arguments as $k => $v) {
|
||||||
if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
|
if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
|
||||||
self::$_storageMethodParameters[$method][$k] = $v;
|
self::$_storageMethodParameters[$method][$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$_cacheStorageMethod === NULL) {
|
if (self::$_cacheStorageMethod === NULL) {
|
||||||
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
||||||
self::$_cacheStorageMethod = $method;
|
self::$_cacheStorageMethod = $method;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // function initialize()
|
} // function initialize()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the cache storage
|
* Initialise the cache storage
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
||||||
* @return PHPExcel_CachedObjectStorage_ICache
|
* @return PHPExcel_CachedObjectStorage_ICache
|
||||||
**/
|
**/
|
||||||
public static function getInstance(PHPExcel_Worksheet $parent)
|
public static function getInstance(PHPExcel_Worksheet $parent)
|
||||||
{
|
{
|
||||||
$cacheMethodIsAvailable = TRUE;
|
$cacheMethodIsAvailable = TRUE;
|
||||||
if (self::$_cacheStorageMethod === NULL) {
|
if (self::$_cacheStorageMethod === NULL) {
|
||||||
$cacheMethodIsAvailable = self::initialize();
|
$cacheMethodIsAvailable = self::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cacheMethodIsAvailable) {
|
if ($cacheMethodIsAvailable) {
|
||||||
$instance = new self::$_cacheStorageClass( $parent,
|
$instance = new self::$_cacheStorageClass( $parent,
|
||||||
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
||||||
);
|
);
|
||||||
if ($instance !== NULL) {
|
if ($instance !== NULL) {
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} // function getInstance()
|
} // function getInstance()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,10 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DATE(year,month,day)
|
* DATE(year,month,day)
|
||||||
*
|
*
|
||||||
|
* PHPExcel is a lot more forgiving than MS Excel when passing non numeric values to this function.
|
||||||
|
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
|
||||||
|
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Date/Time Functions
|
* @category Date/Time Functions
|
||||||
* @param integer $year The value of the year argument can include one to four digits.
|
* @param integer $year The value of the year argument can include one to four digits.
|
||||||
@ -278,6 +282,14 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
||||||
$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
||||||
|
|
||||||
|
if (($month !== NULL) && (!is_numeric($month))) {
|
||||||
|
$month = PHPExcel_Shared_Date::monthStringToNumber($month);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($day !== NULL) && (!is_numeric($day))) {
|
||||||
|
$day = PHPExcel_Shared_Date::dayStringToNumber($day);
|
||||||
|
}
|
||||||
|
|
||||||
$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
|
$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
|
||||||
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
||||||
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
||||||
@ -720,6 +732,10 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_bool($method)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
||||||
$startDay = $PHPStartDateObject->format('j');
|
$startDay = $PHPStartDateObject->format('j');
|
||||||
|
@ -58,9 +58,22 @@ class PHPExcel_Shared_Date
|
|||||||
'Sep' => 'September',
|
'Sep' => 'September',
|
||||||
'Oct' => 'October',
|
'Oct' => 'October',
|
||||||
'Nov' => 'November',
|
'Nov' => 'November',
|
||||||
'Dec' => 'December'
|
'Dec' => 'December',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Names of the months of the year, indexed by shortname
|
||||||
|
* Planned usage for locale settings
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public static $_numberSuffixes = array( 'st',
|
||||||
|
'nd',
|
||||||
|
'rd',
|
||||||
|
'th',
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base calendar year to use for calculations
|
* Base calendar year to use for calculations
|
||||||
*
|
*
|
||||||
@ -355,4 +368,23 @@ class PHPExcel_Shared_Date
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function monthStringToNumber($month) {
|
||||||
|
$monthIndex = 1;
|
||||||
|
foreach(self::$_monthNames as $shortMonthName => $longMonthName) {
|
||||||
|
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
||||||
|
return $monthIndex;
|
||||||
|
}
|
||||||
|
++$monthIndex;
|
||||||
|
}
|
||||||
|
return $month;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function dayStringToNumber($day) {
|
||||||
|
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
|
||||||
|
if (is_numeric($strippedDayValue)) {
|
||||||
|
return $strippedDayValue;
|
||||||
|
}
|
||||||
|
return $day;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@
|
|||||||
2010, 0, -1, 40146
|
2010, 0, -1, 40146
|
||||||
2010, 5, 31, 40329
|
2010, 5, 31, 40329
|
||||||
2010, 1, '21st', 40199 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
2010, 1, '21st', 40199 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
||||||
2010, "March",'21st', 40168 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
2010, "March",'21st', 40258 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
||||||
2010, "March",21, 40168 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
2010, "March",21, 40258 // MS Excel will fail with a #VALUE return, but PHPExcel can parse this date
|
||||||
"ABC", 1, 21, "#VALUE!"
|
"ABC", 1, 21, "#VALUE!"
|
||||||
2010, "DEF", 21, "#VALUE!"
|
2010, "DEF", 21, "#VALUE!"
|
||||||
2010, 3, "GHI", "#VALUE!"
|
2010, 3, "GHI", "#VALUE!"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"ABC", "2007-1-10", FALSE, "#VALUE!"
|
"ABC", "2007-1-10", FALSE, "#VALUE!"
|
||||||
"2007-1-1", "DEF", TRUE, "#VALUE!"
|
"2007-1-1", "DEF", TRUE, "#VALUE!"
|
||||||
"2007-1-1", "2007-1-10", "XYZ", "#VALUE!"
|
"2007-1-1", "2007-1-10", "XYZ", "#VALUE!"
|
||||||
"2007-1-10", "2007-1-1", "Y", "#NUM!"
|
"2007-1-10", "2007-1-1", "Y", "#VALUE!"
|
||||||
"2007-1-1", "2007-1-10", FALSE, 9
|
"2007-1-1", "2007-1-10", FALSE, 9
|
||||||
"2007-1-1", "2007-1-10", TRUE, 9
|
"2007-1-1", "2007-1-10", TRUE, 9
|
||||||
"2007-1-1", "2007-12-31", FALSE, 360
|
"2007-1-1", "2007-12-31", FALSE, 360
|
||||||
|
Loading…
Reference in New Issue
Block a user