mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Update PHPExcel library to 1.8.0
This commit is contained in:
parent
94751ba57b
commit
50990bc862
|
|
@ -20,7 +20,7 @@ FPDF_TPL 1.2 Apache Software License 2.0 Yes
|
|||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||
PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,18 +20,18 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
PHPExcel_Autoloader::Register();
|
||||
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||
// simple checks and initialisations
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||
// simple checks and initialisations
|
||||
//PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
PHPExcel_Shared_String::buildCharacterSets();
|
||||
|
||||
|
|
@ -39,47 +39,47 @@ PHPExcel_Shared_String::buildCharacterSets();
|
|||
/**
|
||||
* PHPExcel_Autoloader
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Autoloader
|
||||
{
|
||||
/**
|
||||
* Register the Autoloader with SPL
|
||||
*
|
||||
*/
|
||||
public static function Register() {
|
||||
if (function_exists('__autoload')) {
|
||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||
spl_autoload_register('__autoload');
|
||||
}
|
||||
// Register ourselves with SPL
|
||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
||||
} // function Register()
|
||||
/**
|
||||
* Register the Autoloader with SPL
|
||||
*
|
||||
*/
|
||||
public static function Register() {
|
||||
if (function_exists('__autoload')) {
|
||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||
spl_autoload_register('__autoload');
|
||||
}
|
||||
// Register ourselves with SPL
|
||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
||||
} // function Register()
|
||||
|
||||
|
||||
/**
|
||||
* Autoload a class identified by name
|
||||
*
|
||||
* @param string $pClassName Name of the object to load
|
||||
*/
|
||||
public static function Load($pClassName){
|
||||
if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||
// Either already loaded, or not a PHPExcel class request
|
||||
return FALSE;
|
||||
}
|
||||
/**
|
||||
* Autoload a class identified by name
|
||||
*
|
||||
* @param string $pClassName Name of the object to load
|
||||
*/
|
||||
public static function Load($pClassName){
|
||||
if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||
// Either already loaded, or not a PHPExcel class request
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$pClassFilePath = PHPEXCEL_ROOT .
|
||||
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
||||
'.php';
|
||||
$pClassFilePath = PHPEXCEL_ROOT .
|
||||
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
||||
'.php';
|
||||
|
||||
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
|
||||
// Can't load
|
||||
return FALSE;
|
||||
}
|
||||
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
|
||||
// Can't load
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
require($pClassFilePath);
|
||||
} // function Load()
|
||||
require($pClassFilePath);
|
||||
} // function Load()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,250 +31,265 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_cachePrefix = null;
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $_cacheTime = 600;
|
||||
/**
|
||||
* Cache timeout
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $_cacheTime = 600;
|
||||
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @access private
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
$this->_currentObject->detach();
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
|
||||
}
|
||||
$this->_currentCellIsDirty = false;
|
||||
}
|
||||
$this->_currentObjectID = $this->_currentObject = null;
|
||||
} // function _storeData()
|
||||
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
|
||||
}
|
||||
$this->_currentCellIsDirty = false;
|
||||
}
|
||||
$this->_currentObjectID = $this->_currentObject = null;
|
||||
} // function _storeData()
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
$this->_storeData();
|
||||
}
|
||||
$this->_cellCache[$pCoord] = true;
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
$this->_storeData();
|
||||
}
|
||||
$this->_cellCache[$pCoord] = true;
|
||||
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = $cell;
|
||||
$this->_currentCellIsDirty = true;
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = $cell;
|
||||
$this->_currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
} // function addCacheData()
|
||||
return $cell;
|
||||
} // function addCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return void
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord) {
|
||||
// Check if the requested entry is the current object, or exists in the cache
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
if ($this->_currentObjectID == $pCoord) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry still exists in apc
|
||||
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} // function isDataSet()
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return void
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord) {
|
||||
// Check if the requested entry is the current object, or exists in the cache
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
if ($this->_currentObjectID == $pCoord) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry still exists in apc
|
||||
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||
if ($success === FALSE) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} // function isDataSet()
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
return $this->_currentObject;
|
||||
}
|
||||
$this->_storeData();
|
||||
public function getCacheData($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
return $this->_currentObject;
|
||||
}
|
||||
$this->_storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||
if ($obj === FALSE) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize($obj);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize($obj);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
// Delete the entry from APC
|
||||
apc_delete($this->_cachePrefix.$pCoord.'.cache');
|
||||
public function deleteCacheData($pCoord) {
|
||||
// Delete the entry from APC
|
||||
apc_delete($this->_cachePrefix.$pCoord.'.cache');
|
||||
|
||||
// Delete the entry from our cell address array
|
||||
parent::deleteCacheData($pCoord);
|
||||
} // function deleteCacheData()
|
||||
// Delete the entry from our cell address array
|
||||
parent::deleteCacheData($pCoord);
|
||||
} // function deleteCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @access public
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||
$cacheList = $this->getCellList();
|
||||
foreach($cacheList as $cellID) {
|
||||
if ($cellID != $this->_currentObjectID) {
|
||||
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
|
||||
}
|
||||
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$cellID.' in APC');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_cachePrefix = $newCachePrefix;
|
||||
} // function copyCellCollection()
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @access public
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @throws PHPExcel_Exception
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||
$cacheList = $this->getCellList();
|
||||
foreach($cacheList as $cellID) {
|
||||
if ($cellID != $this->_currentObjectID) {
|
||||
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
|
||||
if ($obj === FALSE) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC');
|
||||
}
|
||||
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_cachePrefix = $newCachePrefix;
|
||||
} // function copyCellCollection()
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells() {
|
||||
if ($this->_currentObject !== NULL) {
|
||||
$this->_currentObject->detach();
|
||||
$this->_currentObject = $this->_currentObjectID = null;
|
||||
}
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells() {
|
||||
if ($this->_currentObject !== NULL) {
|
||||
$this->_currentObject->detach();
|
||||
$this->_currentObject = $this->_currentObjectID = null;
|
||||
}
|
||||
|
||||
// Flush the APC cache
|
||||
$this->__destruct();
|
||||
// Flush the APC cache
|
||||
$this->__destruct();
|
||||
|
||||
$this->_cellCache = array();
|
||||
$this->_cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->_parent = null;
|
||||
} // function unsetWorksheetCells()
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->_parent = null;
|
||||
} // function unsetWorksheetCells()
|
||||
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||
|
||||
if ($this->_cachePrefix === NULL) {
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||
$this->_cacheTime = $cacheTime;
|
||||
if ($this->_cachePrefix === NULL) {
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||
$this->_cacheTime = $cacheTime;
|
||||
|
||||
parent::__construct($parent);
|
||||
}
|
||||
} // function __construct()
|
||||
parent::__construct($parent);
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct() {
|
||||
$cacheList = $this->getCellList();
|
||||
foreach($cacheList as $cellID) {
|
||||
apc_delete($this->_cachePrefix.$cellID.'.cache');
|
||||
}
|
||||
} // function __destruct()
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct() {
|
||||
$cacheList = $this->getCellList();
|
||||
foreach($cacheList as $cellID) {
|
||||
apc_delete($this->_cachePrefix.$cellID.'.cache');
|
||||
}
|
||||
} // function __destruct()
|
||||
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable() {
|
||||
if (!function_exists('apc_store')) {
|
||||
return false;
|
||||
}
|
||||
if (apc_sma_info() === false) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable() {
|
||||
if (!function_exists('apc_store')) {
|
||||
return FALSE;
|
||||
}
|
||||
if (apc_sma_info() === FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
||||
|
||||
|
|
@ -86,6 +86,16 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
} // function __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Return the parent worksheet for this cell collection
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
|
|
@ -101,12 +111,33 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
} // function isDataSet()
|
||||
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress) {
|
||||
if ($fromAddress === $this->_currentObjectID) {
|
||||
$this->_currentObjectID = $toAddress;
|
||||
}
|
||||
$this->_currentCellIsDirty = true;
|
||||
if (isset($this->_cellCache[$fromAddress])) {
|
||||
$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
|
||||
unset($this->_cellCache[$fromAddress]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCacheData(PHPExcel_Cell $cell) {
|
||||
return $this->addCacheData($cell->getCoordinate(),$cell);
|
||||
|
|
@ -117,7 +148,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
|
|
@ -151,7 +182,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
public function getSortedCellList() {
|
||||
$sortKeys = array();
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
list($column,$row) = sscanf($coord,'%[A-Z]%d');
|
||||
sscanf($coord,'%[A-Z]%d', $column, $row);
|
||||
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
|
||||
}
|
||||
ksort($sortKeys);
|
||||
|
|
@ -172,7 +203,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
$col = array('A' => '1A');
|
||||
$row = array(1);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
list($c,$r) = sscanf($coord,'%[A-Z]%d');
|
||||
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||
$row[$r] = $r;
|
||||
$col[$c] = strlen($c).$c;
|
||||
}
|
||||
|
|
@ -188,26 +219,87 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the cell address of the currently active cell object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentAddress()
|
||||
{
|
||||
return $this->_currentObjectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the column address of the currently active cell object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentColumn()
|
||||
{
|
||||
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||
return $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the row address of the currently active cell object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentRow()
|
||||
{
|
||||
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet column
|
||||
*
|
||||
* @return string Highest column name
|
||||
* @param string $row Return the highest column for the specified row,
|
||||
* or the highest column of any row if no row number is passed
|
||||
* @return string Highest column name
|
||||
*/
|
||||
public function getHighestColumn()
|
||||
public function getHighestColumn($row = null)
|
||||
{
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['column'];
|
||||
}
|
||||
if ($row == null) {
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['column'];
|
||||
}
|
||||
|
||||
$columnList = array(1);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||
if ($r != $row) {
|
||||
continue;
|
||||
}
|
||||
$columnList[] = PHPExcel_Cell::columnIndexFromString($c);
|
||||
}
|
||||
return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet row
|
||||
*
|
||||
* @return int Highest row number
|
||||
* @param string $column Return the highest row for the specified column,
|
||||
* or the highest row of any column if no column letter is passed
|
||||
* @return int Highest row number
|
||||
*/
|
||||
public function getHighestRow()
|
||||
public function getHighestRow($column = null)
|
||||
{
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['row'];
|
||||
if ($column == null) {
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['row'];
|
||||
}
|
||||
|
||||
$rowList = array(0);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||
if ($c != $column) {
|
||||
continue;
|
||||
}
|
||||
$rowList[] = $r;
|
||||
}
|
||||
|
||||
return max($rowList);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -232,9 +324,12 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
$this->_currentCellIsDirty;
|
||||
$this->_storeData();
|
||||
|
||||
$this->_parent = $parent;
|
||||
if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
|
||||
$this->_currentObject->attach($parent);
|
||||
$this->_currentObject->attach($this);
|
||||
}
|
||||
} // function copyCellCollection()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -40,14 +40,14 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_fileName = null;
|
||||
private $_fileName = NULL;
|
||||
|
||||
/**
|
||||
* File handle for this cache file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $_fileHandle = null;
|
||||
private $_fileHandle = NULL;
|
||||
|
||||
/**
|
||||
* Directory/Folder where the cache file is located
|
||||
|
|
@ -62,10 +62,10 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
fseek($this->_fileHandle,0,SEEK_END);
|
||||
|
|
@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -124,14 +124,28 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||
$this->_currentObjectID = $pCoord;
|
||||
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
||||
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
|
|
@ -41,7 +41,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell);
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||
*
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCacheData(PHPExcel_Cell $cell);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||
*
|
||||
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getCacheData($pCoord);
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
|
||||
|
|
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -62,17 +62,17 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$obj = serialize($this->_currentObject);
|
||||
if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||
if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
|
||||
}
|
||||
}
|
||||
$this->_currentCellIsDirty = false;
|
||||
|
|
@ -87,7 +87,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -121,7 +121,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
if ($success === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
if ($obj === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
|
|
@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize($obj);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
// Delete the entry from Memcache
|
||||
|
|
@ -199,11 +213,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
if ($obj === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache');
|
||||
}
|
||||
if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$cellID.' in MemCache');
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -250,7 +264,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
// Set a new Memcache object and connect to the Memcache server
|
||||
$this->_memcache = new Memcache();
|
||||
if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
||||
throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
|
||||
throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
|
||||
}
|
||||
$this->_cacheTime = $cacheTime;
|
||||
|
||||
|
|
@ -264,10 +278,10 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||
*
|
||||
* @param string $host Memcache server
|
||||
* @param integer $port Memcache port
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function failureCallback($host, $port) {
|
||||
throw new Exception('memcache '.$host.':'.$port.' failed');
|
||||
throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,20 +31,32 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
/**
|
||||
* Dummy method callable from CacheBase, but unused by Memory cache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _storeData() {
|
||||
} // function _storeData()
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
$this->_cellCache[$pCoord] = $cell;
|
||||
|
||||
// Set current entry to the new/updated entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
|
||||
return $cell;
|
||||
} // function addCacheData()
|
||||
|
||||
|
|
@ -53,16 +65,20 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->_cellCache[$pCoord])) {
|
||||
$this->_currentObjectID = NULL;
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
|
||||
// Return requested entry
|
||||
return $this->_cellCache[$pCoord];
|
||||
} // function getCacheData()
|
||||
|
|
@ -80,7 +96,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
|||
$newCollection = array();
|
||||
foreach($this->_cellCache as $k => &$cell) {
|
||||
$newCollection[$k] = clone $cell;
|
||||
$newCollection[$k]->attach($parent);
|
||||
$newCollection[$k]->attach($this);
|
||||
}
|
||||
|
||||
$this->_cellCache = $newCollection;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject));
|
||||
|
|
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord]));
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
|
||||
|
|
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize($this->_cellCache[$pCoord]);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -54,10 +54,10 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
fseek($this->_fileHandle,0,SEEK_END);
|
||||
|
|
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -97,7 +97,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -116,14 +116,28 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||
$this->_currentObjectID = $pCoord;
|
||||
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
||||
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -54,14 +54,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
$this->_currentCellIsDirty = false;
|
||||
}
|
||||
$this->_currentObjectID = $this->_currentObject = null;
|
||||
|
|
@ -74,7 +74,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -93,7 +93,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||
if ($cellResultSet === false) {
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
} elseif ($cellResultSet->numRows() == 0) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
|
|
@ -116,8 +116,8 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
|
||||
$cellResult = $cellResultSet->fetchSingle();
|
||||
$this->_currentObject = unserialize($cellResult);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
|
|
@ -139,7 +139,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||
if ($cellResultSet === false) {
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
} elseif ($cellResultSet->numRows() == 0) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return false;
|
||||
|
|
@ -152,7 +152,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
|
|
@ -163,22 +163,52 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
// Check if the requested entry exists in the cache
|
||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
if (!$this->_DBHandle->queryExec($query))
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
|
||||
$this->_currentCellIsDirty = false;
|
||||
} // function deleteCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress) {
|
||||
if ($fromAddress === $this->_currentObjectID) {
|
||||
$this->_currentObjectID = $toAddress;
|
||||
}
|
||||
|
||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'";
|
||||
$result = $this->_DBHandle->exec($query);
|
||||
if ($result === false)
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
$query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
||||
$result = $this->_DBHandle->exec($query);
|
||||
if ($result === false)
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
return TRUE;
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||
$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
|
||||
if ($cellIdsResult === false)
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
|
||||
$cellKeys = array();
|
||||
foreach($cellIdsResult as $row) {
|
||||
|
|
@ -196,11 +226,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
$this->_currentCellIsDirty;
|
||||
$this->_storeData();
|
||||
|
||||
// Get a new id for the new table name
|
||||
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
|
||||
// Copy the existing cell cache file
|
||||
$this->_TableName = $tableName;
|
||||
|
|
@ -238,9 +271,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
|
||||
$this->_DBHandle = new SQLiteDatabase($_DBName);
|
||||
if ($this->_DBHandle === false)
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
|
|
@ -249,6 +282,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct() {
|
||||
if (!is_null($this->_DBHandle)) {
|
||||
$this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName);
|
||||
}
|
||||
$this->_DBHandle = null;
|
||||
} // function __destruct()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -49,23 +49,50 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
*/
|
||||
private $_DBHandle = null;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 select query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $_selectQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 insert query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $_insertQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 update query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $_updateQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 delete query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $_deleteQuery;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$query = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
|
||||
$query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
|
||||
$query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
|
||||
$result = $query->execute();
|
||||
$this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
|
||||
$this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
|
||||
$result = $this->_insertQuery->execute();
|
||||
if ($result === false)
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
$this->_currentCellIsDirty = false;
|
||||
}
|
||||
$this->_currentObjectID = $this->_currentObject = null;
|
||||
|
|
@ -78,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -97,7 +124,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -106,21 +133,23 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
}
|
||||
$this->_storeData();
|
||||
|
||||
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
$cellResult = $this->_DBHandle->querySingle($query);
|
||||
if ($cellResult === false) {
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
} elseif (is_null($cellResult)) {
|
||||
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||
$cellResult = $this->_selectQuery->execute();
|
||||
if ($cellResult === FALSE) {
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
}
|
||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||
if ($cellData === FALSE) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
|
||||
$this->_currentObject = unserialize($cellResult);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
$this->_currentObject = unserialize($cellData['value']);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
|
|
@ -135,19 +164,18 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
*/
|
||||
public function isDataSet($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
$cellResult = $this->_DBHandle->querySingle($query);
|
||||
if ($cellResult === false) {
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
} elseif (is_null($cellResult)) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return false;
|
||||
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||
$cellResult = $this->_selectQuery->execute();
|
||||
if ($cellResult === FALSE) {
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
}
|
||||
return true;
|
||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||
|
||||
return ($cellData === FALSE) ? FALSE : TRUE;
|
||||
} // function isDataSet()
|
||||
|
||||
|
||||
|
|
@ -155,34 +183,65 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
if ($pCoord === $this->_currentObjectID) {
|
||||
$this->_currentObject->detach();
|
||||
$this->_currentObjectID = $this->_currentObject = null;
|
||||
$this->_currentObjectID = $this->_currentObject = NULL;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||
$result = $this->_DBHandle->exec($query);
|
||||
if ($result === false)
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||
$result = $this->_deleteQuery->execute();
|
||||
if ($result === FALSE)
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
$this->_currentCellIsDirty = false;
|
||||
$this->_currentCellIsDirty = FALSE;
|
||||
} // function deleteCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress) {
|
||||
if ($fromAddress === $this->_currentObjectID) {
|
||||
$this->_currentObjectID = $toAddress;
|
||||
}
|
||||
|
||||
$this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT);
|
||||
$result = $this->_deleteQuery->execute();
|
||||
if ($result === false)
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
$this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT);
|
||||
$this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT);
|
||||
$result = $this->_updateQuery->execute();
|
||||
if ($result === false)
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
return TRUE;
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||
$cellIdsResult = $this->_DBHandle->query($query);
|
||||
if ($cellIdsResult === false)
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
$cellKeys = array();
|
||||
while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
|
||||
|
|
@ -200,11 +259,14 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
$this->_currentCellIsDirty;
|
||||
$this->_storeData();
|
||||
|
||||
// Get a new id for the new table name
|
||||
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
|
||||
// Copy the existing cell cache file
|
||||
$this->_TableName = $tableName;
|
||||
|
|
@ -242,10 +304,15 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
|
||||
$this->_DBHandle = new SQLite3($_DBName);
|
||||
if ($this->_DBHandle === false)
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
||||
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||
$this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
|
||||
$this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId");
|
||||
$this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||
} // function __construct()
|
||||
|
||||
|
||||
|
|
@ -254,6 +321,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||
*/
|
||||
public function __destruct() {
|
||||
if (!is_null($this->_DBHandle)) {
|
||||
$this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName);
|
||||
$this->_DBHandle->close();
|
||||
}
|
||||
$this->_DBHandle = null;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
|
@ -55,22 +55,22 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _storeData() {
|
||||
if ($this->_currentCellIsDirty) {
|
||||
protected function _storeData() {
|
||||
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||
$this->_currentObject->detach();
|
||||
|
||||
$obj = serialize($this->_currentObject);
|
||||
if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
|
||||
if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||
}
|
||||
} else {
|
||||
if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||
}
|
||||
}
|
||||
$this->_currentCellIsDirty = false;
|
||||
|
|
@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||
|
|
@ -119,7 +119,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
if ($success === false) {
|
||||
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord) {
|
||||
|
|
@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
if ($success === false) {
|
||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
|
|
@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
// Set current entry to the requested entry
|
||||
$this->_currentObjectID = $pCoord;
|
||||
$this->_currentObject = unserialize($obj);
|
||||
// Re-attach the parent worksheet
|
||||
$this->_currentObject->attach($this->_parent);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->_currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->_currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCellList() {
|
||||
if ($this->_currentObjectID !== null) {
|
||||
$this->_storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord) {
|
||||
// Delete the entry from Wincache
|
||||
|
|
@ -200,11 +214,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||
if ($success === false) {
|
||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||
}
|
||||
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,220 +20,232 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package 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
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorageFactory
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorageFactory
|
||||
{
|
||||
const cache_in_memory = 'Memory';
|
||||
const cache_in_memory_gzip = 'MemoryGZip';
|
||||
const cache_in_memory_serialized = 'MemorySerialized';
|
||||
const cache_igbinary = 'Igbinary';
|
||||
const cache_to_discISAM = 'DiscISAM';
|
||||
const cache_to_apc = 'APC';
|
||||
const cache_to_memcache = 'Memcache';
|
||||
const cache_to_phpTemp = 'PHPTemp';
|
||||
const cache_to_wincache = 'Wincache';
|
||||
const cache_to_sqlite = 'SQLite';
|
||||
const cache_to_sqlite3 = 'SQLite3';
|
||||
const cache_in_memory = 'Memory';
|
||||
const cache_in_memory_gzip = 'MemoryGZip';
|
||||
const cache_in_memory_serialized = 'MemorySerialized';
|
||||
const cache_igbinary = 'Igbinary';
|
||||
const cache_to_discISAM = 'DiscISAM';
|
||||
const cache_to_apc = 'APC';
|
||||
const cache_to_memcache = 'Memcache';
|
||||
const cache_to_phpTemp = 'PHPTemp';
|
||||
const cache_to_wincache = 'Wincache';
|
||||
const cache_to_sqlite = 'SQLite';
|
||||
const cache_to_sqlite3 = 'SQLite3';
|
||||
|
||||
|
||||
/**
|
||||
* Name of the method used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_cacheStorageMethod = NULL;
|
||||
/**
|
||||
* Name of the method used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_cacheStorageMethod = NULL;
|
||||
|
||||
/**
|
||||
* Name of the class used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_cacheStorageClass = NULL;
|
||||
/**
|
||||
* Name of the class used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_cacheStorageClass = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* List of all possible cache storage methods
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_storageMethods = array(
|
||||
self::cache_in_memory,
|
||||
self::cache_in_memory_gzip,
|
||||
self::cache_in_memory_serialized,
|
||||
self::cache_igbinary,
|
||||
self::cache_to_phpTemp,
|
||||
self::cache_to_discISAM,
|
||||
self::cache_to_apc,
|
||||
self::cache_to_memcache,
|
||||
self::cache_to_wincache,
|
||||
self::cache_to_sqlite,
|
||||
self::cache_to_sqlite3,
|
||||
);
|
||||
/**
|
||||
* List of all possible cache storage methods
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_storageMethods = array(
|
||||
self::cache_in_memory,
|
||||
self::cache_in_memory_gzip,
|
||||
self::cache_in_memory_serialized,
|
||||
self::cache_igbinary,
|
||||
self::cache_to_phpTemp,
|
||||
self::cache_to_discISAM,
|
||||
self::cache_to_apc,
|
||||
self::cache_to_memcache,
|
||||
self::cache_to_wincache,
|
||||
self::cache_to_sqlite,
|
||||
self::cache_to_sqlite3,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Default arguments for each cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $_storageMethodDefaultParameters = array(
|
||||
self::cache_in_memory => array(
|
||||
),
|
||||
self::cache_in_memory_gzip => array(
|
||||
),
|
||||
self::cache_in_memory_serialized => array(
|
||||
),
|
||||
self::cache_igbinary => array(
|
||||
),
|
||||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||
),
|
||||
self::cache_to_discISAM => array( 'dir' => NULL
|
||||
),
|
||||
self::cache_to_apc => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
||||
'memcachePort' => 11211,
|
||||
'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_wincache => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_sqlite => array(
|
||||
),
|
||||
self::cache_to_sqlite3 => array(
|
||||
),
|
||||
);
|
||||
/**
|
||||
* Default arguments for each cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $_storageMethodDefaultParameters = array(
|
||||
self::cache_in_memory => array(
|
||||
),
|
||||
self::cache_in_memory_gzip => array(
|
||||
),
|
||||
self::cache_in_memory_serialized => array(
|
||||
),
|
||||
self::cache_igbinary => array(
|
||||
),
|
||||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||
),
|
||||
self::cache_to_discISAM => array( 'dir' => NULL
|
||||
),
|
||||
self::cache_to_apc => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
||||
'memcachePort' => 11211,
|
||||
'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_wincache => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_sqlite => array(
|
||||
),
|
||||
self::cache_to_sqlite3 => array(
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Arguments for the active cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $_storageMethodParameters = array();
|
||||
/**
|
||||
* Arguments for the active cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $_storageMethodParameters = array();
|
||||
|
||||
|
||||
/**
|
||||
* Return the current cache storage method
|
||||
*
|
||||
* @return string|NULL
|
||||
**/
|
||||
public static function getCacheStorageMethod()
|
||||
/**
|
||||
* Return the current cache storage method
|
||||
*
|
||||
* @return string|NULL
|
||||
**/
|
||||
public static function getCacheStorageMethod()
|
||||
{
|
||||
return self::$_cacheStorageMethod;
|
||||
} // function getCacheStorageMethod()
|
||||
|
||||
|
||||
/**
|
||||
* Return the current cache storage class
|
||||
*
|
||||
* @return PHPExcel_CachedObjectStorage_ICache|NULL
|
||||
**/
|
||||
public static function getCacheStorageClass()
|
||||
{
|
||||
return self::$_cacheStorageClass;
|
||||
} // function getCacheStorageClass()
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of all possible cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getAllCacheStorageMethods()
|
||||
{
|
||||
return self::$_storageMethods;
|
||||
} // function getCacheStorageMethods()
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of all available cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getCacheStorageMethods()
|
||||
{
|
||||
$activeMethods = array();
|
||||
foreach(self::$_storageMethods as $storageMethod) {
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
||||
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
||||
$activeMethods[] = $storageMethod;
|
||||
}
|
||||
}
|
||||
return $activeMethods;
|
||||
} // function getCacheStorageMethods()
|
||||
|
||||
|
||||
/**
|
||||
* Identify the cache storage method to use
|
||||
*
|
||||
* @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
|
||||
* when instantiating
|
||||
* @return boolean
|
||||
**/
|
||||
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
||||
{
|
||||
if (!in_array($method,self::$_storageMethods)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
||||
if (!call_user_func(array( $cacheStorageClass,
|
||||
'cacheMethodIsAvailable'))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
||||
foreach($arguments as $k => $v) {
|
||||
if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
|
||||
self::$_storageMethodParameters[$method][$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$_cacheStorageMethod === NULL) {
|
||||
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
||||
self::$_cacheStorageMethod = $method;
|
||||
}
|
||||
return TRUE;
|
||||
} // function initialize()
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the cache storage
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
||||
* @return PHPExcel_CachedObjectStorage_ICache
|
||||
**/
|
||||
public static function getInstance(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$cacheMethodIsAvailable = TRUE;
|
||||
if (self::$_cacheStorageMethod === NULL) {
|
||||
$cacheMethodIsAvailable = self::initialize();
|
||||
}
|
||||
|
||||
if ($cacheMethodIsAvailable) {
|
||||
$instance = new self::$_cacheStorageClass( $parent,
|
||||
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
||||
);
|
||||
if ($instance !== NULL) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} // function getInstance()
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cache storage
|
||||
*
|
||||
**/
|
||||
public static function finalize()
|
||||
{
|
||||
return self::$_cacheStorageMethod;
|
||||
} // function getCacheStorageMethod()
|
||||
self::$_cacheStorageMethod = NULL;
|
||||
self::$_cacheStorageClass = NULL;
|
||||
self::$_storageMethodParameters = array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the current cache storage class
|
||||
*
|
||||
* @return PHPExcel_CachedObjectStorage_ICache|NULL
|
||||
**/
|
||||
public static function getCacheStorageClass()
|
||||
{
|
||||
return self::$_cacheStorageClass;
|
||||
} // function getCacheStorageClass()
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of all possible cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getAllCacheStorageMethods()
|
||||
{
|
||||
return self::$_storageMethods;
|
||||
} // function getCacheStorageMethods()
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of all available cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getCacheStorageMethods()
|
||||
{
|
||||
$activeMethods = array();
|
||||
foreach(self::$_storageMethods as $storageMethod) {
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
||||
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
||||
$activeMethods[] = $storageMethod;
|
||||
}
|
||||
}
|
||||
return $activeMethods;
|
||||
} // function getCacheStorageMethods()
|
||||
|
||||
|
||||
/**
|
||||
* Identify the cache storage method to use
|
||||
*
|
||||
* @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
|
||||
* when instantiating
|
||||
* @return boolean
|
||||
**/
|
||||
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
||||
{
|
||||
if (!in_array($method,self::$_storageMethods)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
||||
if (!call_user_func(array( $cacheStorageClass,
|
||||
'cacheMethodIsAvailable'))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
||||
foreach($arguments as $k => $v) {
|
||||
if (isset(self::$_storageMethodParameters[$method][$k])) {
|
||||
self::$_storageMethodParameters[$method][$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$_cacheStorageMethod === NULL) {
|
||||
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
||||
self::$_cacheStorageMethod = $method;
|
||||
}
|
||||
return TRUE;
|
||||
} // function initialize()
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the cache storage
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
||||
* @return PHPExcel_CachedObjectStorage_ICache
|
||||
**/
|
||||
public static function getInstance(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$cacheMethodIsAvailable = TRUE;
|
||||
if (self::$_cacheStorageMethod === NULL) {
|
||||
$cacheMethodIsAvailable = self::initialize();
|
||||
}
|
||||
|
||||
if ($cacheMethodIsAvailable) {
|
||||
$instance = new self::$_cacheStorageClass( $parent,
|
||||
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
||||
);
|
||||
if ($instance !== NULL) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} // function getInstance()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
*
|
||||
* @category PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CalcEngine_CyclicReferenceStack {
|
||||
|
||||
/**
|
||||
* The call stack for calculated cells
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $_stack = array();
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->_stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function push($value) {
|
||||
$this->_stack[] = $value;
|
||||
} // function push()
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop() {
|
||||
return array_pop($this->_stack);
|
||||
} // function pop()
|
||||
|
||||
/**
|
||||
* Test to see if a specified entry exists on the stack
|
||||
*
|
||||
* @param mixed $value The value to test
|
||||
*/
|
||||
public function onStack($value) {
|
||||
return in_array($value, $this->_stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
*/
|
||||
public function clear() {
|
||||
$this->_stack = array();
|
||||
} // function push()
|
||||
|
||||
/**
|
||||
* Return an array of all entries on the stack
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function showStack() {
|
||||
return $this->_stack;
|
||||
}
|
||||
|
||||
} // class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
153
htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php
Normal file
153
htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPExcel_CalcEngine_Logger
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CalcEngine_Logger {
|
||||
|
||||
/**
|
||||
* Flag to determine whether a debug log should be generated by the calculation engine
|
||||
* If true, then a debug log will be generated
|
||||
* If false, then a debug log will not be generated
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_writeDebugLog = FALSE;
|
||||
|
||||
/**
|
||||
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||
* If true, then a debug log will be echoed
|
||||
* If false, then a debug log will not be echoed
|
||||
* A debug log can only be echoed if it is generated
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_echoDebugLog = FALSE;
|
||||
|
||||
/**
|
||||
* The debug log generated by the calculation engine
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $_debugLog = array();
|
||||
|
||||
/**
|
||||
* The calculation engine cell reference stack
|
||||
*
|
||||
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
*/
|
||||
private $_cellStack;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a Calculation engine logger
|
||||
*
|
||||
* @param PHPExcel_CalcEngine_CyclicReferenceStack $stack
|
||||
*/
|
||||
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) {
|
||||
$this->_cellStack = $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable Calculation engine logging
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*/
|
||||
public function setWriteDebugLog($pValue = FALSE) {
|
||||
$this->_writeDebugLog = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether calculation engine logging is enabled or disabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getWriteDebugLog() {
|
||||
return $this->_writeDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable echoing of debug log information
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*/
|
||||
public function setEchoDebugLog($pValue = FALSE) {
|
||||
$this->_echoDebugLog = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether echoing of debug log information is enabled or disabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEchoDebugLog() {
|
||||
return $this->_echoDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an entry to the calculation engine debug log
|
||||
*/
|
||||
public function writeDebugLog() {
|
||||
// Only write the debug log if logging is enabled
|
||||
if ($this->_writeDebugLog) {
|
||||
$message = implode(func_get_args());
|
||||
$cellReference = implode(' -> ', $this->_cellStack->showStack());
|
||||
if ($this->_echoDebugLog) {
|
||||
echo $cellReference,
|
||||
($this->_cellStack->count() > 0 ? ' => ' : ''),
|
||||
$message,
|
||||
PHP_EOL;
|
||||
}
|
||||
$this->_debugLog[] = $cellReference .
|
||||
($this->_cellStack->count() > 0 ? ' => ' : '') .
|
||||
$message;
|
||||
}
|
||||
} // function _writeDebug()
|
||||
|
||||
/**
|
||||
* Clear the calculation engine debug log
|
||||
*/
|
||||
public function clearLog() {
|
||||
$this->_debugLog = array();
|
||||
} // function flushLogger()
|
||||
|
||||
/**
|
||||
* Return the calculation engine debug log
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getLog() {
|
||||
return $this->_debugLog;
|
||||
} // function flushLogger()
|
||||
|
||||
} // class PHPExcel_CalcEngine_Logger
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Database {
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_DateTime {
|
||||
|
||||
|
|
@ -56,6 +56,18 @@ class PHPExcel_Calculation_DateTime {
|
|||
} // function _isLeapYear()
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of days between two dates based on a 360 day calendar
|
||||
*
|
||||
* @param integer $startDay Day of month of the start date
|
||||
* @param integer $startMonth Month of the start date
|
||||
* @param integer $startYear Year of the start date
|
||||
* @param integer $endDay Day of month of the start date
|
||||
* @param integer $endMonth Month of the start date
|
||||
* @param integer $endYear Year of the start date
|
||||
* @param boolean $methodUS Whether to use the US method or the European method of calculation
|
||||
* @return integer Number of days between the start date and the end date
|
||||
*/
|
||||
private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
|
||||
if ($startDay == 31) {
|
||||
--$startDay;
|
||||
|
|
@ -92,7 +104,7 @@ class PHPExcel_Calculation_DateTime {
|
|||
(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) {
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||
$dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
|
||||
} else {
|
||||
$saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
|
|
@ -238,6 +250,10 @@ class PHPExcel_Calculation_DateTime {
|
|||
* Excel Function:
|
||||
* 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
|
||||
* @category Date/Time Functions
|
||||
* @param integer $year The value of the year argument can include one to four digits.
|
||||
|
|
@ -278,6 +294,14 @@ class PHPExcel_Calculation_DateTime {
|
|||
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
||||
$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;
|
||||
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
||||
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
||||
|
|
@ -720,6 +744,10 @@ class PHPExcel_Calculation_DateTime {
|
|||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (!is_bool($method)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
// Execute function
|
||||
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
||||
$startDay = $PHPStartDateObject->format('j');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ define('EULER', 2.71828182845904523536);
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Engineering {
|
||||
|
||||
|
|
@ -741,8 +741,6 @@ class PHPExcel_Calculation_Engineering {
|
|||
|
||||
|
||||
/**
|
||||
* _cleanComplex
|
||||
*
|
||||
* Cleans the leading characters in a complex number string
|
||||
*
|
||||
* @param string $complexNumber The complex number to clean
|
||||
|
|
@ -756,20 +754,25 @@ class PHPExcel_Calculation_Engineering {
|
|||
return $complexNumber;
|
||||
}
|
||||
|
||||
|
||||
private static function _nbrConversionFormat($xVal,$places) {
|
||||
/**
|
||||
* Formats a number base string value with leading zeroes
|
||||
*
|
||||
* @param string $xVal The "number" to pad
|
||||
* @param integer $places The length that we want to pad this value
|
||||
* @return string The padded "number"
|
||||
*/
|
||||
private static function _nbrConversionFormat($xVal, $places) {
|
||||
if (!is_null($places)) {
|
||||
if (strlen($xVal) <= $places) {
|
||||
return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10);
|
||||
return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
}
|
||||
|
||||
return substr($xVal,-10);
|
||||
return substr($xVal, -10);
|
||||
} // function _nbrConversionFormat()
|
||||
|
||||
|
||||
/**
|
||||
* BESSELI
|
||||
*
|
||||
|
|
@ -1932,7 +1935,7 @@ class PHPExcel_Calculation_Engineering {
|
|||
/**
|
||||
* IMLOG2
|
||||
*
|
||||
* Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
|
||||
* Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.
|
||||
*
|
||||
* Excel Function:
|
||||
* IMLOG2(complexNumber)
|
||||
|
|
@ -2356,7 +2359,6 @@ class PHPExcel_Calculation_Engineering {
|
|||
* Returns an array of units of measure, for a specified conversion group, or for all groups
|
||||
*
|
||||
* @param string $group The group whose units of measure you want to retrieve
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getConversionGroupUnits($group = NULL) {
|
||||
|
|
@ -2373,6 +2375,7 @@ class PHPExcel_Calculation_Engineering {
|
|||
/**
|
||||
* getConversionGroupUnitDetails
|
||||
*
|
||||
* @param string $group The group whose units of measure you want to retrieve
|
||||
* @return array
|
||||
*/
|
||||
public static function getConversionGroupUnitDetails($group = NULL) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,9 +31,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Exception extends Exception {
|
||||
class PHPExcel_Calculation_Exception extends PHPExcel_Exception {
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_ExceptionHandler {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ define('FINANCIAL_PRECISION', 1.0e-08);
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Financial {
|
||||
|
||||
|
|
@ -1206,13 +1206,22 @@ class PHPExcel_Calculation_Financial {
|
|||
/**
|
||||
* FVSCHEDULE
|
||||
*
|
||||
* Returns the future value of an initial principal after applying a series of compound interest rates.
|
||||
* Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
|
||||
*
|
||||
* Excel Function:
|
||||
* FVSCHEDULE(principal,schedule)
|
||||
*
|
||||
* @param float $principal The present value.
|
||||
* @param float[] $schedule An array of interest rates to apply.
|
||||
* @return float
|
||||
*/
|
||||
public static function FVSCHEDULE($principal, $schedule) {
|
||||
$principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
|
||||
$schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
|
||||
|
||||
foreach($schedule as $n) {
|
||||
$principal *= 1 + $n;
|
||||
foreach($schedule as $rate) {
|
||||
$principal *= 1 + $rate;
|
||||
}
|
||||
|
||||
return $principal;
|
||||
|
|
@ -1227,13 +1236,13 @@ class PHPExcel_Calculation_Financial {
|
|||
* Excel Function:
|
||||
* INTRATE(settlement,maturity,investment,redemption[,basis])
|
||||
*
|
||||
* @param mixed settlement The security's settlement date.
|
||||
* @param mixed $settlement The security's settlement date.
|
||||
* The security settlement date is the date after the issue date when the security is traded to the buyer.
|
||||
* @param mixed maturity The security's maturity date.
|
||||
* @param mixed $maturity The security's maturity date.
|
||||
* The maturity date is the date when the security expires.
|
||||
* @param integer investment The amount invested in the security.
|
||||
* @param integer redemption The amount to be received at maturity.
|
||||
* @param integer basis The type of day count to use.
|
||||
* @param integer $investment The amount invested in the security.
|
||||
* @param integer $redemption The amount to be received at maturity.
|
||||
* @param integer $basis The type of day count to use.
|
||||
* 0 or omitted US (NASD) 30/360
|
||||
* 1 Actual/actual
|
||||
* 2 Actual/360
|
||||
|
|
@ -1273,6 +1282,9 @@ class PHPExcel_Calculation_Financial {
|
|||
*
|
||||
* Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
|
||||
*
|
||||
* Excel Function:
|
||||
* IPMT(rate,per,nper,pv[,fv][,type])
|
||||
*
|
||||
* @param float $rate Interest rate per period
|
||||
* @param int $per Period for which we want to find the interest
|
||||
* @param int $nper Number of periods
|
||||
|
|
@ -1302,7 +1314,25 @@ class PHPExcel_Calculation_Financial {
|
|||
return $interestAndPrincipal[0];
|
||||
} // function IPMT()
|
||||
|
||||
|
||||
/**
|
||||
* IRR
|
||||
*
|
||||
* Returns the internal rate of return for a series of cash flows represented by the numbers in values.
|
||||
* These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
|
||||
* at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
|
||||
* for an investment consisting of payments (negative values) and income (positive values) that occur at regular
|
||||
* periods.
|
||||
*
|
||||
* Excel Function:
|
||||
* IRR(values[,guess])
|
||||
*
|
||||
* @param float[] $values An array or a reference to cells that contain numbers for which you want
|
||||
* to calculate the internal rate of return.
|
||||
* Values must contain at least one positive value and one negative value to
|
||||
* calculate the internal rate of return.
|
||||
* @param float $guess A number that you guess is close to the result of IRR
|
||||
* @return float
|
||||
*/
|
||||
public static function IRR($values, $guess = 0.1) {
|
||||
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
||||
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
||||
|
|
@ -1336,28 +1366,30 @@ class PHPExcel_Calculation_Financial {
|
|||
$dx *= 0.5;
|
||||
$x_mid = $rtb + $dx;
|
||||
$f_mid = self::NPV($x_mid, $values);
|
||||
if ($f_mid <= 0.0) $rtb = $x_mid;
|
||||
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
|
||||
if ($f_mid <= 0.0)
|
||||
$rtb = $x_mid;
|
||||
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION))
|
||||
return $x_mid;
|
||||
}
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} // function IRR()
|
||||
|
||||
|
||||
/**
|
||||
* ISPMT
|
||||
* ISPMT
|
||||
*
|
||||
* Returns the interest payment for an investment based on an interest rate and a constant payment schedule.
|
||||
* Returns the interest payment for an investment based on an interest rate and a constant payment schedule.
|
||||
*
|
||||
* Excel Function:
|
||||
* =ISPMT(interest_rate, period, number_payments, PV)
|
||||
* Excel Function:
|
||||
* =ISPMT(interest_rate, period, number_payments, PV)
|
||||
*
|
||||
* interest_rate is the interest rate for the investment
|
||||
* interest_rate is the interest rate for the investment
|
||||
*
|
||||
* period is the period to calculate the interest rate. It must be betweeen 1 and number_payments.
|
||||
* period is the period to calculate the interest rate. It must be betweeen 1 and number_payments.
|
||||
*
|
||||
* number_payments is the number of payments for the annuity
|
||||
* number_payments is the number of payments for the annuity
|
||||
*
|
||||
* PV is the loan amount or present value of the payments
|
||||
* PV is the loan amount or present value of the payments
|
||||
*/
|
||||
public static function ISPMT() {
|
||||
// Return value
|
||||
|
|
@ -1384,6 +1416,22 @@ class PHPExcel_Calculation_Financial {
|
|||
} // function ISPMT()
|
||||
|
||||
|
||||
/**
|
||||
* MIRR
|
||||
*
|
||||
* Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
|
||||
* the cost of the investment and the interest received on reinvestment of cash.
|
||||
*
|
||||
* Excel Function:
|
||||
* MIRR(values,finance_rate, reinvestment_rate)
|
||||
*
|
||||
* @param float[] $values An array or a reference to cells that contain a series of payments and
|
||||
* income occurring at regular intervals.
|
||||
* Payments are negative value, income is positive values.
|
||||
* @param float $finance_rate The interest rate you pay on the money used in the cash flows
|
||||
* @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them
|
||||
* @return float
|
||||
*/
|
||||
public static function MIRR($values, $finance_rate, $reinvestment_rate) {
|
||||
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
||||
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
||||
|
|
@ -1475,14 +1523,11 @@ class PHPExcel_Calculation_Financial {
|
|||
}
|
||||
} // function NPER()
|
||||
|
||||
|
||||
/**
|
||||
* NPV
|
||||
*
|
||||
* Returns the Net Present Value of a cash flow series given a discount rate.
|
||||
*
|
||||
* @param float Discount interest rate
|
||||
* @param array Cash flow series
|
||||
* @return float
|
||||
*/
|
||||
public static function NPV() {
|
||||
|
|
@ -1505,7 +1550,6 @@ class PHPExcel_Calculation_Financial {
|
|||
return $returnValue;
|
||||
} // function NPV()
|
||||
|
||||
|
||||
/**
|
||||
* PMT
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ PARTLY BASED ON:
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_FormulaParser {
|
||||
/* Character constants */
|
||||
|
|
@ -93,13 +93,13 @@ class PHPExcel_Calculation_FormulaParser {
|
|||
* Create a new PHPExcel_Calculation_FormulaParser
|
||||
*
|
||||
* @param string $pFormula Formula to parse
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function __construct($pFormula = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (is_null($pFormula)) {
|
||||
throw new Exception("Invalid parameter passed: formula");
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
|
||||
}
|
||||
|
||||
// Initialise values
|
||||
|
|
@ -122,13 +122,13 @@ class PHPExcel_Calculation_FormulaParser {
|
|||
*
|
||||
* @param int $pId Token id
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function getToken($pId = 0) {
|
||||
if (isset($this->_tokens[$pId])) {
|
||||
return $this->_tokens[$pId];
|
||||
} else {
|
||||
throw new Exception("Token with id $pId does not exist.");
|
||||
throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ PARTLY BASED ON:
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_FormulaToken {
|
||||
/* Token types */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Function {
|
||||
/* Function categories */
|
||||
|
|
@ -74,7 +74,7 @@ class PHPExcel_Calculation_Function {
|
|||
* @param string $pCategory Category (represented by CATEGORY_*)
|
||||
* @param string $pExcelName Excel function name
|
||||
* @param string $pPHPExcelName PHPExcel function mapping
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ class PHPExcel_Calculation_Function {
|
|||
$this->_excelName = $pExcelName;
|
||||
$this->_phpExcelName = $pPHPExcelName;
|
||||
} else {
|
||||
throw new Exception("Invalid parameters passed.");
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,13 +101,13 @@ class PHPExcel_Calculation_Function {
|
|||
* Set Category (represented by CATEGORY_*)
|
||||
*
|
||||
* @param string $value
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function setCategory($value = null) {
|
||||
if (!is_null($value)) {
|
||||
$this->_category = $value;
|
||||
} else {
|
||||
throw new Exception("Invalid parameter passed.");
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ define('PRECISION', 8.88E-016);
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Functions {
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ class PHPExcel_Calculation_Functions {
|
|||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #REF!
|
||||
* @return string #NULL!
|
||||
*/
|
||||
public static function NULL() {
|
||||
return self::$_errorCodes['null'];
|
||||
|
|
@ -308,13 +308,20 @@ class PHPExcel_Calculation_Functions {
|
|||
|
||||
public static function _ifCondition($condition) {
|
||||
$condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||
if (!isset($condition{0}))
|
||||
$condition = '=""';
|
||||
if (!in_array($condition{0},array('>', '<', '='))) {
|
||||
if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); }
|
||||
return '='.$condition;
|
||||
} else {
|
||||
preg_match('/([<>=]+)(.*)/',$condition,$matches);
|
||||
list(,$operator,$operand) = $matches;
|
||||
if (!is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); }
|
||||
|
||||
if (!is_numeric($operand)) {
|
||||
$operand = str_replace('"', '""', $operand);
|
||||
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand));
|
||||
}
|
||||
|
||||
return $operator.$operand;
|
||||
}
|
||||
} // function _ifCondition()
|
||||
|
|
@ -489,7 +496,7 @@ class PHPExcel_Calculation_Functions {
|
|||
* @return string Version information
|
||||
*/
|
||||
public static function VERSION() {
|
||||
return 'PHPExcel 1.7.8, 2012-10-12';
|
||||
return 'PHPExcel 1.8.0, 2014-03-02';
|
||||
} // function VERSION()
|
||||
|
||||
|
||||
|
|
@ -687,100 +694,6 @@ if (!function_exists('atanh')) {
|
|||
} // function atanh()
|
||||
}
|
||||
|
||||
if (!function_exists('money_format')) {
|
||||
function money_format($format, $number) {
|
||||
$regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?',
|
||||
'(?:\.([0-9]+))?([in%])/'
|
||||
);
|
||||
$regex = implode('', $regex);
|
||||
if (setlocale(LC_MONETARY, null) == '') {
|
||||
setlocale(LC_MONETARY, '');
|
||||
}
|
||||
$locale = localeconv();
|
||||
$number = floatval($number);
|
||||
if (!preg_match($regex, $format, $fmatch)) {
|
||||
trigger_error("No format specified or invalid format", E_USER_WARNING);
|
||||
return $number;
|
||||
}
|
||||
$flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ',
|
||||
'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
|
||||
'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+',
|
||||
'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
|
||||
'isleft' => preg_match('/\-/', $fmatch[1]) > 0
|
||||
);
|
||||
$width = trim($fmatch[2]) ? (int)$fmatch[2] : 0;
|
||||
$left = trim($fmatch[3]) ? (int)$fmatch[3] : 0;
|
||||
$right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits'];
|
||||
$conversion = $fmatch[5];
|
||||
$positive = true;
|
||||
if ($number < 0) {
|
||||
$positive = false;
|
||||
$number *= -1;
|
||||
}
|
||||
$letter = $positive ? 'p' : 'n';
|
||||
$prefix = $suffix = $cprefix = $csuffix = $signal = '';
|
||||
if (!$positive) {
|
||||
$signal = $locale['negative_sign'];
|
||||
switch (true) {
|
||||
case $locale['n_sign_posn'] == 0 || $flags['usesignal'] == '(':
|
||||
$prefix = '(';
|
||||
$suffix = ')';
|
||||
break;
|
||||
case $locale['n_sign_posn'] == 1:
|
||||
$prefix = $signal;
|
||||
break;
|
||||
case $locale['n_sign_posn'] == 2:
|
||||
$suffix = $signal;
|
||||
break;
|
||||
case $locale['n_sign_posn'] == 3:
|
||||
$cprefix = $signal;
|
||||
break;
|
||||
case $locale['n_sign_posn'] == 4:
|
||||
$csuffix = $signal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$flags['nosimbol']) {
|
||||
$currency = $cprefix;
|
||||
$currency .= ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']);
|
||||
$currency .= $csuffix;
|
||||
$currency = iconv('ISO-8859-1','UTF-8',$currency);
|
||||
} else {
|
||||
$currency = '';
|
||||
}
|
||||
$space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
|
||||
|
||||
if (!isset($locale['mon_decimal_point']) || empty($locale['mon_decimal_point'])) {
|
||||
$locale['mon_decimal_point'] = (!isset($locale['decimal_point']) || empty($locale['decimal_point'])) ?
|
||||
$locale['decimal_point'] :
|
||||
'.';
|
||||
}
|
||||
|
||||
$number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep'] );
|
||||
$number = explode($locale['mon_decimal_point'], $number);
|
||||
|
||||
$n = strlen($prefix) + strlen($currency);
|
||||
if ($left > 0 && $left > $n) {
|
||||
if ($flags['isleft']) {
|
||||
$number[0] .= str_repeat($flags['fillchar'], $left - $n);
|
||||
} else {
|
||||
$number[0] = str_repeat($flags['fillchar'], $left - $n) . $number[0];
|
||||
}
|
||||
}
|
||||
$number = implode($locale['mon_decimal_point'], $number);
|
||||
if ($locale["{$letter}_cs_precedes"]) {
|
||||
$number = $prefix . $currency . $space . $number . $suffix;
|
||||
} else {
|
||||
$number = $prefix . $number . $space . $currency . $suffix;
|
||||
}
|
||||
if ($width > 0) {
|
||||
$number = str_pad($number, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT);
|
||||
}
|
||||
$format = str_replace($fmatch[0], $number, $format);
|
||||
return $format;
|
||||
} // function money_format()
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Strangely, PHP doesn't have a mb_str_replace multibyte function
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Logical {
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_LookupRef {
|
||||
|
||||
|
|
@ -251,8 +251,9 @@ class PHPExcel_Calculation_LookupRef {
|
|||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param string $linkURL Value to check, is also the value returned when no error
|
||||
* @param string $displayName Value to return when testValue is an error condition
|
||||
* @param string $linkURL Value to check, is also the value returned when no error
|
||||
* @param string $displayName Value to return when testValue is an error condition
|
||||
* @param PHPExcel_Cell $pCell The cell to set the hyperlink in
|
||||
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||
*/
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) {
|
||||
|
|
@ -287,13 +288,14 @@ class PHPExcel_Calculation_LookupRef {
|
|||
*
|
||||
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
|
||||
* @param PHPExcel_Cell $pCell The current cell (containing this formula)
|
||||
* @return mixed The cells referenced by cellAddress
|
||||
*
|
||||
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||
*
|
||||
*/
|
||||
public static function INDIRECT($cellAddress=Null, PHPExcel_Cell $pCell = null) {
|
||||
public static function INDIRECT($cellAddress = NULL, PHPExcel_Cell $pCell = NULL) {
|
||||
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
|
|
@ -307,29 +309,30 @@ class PHPExcel_Calculation_LookupRef {
|
|||
|
||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
||||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
|
||||
|
||||
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
if (strpos($cellAddress,'!') !== false) {
|
||||
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
||||
if (strpos($cellAddress,'!') !== FALSE) {
|
||||
list($sheetName, $cellAddress) = explode('!',$cellAddress);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getParent();
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False);
|
||||
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE);
|
||||
}
|
||||
|
||||
if (strpos($cellAddress,'!') !== false) {
|
||||
if (strpos($cellAddress,'!') !== FALSE) {
|
||||
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getParent();
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE);
|
||||
} // function INDIRECT()
|
||||
|
||||
|
||||
|
|
@ -373,9 +376,10 @@ class PHPExcel_Calculation_LookupRef {
|
|||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$sheetName = null;
|
||||
$sheetName = NULL;
|
||||
if (strpos($cellAddress,"!")) {
|
||||
list($sheetName,$cellAddress) = explode("!",$cellAddress);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
}
|
||||
if (strpos($cellAddress,":")) {
|
||||
list($startCell,$endCell) = explode(":",$cellAddress);
|
||||
|
|
@ -416,10 +420,10 @@ class PHPExcel_Calculation_LookupRef {
|
|||
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
||||
}
|
||||
|
||||
if ($sheetName !== null) {
|
||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
||||
if ($sheetName !== NULL) {
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getParent();
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||
|
|
@ -458,7 +462,7 @@ class PHPExcel_Calculation_LookupRef {
|
|||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$chosenEntry = floor($chosenEntry);
|
||||
if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) {
|
||||
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
|
|
@ -717,7 +721,8 @@ class PHPExcel_Calculation_LookupRef {
|
|||
|
||||
$rowNumber = $rowValue = False;
|
||||
foreach($lookup_array as $rowKey => $rowData) {
|
||||
if (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)) {
|
||||
if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
|
||||
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
|
||||
break;
|
||||
}
|
||||
$rowNumber = $rowKey;
|
||||
|
|
@ -730,7 +735,11 @@ class PHPExcel_Calculation_LookupRef {
|
|||
return PHPExcel_Calculation_Functions::NA();
|
||||
} else {
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$rowNumber][$returnColumn];
|
||||
$result = $lookup_array[$rowNumber][$returnColumn];
|
||||
if ((is_numeric($lookup_value) && is_numeric($result)) ||
|
||||
(!is_numeric($lookup_value) && !is_numeric($result))) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -738,6 +747,70 @@ class PHPExcel_Calculation_LookupRef {
|
|||
} // function VLOOKUP()
|
||||
|
||||
|
||||
/**
|
||||
* HLOOKUP
|
||||
* The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The row number in table_array from which the matching value must be returned. The first row is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) {
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||
|
||||
// index_number must be greater than or equal to 1
|
||||
if ($index_number < 1) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$firstkey = $f[0] - 1;
|
||||
$returnColumn = $firstkey + $index_number;
|
||||
$firstColumn = array_shift($f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||
}
|
||||
|
||||
$rowNumber = $rowValue = False;
|
||||
foreach($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
||||
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
||||
(!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
|
||||
break;
|
||||
}
|
||||
$rowNumber = $rowKey;
|
||||
$rowValue = $rowData;
|
||||
}
|
||||
|
||||
if ($rowNumber !== false) {
|
||||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} else {
|
||||
// otherwise return the appropriate value
|
||||
$result = $lookup_array[$returnColumn][$rowNumber];
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} // function HLOOKUP()
|
||||
|
||||
|
||||
/**
|
||||
* LOOKUP
|
||||
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_MathTrig {
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
* ATAN2
|
||||
*
|
||||
* This function calculates the arc tangent of the two variables x and y. It is similar to
|
||||
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
||||
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
||||
* to determine the quadrant of the result.
|
||||
* The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
|
||||
* point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
|
||||
|
|
@ -495,13 +495,13 @@ class PHPExcel_Calculation_MathTrig {
|
|||
*
|
||||
* @access public
|
||||
* @category Mathematical and Trigonometric Functions
|
||||
* @param float $value The positive real number for which you want the logarithm
|
||||
* @param float $number The positive real number for which you want the logarithm
|
||||
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
||||
* @return float
|
||||
*/
|
||||
public static function LOG_BASE($number = NULL, $base = 10) {
|
||||
$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
|
||||
$base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base);
|
||||
$base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base);
|
||||
|
||||
if ((!is_numeric($base)) || (!is_numeric($number)))
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
|
|
@ -547,7 +547,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
try {
|
||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||
return $matrix->det();
|
||||
} catch (Exception $ex) {
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
} // function MDETERM()
|
||||
|
|
@ -589,7 +589,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
try {
|
||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||
return $matrix->inverse()->getArray();
|
||||
} catch (Exception $ex) {
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
} // function MINVERSE()
|
||||
|
|
@ -642,7 +642,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
}
|
||||
|
||||
return $matrixA->times($matrixB)->getArray();
|
||||
} catch (Exception $ex) {
|
||||
} catch (PHPExcel_Exception $ex) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
} // function MMULT()
|
||||
|
|
@ -1164,7 +1164,11 @@ class PHPExcel_Calculation_MathTrig {
|
|||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||
// Loop through arguments
|
||||
foreach ($aArgs as $key => $arg) {
|
||||
if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); }
|
||||
if (!is_numeric($arg)) {
|
||||
$arg = str_replace('"', '""', $arg);
|
||||
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
|
||||
}
|
||||
|
||||
$testCondition = '='.$arg.$condition;
|
||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||
// Is it a value within our criteria
|
||||
|
|
@ -1252,7 +1256,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||
/**
|
||||
* SUMX2MY2
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMX2MY2($matrixData1,$matrixData2) {
|
||||
|
|
@ -1281,7 +1286,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||
/**
|
||||
* SUMX2PY2
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMX2PY2($matrixData1,$matrixData2) {
|
||||
|
|
@ -1310,7 +1316,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||
/**
|
||||
* SUMXMY2
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed[] $matrixData1 Matrix #1
|
||||
* @param mixed[] $matrixData2 Matrix #2
|
||||
* @return float
|
||||
*/
|
||||
public static function SUMXMY2($matrixData1,$matrixData2) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099);
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Statistical {
|
||||
|
||||
|
|
@ -834,6 +834,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
* @category Mathematical and Trigonometric Functions
|
||||
* @param mixed $arg,... Data values
|
||||
* @param string $condition The criteria that defines which cells will be checked.
|
||||
* @param mixed[] $averageArgs Data values
|
||||
* @return float
|
||||
*/
|
||||
public static function AVERAGEIF($aArgs,$condition,$averageArgs = array()) {
|
||||
|
|
@ -912,6 +913,8 @@ class PHPExcel_Calculation_Statistical {
|
|||
* @param float $probability Probability at which you want to evaluate the distribution
|
||||
* @param float $alpha Parameter to the distribution
|
||||
* @param float $beta Parameter to the distribution
|
||||
* @param float $rMin Minimum value
|
||||
* @param float $rMax Maximum value
|
||||
* @param boolean $cumulative
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -1954,9 +1957,9 @@ class PHPExcel_Calculation_Statistical {
|
|||
* @param boolean A logical value specifying whether to return additional regression statistics.
|
||||
* @return array
|
||||
*/
|
||||
public static function LINEST($yValues,$xValues=null,$const=True,$stats=False) {
|
||||
$const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
||||
$stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
|
||||
public static function LINEST($yValues, $xValues = NULL, $const = TRUE, $stats = FALSE) {
|
||||
$const = (is_null($const)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
||||
$stats = (is_null($stats)) ? FALSE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
|
||||
if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
|
||||
|
||||
if (!self::_checkTrendArrays($yValues,$xValues)) {
|
||||
|
|
@ -2059,7 +2062,9 @@ class PHPExcel_Calculation_Statistical {
|
|||
*
|
||||
* Returns the inverse of the normal cumulative distribution
|
||||
*
|
||||
* @param float $value
|
||||
* @param float $probability
|
||||
* @param float $mean
|
||||
* @param float $stdDev
|
||||
* @return float
|
||||
*
|
||||
* @todo Try implementing P J Acklam's refinement algorithm for greater
|
||||
|
|
@ -2088,6 +2093,8 @@ class PHPExcel_Calculation_Statistical {
|
|||
* with parameters mean and standard_dev.
|
||||
*
|
||||
* @param float $value
|
||||
* @param float $mean
|
||||
* @param float $stdDev
|
||||
* @return float
|
||||
*/
|
||||
public static function LOGNORMDIST($value, $mean, $stdDev) {
|
||||
|
|
@ -3621,14 +3628,14 @@ class PHPExcel_Calculation_Statistical {
|
|||
* Returns the Weibull distribution. Use this distribution in reliability
|
||||
* analysis, such as calculating a device's mean time to failure.
|
||||
*
|
||||
* @param float $value
|
||||
* @param float $alpha Alpha Parameter
|
||||
* @param float $beta Beta Parameter
|
||||
* @param float $dataSet
|
||||
* @param float $m0 Alpha Parameter
|
||||
* @param float $sigma Beta Parameter
|
||||
* @param boolean $cumulative
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function ZTEST($dataSet, $m0, $sigma=null) {
|
||||
public static function ZTEST($dataSet, $m0, $sigma = NULL) {
|
||||
$dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet);
|
||||
$m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0);
|
||||
$sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_TextData {
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ class PHPExcel_Calculation_TextData {
|
|||
/**
|
||||
* TRIMNONPRINTABLE
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed $stringValue Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMNONPRINTABLE($stringValue = '') {
|
||||
|
|
@ -113,7 +113,7 @@ class PHPExcel_Calculation_TextData {
|
|||
/**
|
||||
* TRIMSPACES
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed $stringValue Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMSPACES($stringValue = '') {
|
||||
|
|
@ -133,7 +133,7 @@ class PHPExcel_Calculation_TextData {
|
|||
/**
|
||||
* ASCIICODE
|
||||
*
|
||||
* @param string $character Value
|
||||
* @param string $characters Value
|
||||
* @return int
|
||||
*/
|
||||
public static function ASCIICODE($characters) {
|
||||
|
|
@ -208,16 +208,17 @@ class PHPExcel_Calculation_TextData {
|
|||
}
|
||||
$decimals = floor($decimals);
|
||||
|
||||
$mask = '$#,##0';
|
||||
if ($decimals > 0) {
|
||||
return money_format('%.'.$decimals.'n',$value);
|
||||
$mask .= '.' . str_repeat('0',$decimals);
|
||||
} else {
|
||||
$round = pow(10,abs($decimals));
|
||||
if ($value < 0) { $round = 0-$round; }
|
||||
$value = PHPExcel_Calculation_MathTrig::MROUND($value,$round);
|
||||
// The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0,
|
||||
// so we display to 1 dp and chop off that character and the decimal separator using substr
|
||||
return substr(money_format('%.1n',$value),0,-2);
|
||||
$value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
|
||||
}
|
||||
|
||||
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
|
||||
|
||||
} // function DOLLAR()
|
||||
|
||||
|
||||
|
|
@ -296,7 +297,9 @@ class PHPExcel_Calculation_TextData {
|
|||
/**
|
||||
* FIXEDFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed $value Value to check
|
||||
* @param integer $decimals
|
||||
* @param boolean $no_commas
|
||||
* @return boolean
|
||||
*/
|
||||
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) {
|
||||
|
|
@ -407,7 +410,6 @@ class PHPExcel_Calculation_TextData {
|
|||
* STRINGLENGTH
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function STRINGLENGTH($value = '') {
|
||||
|
|
@ -440,11 +442,7 @@ class PHPExcel_Calculation_TextData {
|
|||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToLower($mixedCaseString);
|
||||
} // function LOWERCASE()
|
||||
|
||||
|
||||
|
|
@ -463,11 +461,7 @@ class PHPExcel_Calculation_TextData {
|
|||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
|
||||
} // function UPPERCASE()
|
||||
|
||||
|
||||
|
|
@ -486,20 +480,17 @@ class PHPExcel_Calculation_TextData {
|
|||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8');
|
||||
} else {
|
||||
return ucwords($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
|
||||
} // function PROPERCASE()
|
||||
|
||||
|
||||
/**
|
||||
* REPLACE
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @param string $oldText String to modify
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @param string $newText String to replace in defined position
|
||||
* @return string
|
||||
*/
|
||||
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {
|
||||
|
|
@ -565,7 +556,7 @@ class PHPExcel_Calculation_TextData {
|
|||
/**
|
||||
* RETURNSTRING
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param mixed $testValue Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function RETURNSTRING($testValue = '') {
|
||||
|
|
@ -582,6 +573,7 @@ class PHPExcel_Calculation_TextData {
|
|||
* TEXTFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param string $format Format mask to use
|
||||
* @return boolean
|
||||
*/
|
||||
public static function TEXTFORMAT($value,$format) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,24 +20,53 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Token_Stack
|
||||
*
|
||||
* @category PHPExcel_Calculation_Token_Stack
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Token_Stack {
|
||||
|
||||
/**
|
||||
* The parser stack for formulae
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $_stack = array();
|
||||
|
||||
/**
|
||||
* Count of entries in the parser stack
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_count = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count() {
|
||||
return $this->_count;
|
||||
} // function count()
|
||||
|
||||
|
||||
public function push($type,$value,$reference=null) {
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param mixed $value
|
||||
* @param mixed $reference
|
||||
*/
|
||||
public function push($type, $value, $reference = NULL) {
|
||||
$this->_stack[$this->_count++] = array('type' => $type,
|
||||
'value' => $value,
|
||||
'reference' => $reference
|
||||
|
|
@ -50,24 +79,37 @@ class PHPExcel_Calculation_Token_Stack {
|
|||
}
|
||||
} // function push()
|
||||
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop() {
|
||||
if ($this->_count > 0) {
|
||||
return $this->_stack[--$this->_count];
|
||||
}
|
||||
return null;
|
||||
return NULL;
|
||||
} // function pop()
|
||||
|
||||
|
||||
public function last($n=1) {
|
||||
if ($this->_count-$n < 0) {
|
||||
return null;
|
||||
/**
|
||||
* Return an entry from the stack without removing it
|
||||
*
|
||||
* @param integer $n number indicating how far back in the stack we want to look
|
||||
* @return mixed
|
||||
*/
|
||||
public function last($n = 1) {
|
||||
if ($this->_count - $n < 0) {
|
||||
return NULL;
|
||||
}
|
||||
return $this->_stack[$this->_count-$n];
|
||||
return $this->_stack[$this->_count - $n];
|
||||
} // function last()
|
||||
|
||||
|
||||
function __construct() {
|
||||
/**
|
||||
* Clear the stack
|
||||
*/
|
||||
function clear() {
|
||||
$this->_stack = array();
|
||||
$this->_count = 0;
|
||||
}
|
||||
|
||||
} // class PHPExcel_Calculation_Token_Stack
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell
|
||||
{
|
||||
|
|
@ -50,20 +50,6 @@ class PHPExcel_Cell
|
|||
*/
|
||||
private static $_valueBinder = NULL;
|
||||
|
||||
/**
|
||||
* Column of the cell
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_column;
|
||||
|
||||
/**
|
||||
* Row of the cell
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_row;
|
||||
|
||||
/**
|
||||
* Value of the cell
|
||||
*
|
||||
|
|
@ -93,7 +79,7 @@ class PHPExcel_Cell
|
|||
/**
|
||||
* Parent worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
* @var PHPExcel_CachedObjectStorage_CacheBase
|
||||
*/
|
||||
private $_parent;
|
||||
|
||||
|
|
@ -117,7 +103,8 @@ class PHPExcel_Cell
|
|||
* @return void
|
||||
**/
|
||||
public function notifyCacheController() {
|
||||
$this->_parent->getCellCacheController()->updateCacheData($this);
|
||||
$this->_parent->updateCacheData($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +112,9 @@ class PHPExcel_Cell
|
|||
$this->_parent = NULL;
|
||||
}
|
||||
|
||||
public function attach($parent) {
|
||||
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) {
|
||||
|
||||
|
||||
$this->_parent = $parent;
|
||||
}
|
||||
|
||||
|
|
@ -133,24 +122,18 @@ class PHPExcel_Cell
|
|||
/**
|
||||
* Create a new Cell
|
||||
*
|
||||
* @param string $pColumn
|
||||
* @param int $pRow
|
||||
* @param mixed $pValue
|
||||
* @param string $pDataType
|
||||
* @param PHPExcel_Worksheet $pSheet
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct($pColumn = 'A', $pRow = 1, $pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL)
|
||||
public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL)
|
||||
{
|
||||
// Initialise cell coordinate
|
||||
$this->_column = strtoupper($pColumn);
|
||||
$this->_row = $pRow;
|
||||
|
||||
// Initialise cell value
|
||||
$this->_value = $pValue;
|
||||
|
||||
// Set worksheet
|
||||
$this->_parent = $pSheet;
|
||||
// Set worksheet cache
|
||||
$this->_parent = $pSheet->getCellCacheController();
|
||||
|
||||
// Set datatype?
|
||||
if ($pDataType !== NULL) {
|
||||
|
|
@ -174,7 +157,7 @@ class PHPExcel_Cell
|
|||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
return $this->_parent->getCurrentColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -184,7 +167,7 @@ class PHPExcel_Cell
|
|||
*/
|
||||
public function getRow()
|
||||
{
|
||||
return $this->_row;
|
||||
return $this->_parent->getCurrentRow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -194,7 +177,7 @@ class PHPExcel_Cell
|
|||
*/
|
||||
public function getCoordinate()
|
||||
{
|
||||
return $this->_column . $this->_row;
|
||||
return $this->_parent->getCurrentAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -216,7 +199,7 @@ class PHPExcel_Cell
|
|||
{
|
||||
return (string) PHPExcel_Style_NumberFormat::toFormattedString(
|
||||
$this->getCalculatedValue(),
|
||||
$this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())
|
||||
$this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex())
|
||||
->getNumberFormat()->getFormatCode()
|
||||
);
|
||||
}
|
||||
|
|
@ -250,10 +233,12 @@ class PHPExcel_Cell
|
|||
{
|
||||
// set the value according to data type
|
||||
switch ($pDataType) {
|
||||
case PHPExcel_Cell_DataType::TYPE_NULL:
|
||||
$this->_value = $pValue;
|
||||
break;
|
||||
case PHPExcel_Cell_DataType::TYPE_STRING2:
|
||||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
case PHPExcel_Cell_DataType::TYPE_STRING:
|
||||
case PHPExcel_Cell_DataType::TYPE_NULL:
|
||||
case PHPExcel_Cell_DataType::TYPE_INLINE:
|
||||
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
|
||||
break;
|
||||
|
|
@ -285,43 +270,48 @@ class PHPExcel_Cell
|
|||
*
|
||||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling
|
||||
*
|
||||
* @param boolean $resetLog Whether the calculation engine logger should be reset or not
|
||||
* @return mixed
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getCalculatedValue($resetLog = TRUE)
|
||||
{
|
||||
// echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'<br />';
|
||||
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL;
|
||||
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
try {
|
||||
// echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value<br />';
|
||||
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
|
||||
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
|
||||
} catch ( Exception $ex ) {
|
||||
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
|
||||
$result = PHPExcel_Calculation::getInstance(
|
||||
$this->getWorksheet()->getParent()
|
||||
)->calculateCellValue($this,$resetLog);
|
||||
//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL;
|
||||
// We don't yet handle array returns
|
||||
if (is_array($result)) {
|
||||
while (is_array($result)) {
|
||||
$result = array_pop($result);
|
||||
}
|
||||
}
|
||||
} catch ( PHPExcel_Exception $ex ) {
|
||||
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) {
|
||||
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
||||
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||
return $this->_calculatedValue; // Fallback for calculations referencing external files.
|
||||
}
|
||||
// echo 'Calculation Exception: '.$ex->getMessage().'<br />';
|
||||
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
|
||||
$result = '#N/A';
|
||||
throw(
|
||||
new PHPExcel_Exception(
|
||||
$this->getParent()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()
|
||||
)
|
||||
throw new PHPExcel_Calculation_Exception(
|
||||
$this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
if ($result === '#Not Yet Implemented') {
|
||||
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
||||
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
|
||||
}
|
||||
// echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().'<br />';
|
||||
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||
return $result;
|
||||
} elseif($this->_value instanceof PHPExcel_RichText) {
|
||||
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />';
|
||||
return $this->_value->getPlainText();
|
||||
}
|
||||
|
||||
// if ($this->_value === NULL) {
|
||||
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
|
||||
// return NULL;
|
||||
// }
|
||||
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
|
||||
return $this->_value;
|
||||
}
|
||||
|
|
@ -382,6 +372,16 @@ class PHPExcel_Cell
|
|||
return $this->notifyCacheController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify if the cell contains a formula
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isFormula()
|
||||
{
|
||||
return $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this cell contain Data validation rules?
|
||||
*
|
||||
|
|
@ -394,7 +394,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
|
||||
}
|
||||
|
||||
return $this->_parent->dataValidationExists($this->getCoordinate());
|
||||
return $this->getWorksheet()->dataValidationExists($this->getCoordinate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -409,7 +409,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
|
||||
}
|
||||
|
||||
return $this->_parent->getDataValidation($this->getCoordinate());
|
||||
return $this->getWorksheet()->getDataValidation($this->getCoordinate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -425,7 +425,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
|
||||
}
|
||||
|
||||
$this->_parent->setDataValidation($this->getCoordinate(), $pDataValidation);
|
||||
$this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation);
|
||||
|
||||
return $this->notifyCacheController();
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
|
||||
}
|
||||
|
||||
return $this->_parent->hyperlinkExists($this->getCoordinate());
|
||||
return $this->getWorksheet()->hyperlinkExists($this->getCoordinate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -457,7 +457,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
|
||||
}
|
||||
|
||||
return $this->_parent->getHyperlink($this->getCoordinate());
|
||||
return $this->getWorksheet()->getHyperlink($this->getCoordinate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -473,7 +473,7 @@ class PHPExcel_Cell
|
|||
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
|
||||
}
|
||||
|
||||
$this->_parent->setHyperlink($this->getCoordinate(), $pHyperlink);
|
||||
$this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink);
|
||||
|
||||
return $this->notifyCacheController();
|
||||
}
|
||||
|
|
@ -481,12 +481,31 @@ class PHPExcel_Cell
|
|||
/**
|
||||
* Get parent worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
* @return PHPExcel_CachedObjectStorage_CacheBase
|
||||
*/
|
||||
public function getParent() {
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet() {
|
||||
return $this->_parent->getParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell style
|
||||
*
|
||||
* @return PHPExcel_Style
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
return $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-bind parent
|
||||
*
|
||||
|
|
@ -494,7 +513,7 @@ class PHPExcel_Cell
|
|||
* @return PHPExcel_Cell
|
||||
*/
|
||||
public function rebindParent(PHPExcel_Worksheet $parent) {
|
||||
$this->_parent = $parent;
|
||||
$this->_parent = $parent->getCellCacheController();
|
||||
|
||||
return $this->notifyCacheController();
|
||||
}
|
||||
|
|
@ -727,7 +746,6 @@ class PHPExcel_Cell
|
|||
*
|
||||
* @param string $pString
|
||||
* @return int Column index (base 1 !!!)
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function columnIndexFromString($pString = 'A')
|
||||
{
|
||||
|
|
@ -825,8 +843,8 @@ class PHPExcel_Cell
|
|||
|
||||
// Range...
|
||||
list($rangeStart, $rangeEnd) = $range;
|
||||
list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d');
|
||||
list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d');
|
||||
sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow);
|
||||
sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow);
|
||||
$endCol++;
|
||||
|
||||
// Current data
|
||||
|
|
@ -848,7 +866,7 @@ class PHPExcel_Cell
|
|||
// Sort the result by column and row
|
||||
$sortKeys = array();
|
||||
foreach (array_unique($returnValue) as $coord) {
|
||||
list($column,$row) = sscanf($coord,'%[A-Z]%d');
|
||||
sscanf($coord,'%[A-Z]%d', $column, $row);
|
||||
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord;
|
||||
}
|
||||
ksort($sortKeys);
|
||||
|
|
@ -861,16 +879,16 @@ class PHPExcel_Cell
|
|||
* Compare 2 cells
|
||||
*
|
||||
* @param PHPExcel_Cell $a Cell a
|
||||
* @param PHPExcel_Cell $a Cell b
|
||||
* @param PHPExcel_Cell $b Cell b
|
||||
* @return int Result of comparison (always -1 or 1, never zero!)
|
||||
*/
|
||||
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
|
||||
{
|
||||
if ($a->_row < $b->_row) {
|
||||
if ($a->getRow() < $b->getRow()) {
|
||||
return -1;
|
||||
} elseif ($a->_row > $b->_row) {
|
||||
} elseif ($a->getRow() > $b->getRow()) {
|
||||
return 1;
|
||||
} elseif (self::columnIndexFromString($a->_column) < self::columnIndexFromString($b->_column)) {
|
||||
} elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
|
|
@ -894,11 +912,11 @@ class PHPExcel_Cell
|
|||
* Set value binder to use
|
||||
*
|
||||
* @param PHPExcel_Cell_IValueBinder $binder
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
|
||||
if ($binder === NULL) {
|
||||
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
||||
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
||||
}
|
||||
|
||||
self::$_valueBinder = $binder;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,19 +20,19 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -41,150 +41,152 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
}
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
}
|
||||
|
||||
// Find out data type
|
||||
$dataType = parent::dataTypeForValue($value);
|
||||
// Find out data type
|
||||
$dataType = parent::dataTypeForValue($value);
|
||||
|
||||
// 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;
|
||||
}
|
||||
// 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);
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for fraction
|
||||
if (preg_match('/^([+-]?) *([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] / $matches[3];
|
||||
if ($matches[1] == '-') $value = 0 - $value;
|
||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( '??/??' );
|
||||
return true;
|
||||
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] + ($matches[3] / $matches[4]);
|
||||
if ($matches[1] == '-') $value = 0 - $value;
|
||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( '# ??/??' );
|
||||
return true;
|
||||
}
|
||||
// Check for fraction
|
||||
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] / $matches[3];
|
||||
if ($matches[1] == '-') $value = 0 - $value;
|
||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( '??/??' );
|
||||
return true;
|
||||
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] + ($matches[3] / $matches[4]);
|
||||
if ($matches[1] == '-') $value = 0 - $value;
|
||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( '# ??/??' );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for percentage
|
||||
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) str_replace('%', '', $value) / 100;
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 );
|
||||
return true;
|
||||
}
|
||||
// Check for percentage
|
||||
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) str_replace('%', '', $value) / 100;
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for currency
|
||||
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array($currencyCode,','), '', $value));
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode(
|
||||
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE )
|
||||
);
|
||||
return true;
|
||||
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE );
|
||||
return true;
|
||||
}
|
||||
// Check for currency
|
||||
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||
$decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
|
||||
$thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
|
||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode(
|
||||
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE )
|
||||
);
|
||||
return true;
|
||||
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for time without seconds e.g. '9:45', '09:45'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440;
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
||||
return true;
|
||||
}
|
||||
// Check for time without seconds e.g. '9:45', '09:45'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440;
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for time with seconds '9:45:59', '09:45:59'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m, $s) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440 + $s / 86400;
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
||||
return true;
|
||||
}
|
||||
// Check for time with seconds '9:45:59', '09:45:59'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m, $s) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440 + $s / 86400;
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
|
||||
if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Determine style. Either there is a time part or not. Look for ':'
|
||||
if (strpos($value, ':') !== false) {
|
||||
$formatCode = 'yyyy-mm-dd h:mm';
|
||||
} else {
|
||||
$formatCode = 'yyyy-mm-dd';
|
||||
}
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode($formatCode);
|
||||
return true;
|
||||
}
|
||||
// Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
|
||||
if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Determine style. Either there is a time part or not. Look for ':'
|
||||
if (strpos($value, ':') !== false) {
|
||||
$formatCode = 'yyyy-mm-dd h:mm';
|
||||
} else {
|
||||
$formatCode = 'yyyy-mm-dd';
|
||||
}
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getNumberFormat()->setFormatCode($formatCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for newline character "\n"
|
||||
if (strpos($value, "\n") !== FALSE) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
||||
->getAlignment()->setWrapText(TRUE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Check for newline character "\n"
|
||||
if (strpos($value, "\n") !== FALSE) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||
->getAlignment()->setWrapText(TRUE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Not bound yet? Use parent...
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
// Not bound yet? Use parent...
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,84 +31,92 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DataType
|
||||
{
|
||||
/* Data types */
|
||||
const TYPE_STRING2 = 'str';
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
const TYPE_BOOL = 'b';
|
||||
const TYPE_NULL = 'null';
|
||||
const TYPE_INLINE = 'inlineStr';
|
||||
const TYPE_ERROR = 'e';
|
||||
/* Data types */
|
||||
const TYPE_STRING2 = 'str';
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
const TYPE_BOOL = 'b';
|
||||
const TYPE_NULL = 'null';
|
||||
const TYPE_INLINE = 'inlineStr';
|
||||
const TYPE_ERROR = 'e';
|
||||
|
||||
/**
|
||||
* List of error codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_errorCodes = array('#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6);
|
||||
/**
|
||||
* List of error codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_errorCodes = array(
|
||||
'#NULL!' => 0,
|
||||
'#DIV/0!' => 1,
|
||||
'#VALUE!' => 2,
|
||||
'#REF!' => 3,
|
||||
'#NAME?' => 4,
|
||||
'#NUM!' => 5,
|
||||
'#N/A' => 6
|
||||
);
|
||||
|
||||
/**
|
||||
* Get list of error codes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getErrorCodes() {
|
||||
return self::$_errorCodes;
|
||||
}
|
||||
/**
|
||||
* Get list of error codes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getErrorCodes() {
|
||||
return self::$_errorCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure
|
||||
* @param mixed $pValue
|
||||
* @return int
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null) {
|
||||
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||
}
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
|
||||
* @param mixed $pValue
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null) {
|
||||
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a string that it satisfies Excel requirements
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel string
|
||||
* @return mixed Sanitized value
|
||||
*/
|
||||
public static function checkString($pValue = null)
|
||||
{
|
||||
if ($pValue instanceof PHPExcel_RichText) {
|
||||
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
|
||||
return $pValue;
|
||||
}
|
||||
/**
|
||||
* Check a string that it satisfies Excel requirements
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel string
|
||||
* @return mixed Sanitized value
|
||||
*/
|
||||
public static function checkString($pValue = null)
|
||||
{
|
||||
if ($pValue instanceof PHPExcel_RichText) {
|
||||
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
// string must never be longer than 32,767 characters, truncate if necessary
|
||||
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
||||
// string must never be longer than 32,767 characters, truncate if necessary
|
||||
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
||||
|
||||
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||
|
||||
return $pValue;
|
||||
}
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a value that it is a valid error code
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel error code
|
||||
* @return string Sanitized value
|
||||
*/
|
||||
public static function checkErrorCode($pValue = null)
|
||||
{
|
||||
$pValue = (string)$pValue;
|
||||
/**
|
||||
* Check a value that it is a valid error code
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel error code
|
||||
* @return string Sanitized value
|
||||
*/
|
||||
public static function checkErrorCode($pValue = null)
|
||||
{
|
||||
$pValue = (string) $pValue;
|
||||
|
||||
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
||||
$pValue = '#NULL!';
|
||||
}
|
||||
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
||||
$pValue = '#NULL!';
|
||||
}
|
||||
|
||||
return $pValue;
|
||||
}
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,34 +31,34 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DataValidation
|
||||
{
|
||||
/* Data validation types */
|
||||
const TYPE_NONE = 'none';
|
||||
const TYPE_CUSTOM = 'custom';
|
||||
const TYPE_DATE = 'date';
|
||||
const TYPE_DECIMAL = 'decimal';
|
||||
const TYPE_LIST = 'list';
|
||||
const TYPE_TEXTLENGTH = 'textLength';
|
||||
const TYPE_TIME = 'time';
|
||||
const TYPE_WHOLE = 'whole';
|
||||
/* Data validation types */
|
||||
const TYPE_NONE = 'none';
|
||||
const TYPE_CUSTOM = 'custom';
|
||||
const TYPE_DATE = 'date';
|
||||
const TYPE_DECIMAL = 'decimal';
|
||||
const TYPE_LIST = 'list';
|
||||
const TYPE_TEXTLENGTH = 'textLength';
|
||||
const TYPE_TIME = 'time';
|
||||
const TYPE_WHOLE = 'whole';
|
||||
|
||||
/* Data validation error styles */
|
||||
const STYLE_STOP = 'stop';
|
||||
const STYLE_WARNING = 'warning';
|
||||
const STYLE_INFORMATION = 'information';
|
||||
/* Data validation error styles */
|
||||
const STYLE_STOP = 'stop';
|
||||
const STYLE_WARNING = 'warning';
|
||||
const STYLE_INFORMATION = 'information';
|
||||
|
||||
/* Data validation operators */
|
||||
const OPERATOR_BETWEEN = 'between';
|
||||
const OPERATOR_EQUAL = 'equal';
|
||||
const OPERATOR_GREATERTHAN = 'greaterThan';
|
||||
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||
const OPERATOR_LESSTHAN = 'lessThan';
|
||||
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||
const OPERATOR_NOTBETWEEN = 'notBetween';
|
||||
const OPERATOR_NOTEQUAL = 'notEqual';
|
||||
/* Data validation operators */
|
||||
const OPERATOR_BETWEEN = 'between';
|
||||
const OPERATOR_EQUAL = 'equal';
|
||||
const OPERATOR_GREATERTHAN = 'greaterThan';
|
||||
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||
const OPERATOR_LESSTHAN = 'lessThan';
|
||||
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||
const OPERATOR_NOTBETWEEN = 'notBetween';
|
||||
const OPERATOR_NOTEQUAL = 'notEqual';
|
||||
|
||||
/**
|
||||
* Formula 1
|
||||
|
|
@ -153,322 +153,320 @@ class PHPExcel_Cell_DataValidation
|
|||
|
||||
/**
|
||||
* Create a new PHPExcel_Cell_DataValidation
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise member variables
|
||||
$this->_formula1 = '';
|
||||
$this->_formula2 = '';
|
||||
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||
$this->_operator = '';
|
||||
$this->_allowBlank = false;
|
||||
$this->_showDropDown = false;
|
||||
$this->_showInputMessage = false;
|
||||
$this->_showErrorMessage = false;
|
||||
$this->_errorTitle = '';
|
||||
$this->_error = '';
|
||||
$this->_promptTitle = '';
|
||||
$this->_prompt = '';
|
||||
// Initialise member variables
|
||||
$this->_formula1 = '';
|
||||
$this->_formula2 = '';
|
||||
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||
$this->_operator = '';
|
||||
$this->_allowBlank = FALSE;
|
||||
$this->_showDropDown = FALSE;
|
||||
$this->_showInputMessage = FALSE;
|
||||
$this->_showErrorMessage = FALSE;
|
||||
$this->_errorTitle = '';
|
||||
$this->_error = '';
|
||||
$this->_promptTitle = '';
|
||||
$this->_prompt = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 1
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula1() {
|
||||
return $this->_formula1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formula 1
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula1($value = '') {
|
||||
$this->_formula1 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula2() {
|
||||
return $this->_formula2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formula 2
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula2($value = '') {
|
||||
$this->_formula2 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) {
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error style
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorStyle() {
|
||||
return $this->_errorStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error style
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) {
|
||||
$this->_errorStyle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator() {
|
||||
return $this->_operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Operator
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setOperator($value = '') {
|
||||
$this->_operator = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Allow Blank
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowBlank() {
|
||||
return $this->_allowBlank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Allow Blank
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setAllowBlank($value = false) {
|
||||
$this->_allowBlank = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show DropDown
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowDropDown() {
|
||||
return $this->_showDropDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show DropDown
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowDropDown($value = false) {
|
||||
$this->_showDropDown = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show InputMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowInputMessage() {
|
||||
return $this->_showInputMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show InputMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowInputMessage($value = false) {
|
||||
$this->_showInputMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show ErrorMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowErrorMessage() {
|
||||
return $this->_showErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show ErrorMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowErrorMessage($value = false) {
|
||||
$this->_showErrorMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorTitle() {
|
||||
return $this->_errorTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorTitle($value = '') {
|
||||
$this->_errorTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getError() {
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setError($value = '') {
|
||||
$this->_error = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPromptTitle() {
|
||||
return $this->_promptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPromptTitle($value = '') {
|
||||
$this->_promptTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrompt() {
|
||||
return $this->_prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPrompt($value = '') {
|
||||
$this->_prompt = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_formula1
|
||||
. $this->_formula2
|
||||
. $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE
|
||||
. $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP
|
||||
. $this->_operator
|
||||
. ($this->_allowBlank ? 't' : 'f')
|
||||
. ($this->_showDropDown ? 't' : 'f')
|
||||
. ($this->_showInputMessage ? 't' : 'f')
|
||||
. ($this->_showErrorMessage ? 't' : 'f')
|
||||
. $this->_errorTitle
|
||||
. $this->_error
|
||||
. $this->_promptTitle
|
||||
. $this->_prompt
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get Formula 1
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula1() {
|
||||
return $this->_formula1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set Formula 1
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula1($value = '') {
|
||||
$this->_formula1 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula2() {
|
||||
return $this->_formula2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formula 2
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula2($value = '') {
|
||||
$this->_formula2 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) {
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error style
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorStyle() {
|
||||
return $this->_errorStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error style
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) {
|
||||
$this->_errorStyle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator() {
|
||||
return $this->_operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Operator
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setOperator($value = '') {
|
||||
$this->_operator = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Allow Blank
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowBlank() {
|
||||
return $this->_allowBlank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Allow Blank
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setAllowBlank($value = false) {
|
||||
$this->_allowBlank = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show DropDown
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowDropDown() {
|
||||
return $this->_showDropDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show DropDown
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowDropDown($value = false) {
|
||||
$this->_showDropDown = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show InputMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowInputMessage() {
|
||||
return $this->_showInputMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show InputMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowInputMessage($value = false) {
|
||||
$this->_showInputMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show ErrorMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowErrorMessage() {
|
||||
return $this->_showErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show ErrorMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowErrorMessage($value = false) {
|
||||
$this->_showErrorMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorTitle() {
|
||||
return $this->_errorTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorTitle($value = '') {
|
||||
$this->_errorTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getError() {
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setError($value = '') {
|
||||
$this->_error = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPromptTitle() {
|
||||
return $this->_promptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPromptTitle($value = '') {
|
||||
$this->_promptTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrompt() {
|
||||
return $this->_prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPrompt($value = '') {
|
||||
$this->_prompt = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_formula1
|
||||
. $this->_formula2
|
||||
. $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE
|
||||
. $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP
|
||||
. $this->_operator
|
||||
. ($this->_allowBlank ? 't' : 'f')
|
||||
. ($this->_showDropDown ? 't' : 'f')
|
||||
. ($this->_showInputMessage ? 't' : 'f')
|
||||
. ($this->_showErrorMessage ? 't' : 'f')
|
||||
. $this->_errorTitle
|
||||
. $this->_error
|
||||
. $this->_promptTitle
|
||||
. $this->_prompt
|
||||
. __CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,19 +20,19 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -41,66 +41,66 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
}
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
}
|
||||
|
||||
// Set value explicit
|
||||
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
||||
// Set value explicit
|
||||
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
||||
|
||||
// Done!
|
||||
return true;
|
||||
}
|
||||
// Done!
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @param mixed $pValue
|
||||
* @return int
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null) {
|
||||
// Match the value against a few data types
|
||||
if (is_null($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @param mixed $pValue
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null) {
|
||||
// Match the value against a few data types
|
||||
if (is_null($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
|
||||
} elseif ($pValue === '') {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
} elseif ($pValue === '') {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
|
||||
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||
|
||||
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
|
||||
} elseif (is_bool($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
} elseif (is_bool($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
|
||||
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
|
||||
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
|
||||
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
|
||||
} else {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
} else {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,97 +31,96 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_Hyperlink
|
||||
{
|
||||
/**
|
||||
* URL to link the cell to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_url;
|
||||
/**
|
||||
* URL to link the cell to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_url;
|
||||
|
||||
/**
|
||||
* Tooltip to display on the hyperlink
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_tooltip;
|
||||
/**
|
||||
* Tooltip to display on the hyperlink
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_tooltip;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Cell_Hyperlink
|
||||
*
|
||||
* @param string $pUrl Url to link the cell to
|
||||
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||
* @throws Exception
|
||||
* @param string $pUrl Url to link the cell to
|
||||
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||
*/
|
||||
public function __construct($pUrl = '', $pTooltip = '')
|
||||
{
|
||||
// Initialise member variables
|
||||
$this->_url = $pUrl;
|
||||
$this->_tooltip = $pTooltip;
|
||||
// Initialise member variables
|
||||
$this->_url = $pUrl;
|
||||
$this->_tooltip = $pTooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->_url;
|
||||
}
|
||||
/**
|
||||
* Get URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set URL
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setUrl($value = '') {
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set URL
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setUrl($value = '') {
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltip
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTooltip() {
|
||||
return $this->_tooltip;
|
||||
}
|
||||
/**
|
||||
* Get tooltip
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTooltip() {
|
||||
return $this->_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tooltip
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setTooltip($value = '') {
|
||||
$this->_tooltip = $value;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set tooltip
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setTooltip($value = '') {
|
||||
$this->_tooltip = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this hyperlink internal? (to another sheet)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInternal() {
|
||||
return strpos($this->_url, 'sheet://') !== false;
|
||||
}
|
||||
/**
|
||||
* Is this hyperlink internal? (to another worksheet)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInternal() {
|
||||
return strpos($this->_url, 'sheet://') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_url
|
||||
. $this->_tooltip
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_url
|
||||
. $this->_tooltip
|
||||
. __CLASS__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,16 +31,16 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null);
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart
|
||||
{
|
||||
|
|
@ -184,7 +184,7 @@ class PHPExcel_Chart
|
|||
* Set Worksheet
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pValue
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Chart_Exception
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null) {
|
||||
|
|
@ -378,6 +378,13 @@ class PHPExcel_Chart
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Top Left cell for the chart
|
||||
*
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftOffset($xOffset=null,$yOffset=null) {
|
||||
if (!is_null($xOffset))
|
||||
$this->setTopLeftXOffset($xOffset);
|
||||
|
|
@ -387,6 +394,11 @@ class PHPExcel_Chart
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Top Left cell for the chart
|
||||
*
|
||||
* @return integer[]
|
||||
*/
|
||||
public function getTopLeftOffset() {
|
||||
return array( 'X' => $this->_topLeftXOffset,
|
||||
'Y' => $this->_topLeftYOffset
|
||||
|
|
@ -458,6 +470,13 @@ class PHPExcel_Chart
|
|||
return $this->_bottomRightCellRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Bottom Right cell for the chart
|
||||
*
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setBottomRightOffset($xOffset=null,$yOffset=null) {
|
||||
if (!is_null($xOffset))
|
||||
$this->setBottomRightXOffset($xOffset);
|
||||
|
|
@ -467,6 +486,11 @@ class PHPExcel_Chart
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Bottom Right cell for the chart
|
||||
*
|
||||
* @return integer[]
|
||||
*/
|
||||
public function getBottomRightOffset() {
|
||||
return array( 'X' => $this->_bottomRightXOffset,
|
||||
'Y' => $this->_bottomRightYOffset
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_DataSeries
|
||||
{
|
||||
|
|
@ -52,6 +52,7 @@ class PHPExcel_Chart_DataSeries
|
|||
const TYPE_RADARCHART = 'radarChart';
|
||||
const TYPE_BUBBLECHART = 'bubbleChart';
|
||||
const TYPE_STOCKCHART = 'stockChart';
|
||||
const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym
|
||||
|
||||
const GROUPING_CLUSTERED = 'clustered';
|
||||
const GROUPING_STACKED = 'stacked';
|
||||
|
|
@ -169,9 +170,11 @@ class PHPExcel_Chart_DataSeries
|
|||
* Set Plot Type
|
||||
*
|
||||
* @param string $plotType
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function setPlotType($plotType = '') {
|
||||
$this->_plotType = $plotType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -187,9 +190,11 @@ class PHPExcel_Chart_DataSeries
|
|||
* Set Plot Grouping Type
|
||||
*
|
||||
* @param string $groupingType
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function setPlotGrouping($groupingType = null) {
|
||||
$this->_plotGrouping = $groupingType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -205,9 +210,11 @@ class PHPExcel_Chart_DataSeries
|
|||
* Set Plot Direction
|
||||
*
|
||||
* @param string $plotDirection
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function setPlotDirection($plotDirection = null) {
|
||||
$this->_plotDirection = $plotDirection;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -280,9 +287,11 @@ class PHPExcel_Chart_DataSeries
|
|||
* Set Plot Style
|
||||
*
|
||||
* @param string $plotStyle
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function setPlotStyle($plotStyle = null) {
|
||||
$this->_plotStyle = $plotStyle;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -331,9 +340,11 @@ class PHPExcel_Chart_DataSeries
|
|||
* Set Smooth Line
|
||||
*
|
||||
* @param boolean $smoothLine
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function setSmoothLine($smoothLine = TRUE) {
|
||||
$this->_smoothLine = $smoothLine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_DataSeriesValues
|
||||
{
|
||||
|
|
@ -279,7 +279,7 @@ class PHPExcel_Chart_DataSeriesValues
|
|||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) {
|
||||
if ($this->_dataSource !== NULL) {
|
||||
$calcEngine = PHPExcel_Calculation::getInstance();
|
||||
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
|
||||
$newDataValues = PHPExcel_Calculation::_unwrapResult(
|
||||
$calcEngine->_calculateFormulaValue(
|
||||
'='.$this->_dataSource,
|
||||
|
|
@ -289,6 +289,12 @@ class PHPExcel_Chart_DataSeriesValues
|
|||
);
|
||||
if ($flatten) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
foreach($this->_dataValues as &$dataValue) {
|
||||
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
|
||||
$dataValue = 0.0;
|
||||
}
|
||||
}
|
||||
unset($dataValue);
|
||||
} else {
|
||||
$cellRange = explode('!',$this->_dataSource);
|
||||
if (count($cellRange) > 1) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,9 +31,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Exception extends Exception {
|
||||
class PHPExcel_Chart_Exception extends PHPExcel_Exception {
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Layout
|
||||
{
|
||||
|
|
@ -167,9 +167,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set Layout Target
|
||||
*
|
||||
* @param Layout Target $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setLayoutTarget($value) {
|
||||
$this->_layoutTarget = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,9 +187,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set X-Mode
|
||||
*
|
||||
* @param X-Mode $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setXMode($value) {
|
||||
$this->_xMode = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -196,16 +200,18 @@ class PHPExcel_Chart_Layout
|
|||
* @return string
|
||||
*/
|
||||
public function getYMode() {
|
||||
return $this->_xMode;
|
||||
return $this->_yMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Y-Mode
|
||||
*
|
||||
* @param Y-Mode $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setYMode($value) {
|
||||
$this->_xMode = $value;
|
||||
$this->_yMode = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -221,9 +227,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set X-Position
|
||||
*
|
||||
* @param X-Position $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setXPosition($value) {
|
||||
$this->_xPos = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,9 +247,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set Y-Position
|
||||
*
|
||||
* @param Y-Position $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setYPosition($value) {
|
||||
$this->_yPos = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -257,9 +267,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set Width
|
||||
*
|
||||
* @param Width $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setWidth($value) {
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -275,9 +287,11 @@ class PHPExcel_Chart_Layout
|
|||
* Set Height
|
||||
*
|
||||
* @param Height $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setHeight($value) {
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -295,9 +309,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that legend keys should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show legend key
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowLegendKey($value) {
|
||||
$this->_showLegendKey = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -314,9 +330,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that the value should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show val
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowVal($value) {
|
||||
$this->_showVal = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -333,9 +351,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that the category name should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show cat name
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowCatName($value) {
|
||||
$this->_showCatName = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -351,10 +371,12 @@ class PHPExcel_Chart_Layout
|
|||
* Set show ser name
|
||||
* Specifies that the series name should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show ser name
|
||||
* @param boolean $value Show series name
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowSerName($value) {
|
||||
$this->_showSerName = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -371,9 +393,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that the percentage should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show percentage
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowPercent($value) {
|
||||
$this->_showPercent = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -390,9 +414,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that the bubble size should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show bubble size
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowBubbleSize($value) {
|
||||
$this->_showBubbleSize = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -409,9 +435,11 @@ class PHPExcel_Chart_Layout
|
|||
* Specifies that leader lines should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show leader lines
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowLeaderLines($value) {
|
||||
$this->_showLeaderLines = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Legend
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_PlotArea
|
||||
{
|
||||
|
|
@ -110,10 +110,13 @@ class PHPExcel_Chart_PlotArea
|
|||
/**
|
||||
* Set Plot Series
|
||||
*
|
||||
* @param array of PHPExcel_Chart_DataSeries
|
||||
* @param [PHPExcel_Chart_DataSeries]
|
||||
* @return PHPExcel_Chart_PlotArea
|
||||
*/
|
||||
public function setPlotSeries($plotSeries = array()) {
|
||||
$this->_plotSeries = $plotSeries;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Chart_Renderer
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart_Renderer
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Renderer_jpgraph
|
||||
{
|
||||
|
|
@ -107,13 +107,11 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||
|
||||
$testCurrentIndex = 0;
|
||||
foreach($datasetLabels as $i => $datasetLabel) {
|
||||
array_reverse($datasetLabel);
|
||||
|
||||
if (is_array($datasetLabel)) {
|
||||
if ($rotation == 'bar') {
|
||||
$datasetLabel = array_reverse($datasetLabel);
|
||||
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
||||
} else {
|
||||
$datasetLabel = array_reverse($datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -519,19 +517,37 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||
private function _renderPlotStock($groupID) {
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
|
||||
$seriesPlots = array();
|
||||
|
||||
$dataValues = array();
|
||||
// Loop through each data series in turn
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
|
||||
foreach($dataValuesX as $j => $dataValueX)
|
||||
$dataValues[$j][$plotOrder[$i]] = $dataValueX;
|
||||
// Loop through each data series in turn and build the plot arrays
|
||||
foreach($plotOrder as $i => $v) {
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
|
||||
foreach($dataValuesX as $j => $dataValueX) {
|
||||
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
|
||||
}
|
||||
}
|
||||
if(empty($dataValues)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$seriesPlot = new StockPlot($dataValues);
|
||||
$dataValuesPlot = array();
|
||||
// Flatten the plot arrays to a single dimensional array to work with jpgraph
|
||||
for($j = 0; $j < count($dataValues[0]); $j++) {
|
||||
for($i = 0; $i < $seriesCount; $i++) {
|
||||
$dataValuesPlot[] = $dataValues[$i][$j];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the x-axis labels
|
||||
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||
$this->_graph->xaxis->SetTickLabels($datasetLabels);
|
||||
}
|
||||
|
||||
$seriesPlot = new StockPlot($dataValuesPlot);
|
||||
$seriesPlot->SetWidth(20);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
} // function _renderPlotStock()
|
||||
|
|
@ -683,9 +699,9 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||
private function _renderStockChart($groupCount) {
|
||||
require_once('jpgraph_stock.php');
|
||||
|
||||
$this->_renderCartesianPlotArea();
|
||||
$this->_renderCartesianPlotArea('intint');
|
||||
|
||||
for($groupID = 0; $groupID < $groupCount; ++$i) {
|
||||
for($groupID = 0; $groupID < $groupCount; ++$groupID) {
|
||||
$this->_renderPlotStock($groupID);
|
||||
}
|
||||
} // function _renderStockChart()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Title
|
||||
{
|
||||
|
|
@ -72,9 +72,12 @@ class PHPExcel_Chart_Title
|
|||
* Set caption
|
||||
*
|
||||
* @param string $caption
|
||||
* @return PHPExcel_Chart_Title
|
||||
*/
|
||||
public function setCaption($caption = null) {
|
||||
$this->_caption = $caption;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package 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
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,85 +31,85 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Author
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_author;
|
||||
/**
|
||||
* Author
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_author;
|
||||
|
||||
/**
|
||||
* Rich text comment
|
||||
*
|
||||
* @var PHPExcel_RichText
|
||||
*/
|
||||
private $_text;
|
||||
/**
|
||||
* Rich text comment
|
||||
*
|
||||
* @var PHPExcel_RichText
|
||||
*/
|
||||
private $_text;
|
||||
|
||||
/**
|
||||
* Comment width (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_width = '96pt';
|
||||
/**
|
||||
* Comment width (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_width = '96pt';
|
||||
|
||||
/**
|
||||
* Left margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginLeft = '59.25pt';
|
||||
/**
|
||||
* Left margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginLeft = '59.25pt';
|
||||
|
||||
/**
|
||||
* Top margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginTop = '1.5pt';
|
||||
/**
|
||||
* Top margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginTop = '1.5pt';
|
||||
|
||||
/**
|
||||
* Visible
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_visible = false;
|
||||
/**
|
||||
* Visible
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_visible = false;
|
||||
|
||||
/**
|
||||
* Comment height (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_height = '55.5pt';
|
||||
/**
|
||||
* Comment height (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_height = '55.5pt';
|
||||
|
||||
/**
|
||||
* Comment fill color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
private $_fillColor;
|
||||
/**
|
||||
* Comment fill color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
private $_fillColor;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_alignment;
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_alignment;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Comment
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise variables
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
// Initialise variables
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -118,7 +118,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @return string
|
||||
*/
|
||||
public function getAuthor() {
|
||||
return $this->_author;
|
||||
return $this->_author;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -127,10 +127,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAuthor($pValue = '') {
|
||||
$this->_author = $pValue;
|
||||
return $this;
|
||||
}
|
||||
public function setAuthor($pValue = '') {
|
||||
$this->_author = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rich text comment
|
||||
|
|
@ -138,7 +138,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @return PHPExcel_RichText
|
||||
*/
|
||||
public function getText() {
|
||||
return $this->_text;
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,8 +148,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setText(PHPExcel_RichText $pValue) {
|
||||
$this->_text = $pValue;
|
||||
return $this;
|
||||
$this->_text = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -268,8 +268,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -278,40 +278,50 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||
* @return string
|
||||
*/
|
||||
public function getAlignment() {
|
||||
return $this->_alignment;
|
||||
return $this->_alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_author
|
||||
. $this->_text->getHashCode()
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. $this->_marginLeft
|
||||
. $this->_marginTop
|
||||
. ($this->_visible ? 1 : 0)
|
||||
. $this->_fillColor->getHashCode()
|
||||
. $this->_alignment
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_author
|
||||
. $this->_text->getHashCode()
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. $this->_marginLeft
|
||||
. $this->_marginTop
|
||||
. ($this->_visible ? 1 : 0)
|
||||
. $this->_fillColor->getHashCode()
|
||||
. $this->_alignment
|
||||
. __CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->_text->getPlainText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_DocumentSecurity
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package 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
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,22 +31,22 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Exception extends Exception {
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
* @param mixed $file
|
||||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
$e->file = $file;
|
||||
throw $e;
|
||||
}
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
* @param mixed $file
|
||||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
$e->file = $file;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_HashTable
|
||||
{
|
||||
|
|
@ -53,7 +53,7 @@ class PHPExcel_HashTable
|
|||
* Create a new PHPExcel_HashTable
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
{
|
||||
|
|
@ -67,14 +67,14 @@ class PHPExcel_HashTable
|
|||
* Add HashTable items from source
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null) {
|
||||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
return;
|
||||
} else if (!is_array($pSource)) {
|
||||
throw new Exception('Invalid array parameter passed.');
|
||||
throw new PHPExcel_Exception('Invalid array parameter passed.');
|
||||
}
|
||||
|
||||
foreach ($pSource as $item) {
|
||||
|
|
@ -86,7 +86,7 @@ class PHPExcel_HashTable
|
|||
* Add HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to add
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function add(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
|
|
@ -100,7 +100,7 @@ class PHPExcel_HashTable
|
|||
* Remove HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to remove
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function remove(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_IComparable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_IOFactory
|
||||
{
|
||||
|
|
@ -96,13 +96,13 @@ class PHPExcel_IOFactory
|
|||
* @static
|
||||
* @access public
|
||||
* @param array $value
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function setSearchLocations($value) {
|
||||
if (is_array($value)) {
|
||||
self::$_searchLocations = $value;
|
||||
} else {
|
||||
throw new Exception('Invalid parameter passed.');
|
||||
throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
|
||||
}
|
||||
} // function setSearchLocations()
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ class PHPExcel_IOFactory
|
|||
* @param PHPExcel $phpExcel
|
||||
* @param string $writerType Example: Excel2007
|
||||
* @return PHPExcel_Writer_IWriter
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createWriter(PHPExcel $phpExcel, $writerType = '') {
|
||||
// Search type
|
||||
|
|
@ -146,7 +146,7 @@ class PHPExcel_IOFactory
|
|||
}
|
||||
|
||||
// Nothing found...
|
||||
throw new Exception("No $searchType found for type $writerType");
|
||||
throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
|
||||
} // function createWriter()
|
||||
|
||||
/**
|
||||
|
|
@ -156,7 +156,7 @@ class PHPExcel_IOFactory
|
|||
* @access public
|
||||
* @param string $readerType Example: Excel2007
|
||||
* @return PHPExcel_Reader_IReader
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createReader($readerType = '') {
|
||||
// Search type
|
||||
|
|
@ -175,7 +175,7 @@ class PHPExcel_IOFactory
|
|||
}
|
||||
|
||||
// Nothing found...
|
||||
throw new Exception("No $searchType found for type $readerType");
|
||||
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
|
||||
} // function createReader()
|
||||
|
||||
/**
|
||||
|
|
@ -183,9 +183,9 @@ class PHPExcel_IOFactory
|
|||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFileName The name of the spreadsheet file
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function load($pFilename) {
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
|
|
@ -197,9 +197,9 @@ class PHPExcel_IOFactory
|
|||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFileName The name of the spreadsheet file to identify
|
||||
* @param string $pFilename The name of the spreadsheet file to identify
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function identify($pFilename) {
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
|
|
@ -214,9 +214,9 @@ class PHPExcel_IOFactory
|
|||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFileName The name of the spreadsheet file
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
* @return PHPExcel_Reader_IReader
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createReaderForFile($pFilename) {
|
||||
|
||||
|
|
@ -283,6 +283,6 @@ class PHPExcel_IOFactory
|
|||
}
|
||||
}
|
||||
|
||||
throw new Exception('Unable to identify a reader for this file');
|
||||
throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
|
||||
} // function createReaderForFile()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_NamedRange
|
||||
{
|
||||
|
|
@ -78,12 +78,13 @@ class PHPExcel_NamedRange
|
|||
* @param string $pRange
|
||||
* @param bool $pLocalOnly
|
||||
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||
{
|
||||
// Validate data
|
||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
||||
throw new Exception('Parameters can not be null.');
|
||||
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||
}
|
||||
|
||||
// Set local members
|
||||
|
|
|
|||
227
htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php
Normal file
227
htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Abstract
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_readDataOnly = FALSE;
|
||||
|
||||
/**
|
||||
* Read charts that are defined in the workbook?
|
||||
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_includeCharts = FALSE;
|
||||
|
||||
/**
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
protected $_loadSheetsOnly = NULL;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
protected $_readFilter = NULL;
|
||||
|
||||
protected $_fileHandle = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setReadDataOnly($pValue = FALSE) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read charts in workbook?
|
||||
* If this is true, then the Reader will include any charts that exist in the workbook.
|
||||
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||
* If false (the default) it will ignore any charts defined in the workbook file.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeCharts() {
|
||||
return $this->_includeCharts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read charts in workbook
|
||||
* Set to true, to advise the Reader to include any charts that exist in the workbook.
|
||||
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||
* Set to false (the default) to discard charts.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setIncludeCharts($pValue = FALSE) {
|
||||
$this->_includeCharts = (boolean) $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
return $this->_loadSheetsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = NULL)
|
||||
{
|
||||
$this->_loadSheetsOnly = is_array($value) ?
|
||||
$value : array($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
$this->_loadSheetsOnly = NULL;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open file for reading
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
* @return resource
|
||||
*/
|
||||
protected function _openFile($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename) || !is_readable($pFilename)) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Open file
|
||||
$this->_fileHandle = fopen($pFilename, 'r');
|
||||
if ($this->_fileHandle === FALSE) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
try {
|
||||
$this->_openFile($pFilename);
|
||||
} catch (Exception $e) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$readable = $this->_isValidFormat();
|
||||
fclose ($this->_fileHandle);
|
||||
return $readable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
|
|
@ -92,144 +92,104 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||
*/
|
||||
private $_contiguous = false;
|
||||
|
||||
|
||||
/**
|
||||
* Row counter for loading rows contiguously
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_contiguousRow = -1;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @access private
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
} // function __construct()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
* Validate that the current file is a CSV file
|
||||
*
|
||||
* @access public
|
||||
* @param string $pFileName
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
protected function _isValidFormat()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
return true;
|
||||
} // function canRead()
|
||||
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @access public
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
} // function getReadFilter()
|
||||
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @access public
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
} // function setReadFilter()
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
public function setInputEncoding($pValue = 'UTF-8')
|
||||
{
|
||||
$this->_inputEncoding = $pValue;
|
||||
return $this;
|
||||
} // function setInputEncoding()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getInputEncoding()
|
||||
{
|
||||
return $this->_inputEncoding;
|
||||
} // function getInputEncoding()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
* Move filepointer past any BOM marker
|
||||
*
|
||||
* @access public
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
protected function _skipBOM()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
rewind($this->_fileHandle);
|
||||
|
||||
// Open file
|
||||
$fileHandle = fopen($pFilename, 'r');
|
||||
if ($fileHandle === false) {
|
||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
||||
}
|
||||
|
||||
// Skip BOM, if any
|
||||
switch ($this->_inputEncoding) {
|
||||
case 'UTF-8':
|
||||
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
||||
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16LE':
|
||||
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
fgets($this->_fileHandle, 3) == "\xFF\xFE" ?
|
||||
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16BE':
|
||||
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
fgets($this->_fileHandle, 3) == "\xFE\xFF" ?
|
||||
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32LE':
|
||||
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32BE':
|
||||
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
{
|
||||
// Open file
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
|
||||
// Skip BOM, if any
|
||||
$this->_skipBOM();
|
||||
|
||||
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
|
||||
|
||||
|
|
@ -255,14 +215,12 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||
return $worksheetInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
* @access public
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -271,65 +229,37 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||
|
||||
// Load into this instance
|
||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
} // function load()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
* @access public
|
||||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Create new PHPExcel
|
||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||
$objPHPExcel->createSheet();
|
||||
}
|
||||
$sheet = $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex );
|
||||
|
||||
$lineEnding = ini_get('auto_detect_line_endings');
|
||||
ini_set('auto_detect_line_endings', true);
|
||||
|
||||
// Open file
|
||||
$fileHandle = fopen($pFilename, 'r');
|
||||
if ($fileHandle === false) {
|
||||
throw new Exception("Could not open file $pFilename for reading.");
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
|
||||
// Skip BOM, if any
|
||||
switch ($this->_inputEncoding) {
|
||||
case 'UTF-8':
|
||||
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16LE':
|
||||
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16BE':
|
||||
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32LE':
|
||||
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32BE':
|
||||
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
$this->_skipBOM();
|
||||
|
||||
// Create new PHPExcel object
|
||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||
$objPHPExcel->createSheet();
|
||||
}
|
||||
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex);
|
||||
|
||||
$escapeEnclosures = array( "\\" . $this->_enclosure,
|
||||
$this->_enclosure . $this->_enclosure
|
||||
|
|
@ -373,48 +303,40 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||
|
||||
// Return
|
||||
return $objPHPExcel;
|
||||
} // function loadIntoExisting()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get delimiter
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
return $this->_delimiter;
|
||||
} // function getDelimiter()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set delimiter
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
} // function setDelimiter()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enclosure
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
return $this->_enclosure;
|
||||
} // function getEnclosure()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set enclosure
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
|
|
@ -424,82 +346,70 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||
}
|
||||
$this->_enclosure = $pValue;
|
||||
return $this;
|
||||
} // function setEnclosure()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line ending
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLineEnding() {
|
||||
return $this->_lineEnding;
|
||||
} // function getLineEnding()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set line ending
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setLineEnding($pValue = PHP_EOL) {
|
||||
$this->_lineEnding = $pValue;
|
||||
return $this;
|
||||
} // function setLineEnding()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
return $this->_sheetIndex;
|
||||
} // function getSheetIndex()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
*
|
||||
* @access public
|
||||
* @param int $pValue Sheet index
|
||||
* @param integer $pValue Sheet index
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
} // function setSheetIndex()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Contiguous
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Input encoding
|
||||
* @param boolean $contiguous
|
||||
*/
|
||||
public function setContiguous($contiguous = false)
|
||||
public function setContiguous($contiguous = FALSE)
|
||||
{
|
||||
$this->_contiguous = (bool)$contiguous;
|
||||
$this->_contiguous = (bool) $contiguous;
|
||||
if (!$contiguous) {
|
||||
$this->_contiguousRow = -1;
|
||||
$this->_contiguousRow = -1;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // function setInputEncoding()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Contiguous
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function getContiguous() {
|
||||
return $this->_contiguous;
|
||||
} // function getSheetIndex()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,24 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_readDataOnly = false;
|
||||
|
||||
/**
|
||||
* Restict which sheets should be loaded?
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
*
|
||||
|
|
@ -65,13 +51,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
*/
|
||||
private $_styles = array();
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
/**
|
||||
* Character set used in the file
|
||||
*
|
||||
|
|
@ -88,93 +67,12 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
return $this->_loadSheetsOnly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
$this->_loadSheetsOnly = is_array($value) ?
|
||||
$value : array($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
$this->_loadSheetsOnly = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
|
|
@ -194,15 +92,13 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
'<?mso-application progid="Excel.Sheet"?>'
|
||||
);
|
||||
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Open file
|
||||
$this->_openFile($pFilename);
|
||||
$fileHandle = $this->_fileHandle;
|
||||
|
||||
// Read sample data (first 2 KB will do)
|
||||
$fh = fopen($pFilename, 'r');
|
||||
$data = fread($fh, 2048);
|
||||
fclose($fh);
|
||||
$data = fread($fileHandle, 2048);
|
||||
fclose($fileHandle);
|
||||
|
||||
$valid = true;
|
||||
foreach($signature as $match) {
|
||||
|
|
@ -227,21 +123,21 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
if (!$this->canRead($pFilename)) {
|
||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
$xml = simplexml_load_file($pFilename);
|
||||
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
|
|
@ -258,18 +154,18 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$worksheetInfo = array();
|
||||
|
||||
$xml = simplexml_load_file($pFilename);
|
||||
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$worksheetID = 1;
|
||||
|
|
@ -330,7 +226,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -392,7 +288,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
|
|
@ -427,14 +323,14 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
if (!$this->canRead($pFilename)) {
|
||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
|
||||
$xml = simplexml_load_file($pFilename);
|
||||
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2007_Chart
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
} elseif ($format == 'integer') {
|
||||
return (integer) $attributes[$name];
|
||||
} elseif ($format == 'boolean') {
|
||||
return (boolean) ($attributes[$name] == '0') ? false : true;
|
||||
return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
||||
} else {
|
||||
return (float) $attributes[$name];
|
||||
}
|
||||
|
|
@ -347,6 +347,10 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($seriesVal)) {
|
||||
$seriesVal = NULL;
|
||||
}
|
||||
|
||||
return array( 'formatCode' => $formatCode,
|
||||
'pointCount' => $pointCount,
|
||||
'dataValues' => $seriesVal
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2007_Theme
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel5_Escher
|
||||
{
|
||||
|
|
|
|||
221
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php
Normal file
221
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Excel5_MD5
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel5_MD5
|
||||
{
|
||||
// Context
|
||||
private $a;
|
||||
private $b;
|
||||
private $c;
|
||||
private $d;
|
||||
|
||||
|
||||
/**
|
||||
* MD5 stream constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the MD5 stream context
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->a = 0x67452301;
|
||||
$this->b = 0xEFCDAB89;
|
||||
$this->c = 0x98BADCFE;
|
||||
$this->d = 0x10325476;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get MD5 stream context
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
$s = '';
|
||||
foreach (array('a', 'b', 'c', 'd') as $i) {
|
||||
$v = $this->{$i};
|
||||
$s .= chr($v & 0xff);
|
||||
$s .= chr(($v >> 8) & 0xff);
|
||||
$s .= chr(($v >> 16) & 0xff);
|
||||
$s .= chr(($v >> 24) & 0xff);
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add data to context
|
||||
*
|
||||
* @param string $data Data to add
|
||||
*/
|
||||
public function add($data)
|
||||
{
|
||||
$words = array_values(unpack('V16', $data));
|
||||
|
||||
$A = $this->a;
|
||||
$B = $this->b;
|
||||
$C = $this->c;
|
||||
$D = $this->d;
|
||||
|
||||
$F = array('PHPExcel_Reader_Excel5_MD5','F');
|
||||
$G = array('PHPExcel_Reader_Excel5_MD5','G');
|
||||
$H = array('PHPExcel_Reader_Excel5_MD5','H');
|
||||
$I = array('PHPExcel_Reader_Excel5_MD5','I');
|
||||
|
||||
/* ROUND 1 */
|
||||
self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478);
|
||||
self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756);
|
||||
self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db);
|
||||
self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee);
|
||||
self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf);
|
||||
self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a);
|
||||
self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613);
|
||||
self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501);
|
||||
self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8);
|
||||
self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af);
|
||||
self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1);
|
||||
self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be);
|
||||
self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122);
|
||||
self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193);
|
||||
self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e);
|
||||
self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821);
|
||||
|
||||
/* ROUND 2 */
|
||||
self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562);
|
||||
self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340);
|
||||
self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51);
|
||||
self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa);
|
||||
self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d);
|
||||
self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453);
|
||||
self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681);
|
||||
self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8);
|
||||
self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6);
|
||||
self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6);
|
||||
self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87);
|
||||
self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed);
|
||||
self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905);
|
||||
self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8);
|
||||
self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9);
|
||||
self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a);
|
||||
|
||||
/* ROUND 3 */
|
||||
self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942);
|
||||
self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681);
|
||||
self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122);
|
||||
self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c);
|
||||
self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44);
|
||||
self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9);
|
||||
self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60);
|
||||
self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70);
|
||||
self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6);
|
||||
self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa);
|
||||
self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085);
|
||||
self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05);
|
||||
self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039);
|
||||
self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5);
|
||||
self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8);
|
||||
self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665);
|
||||
|
||||
/* ROUND 4 */
|
||||
self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244);
|
||||
self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97);
|
||||
self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7);
|
||||
self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039);
|
||||
self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3);
|
||||
self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92);
|
||||
self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d);
|
||||
self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1);
|
||||
self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f);
|
||||
self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0);
|
||||
self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314);
|
||||
self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1);
|
||||
self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82);
|
||||
self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235);
|
||||
self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb);
|
||||
self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391);
|
||||
|
||||
$this->a = ($this->a + $A) & 0xffffffff;
|
||||
$this->b = ($this->b + $B) & 0xffffffff;
|
||||
$this->c = ($this->c + $C) & 0xffffffff;
|
||||
$this->d = ($this->d + $D) & 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
private static function F($X, $Y, $Z)
|
||||
{
|
||||
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
||||
}
|
||||
|
||||
|
||||
private static function G($X, $Y, $Z)
|
||||
{
|
||||
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
||||
}
|
||||
|
||||
|
||||
private static function H($X, $Y, $Z)
|
||||
{
|
||||
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
||||
}
|
||||
|
||||
|
||||
private static function I($X, $Y, $Z)
|
||||
{
|
||||
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
||||
}
|
||||
|
||||
|
||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||
{
|
||||
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
||||
$A = self::rotate($A, $s);
|
||||
$A = ($B + $A) & 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
private static function rotate($decimal, $bits)
|
||||
{
|
||||
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
||||
return bindec(substr($binary, $bits).substr($binary, 0, $bits));
|
||||
}
|
||||
}
|
||||
88
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php
Normal file
88
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Excel5_RC4
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel5_RC4
|
||||
{
|
||||
// Context
|
||||
var $s = array();
|
||||
var $i = 0;
|
||||
var $j = 0;
|
||||
|
||||
/**
|
||||
* RC4 stream decryption/encryption constrcutor
|
||||
*
|
||||
* @param string $key Encryption key/passphrase
|
||||
*/
|
||||
public function __construct($key)
|
||||
{
|
||||
$len = strlen($key);
|
||||
|
||||
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||
$this->s[$this->i] = $this->i;
|
||||
}
|
||||
|
||||
$this->j = 0;
|
||||
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||
$this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
|
||||
$t = $this->s[$this->i];
|
||||
$this->s[$this->i] = $this->s[$this->j];
|
||||
$this->s[$this->j] = $t;
|
||||
}
|
||||
$this->i = $this->j = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Symmetric decryption/encryption function
|
||||
*
|
||||
* @param string $data Data to encrypt/decrypt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function RC4($data)
|
||||
{
|
||||
$len = strlen($data);
|
||||
for ($c = 0; $c < $len; $c++) {
|
||||
$this->i = ($this->i + 1) % 256;
|
||||
$this->j = ($this->j + $this->s[$this->i]) % 256;
|
||||
$t = $this->s[$this->i];
|
||||
$this->s[$this->i] = $this->s[$this->j];
|
||||
$this->s[$this->j] = $t;
|
||||
|
||||
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
|
||||
|
||||
$data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
52
htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php
Normal file
52
htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Exception
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Exception extends PHPExcel_Exception {
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
* @param mixed $file
|
||||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
$e->file = $file;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,27 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||
class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_readDataOnly = false;
|
||||
|
||||
/**
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
*
|
||||
|
|
@ -77,13 +60,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
|
||||
private $_referenceHelper = null;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_Gnumeric
|
||||
|
|
@ -94,115 +70,23 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
return $this->_loadSheetsOnly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
$this->_loadSheetsOnly = is_array($value) ?
|
||||
$value : array($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
$this->_loadSheetsOnly = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Check if gzlib functions are available
|
||||
if (!function_exists('gzread')) {
|
||||
throw new Exception("gzlib library is not enabled");
|
||||
throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
|
||||
}
|
||||
|
||||
// Read signature data (first 3 bytes)
|
||||
|
|
@ -218,50 +102,87 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$xml = new XMLReader();
|
||||
$xml->open(
|
||||
'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$xml->setParserProperty(2,true);
|
||||
|
||||
$worksheetNames = array();
|
||||
while ($xml->read()) {
|
||||
if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$xml->read(); // Move onto the value node
|
||||
$worksheetNames[] = (string) $xml->value;
|
||||
} elseif ($xml->name == 'gnm:Sheets') {
|
||||
// break out of the loop once we've got our sheet names rather than parse the entire file
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||
|
||||
$xml = simplexml_load_string($gFileData);
|
||||
$namespacesMeta = $xml->getNamespaces(true);
|
||||
|
||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
||||
$xml = new XMLReader();
|
||||
$xml->open(
|
||||
'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$xml->setParserProperty(2,true);
|
||||
|
||||
$worksheetInfo = array();
|
||||
while ($xml->read()) {
|
||||
if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$tmpInfo = array(
|
||||
'worksheetName' => '',
|
||||
'lastColumnLetter' => 'A',
|
||||
'lastColumnIndex' => 0,
|
||||
'totalRows' => 0,
|
||||
'totalColumns' => 0,
|
||||
);
|
||||
|
||||
foreach ($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$tmpInfo = array();
|
||||
$tmpInfo['worksheetName'] = (string) $sheet->Name;
|
||||
$tmpInfo['lastColumnLetter'] = 'A';
|
||||
$tmpInfo['lastColumnIndex'] = 0;
|
||||
$tmpInfo['totalRows'] = 0;
|
||||
$tmpInfo['totalColumns'] = 0;
|
||||
|
||||
foreach ($sheet->Cells->Cell as $cell) {
|
||||
$cellAttributes = $cell->attributes();
|
||||
|
||||
$rowIndex = (int) $cellAttributes->Row + 1;
|
||||
$columnIndex = (int) $cellAttributes->Col;
|
||||
|
||||
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||
while ($xml->read()) {
|
||||
if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$xml->read(); // Move onto the value node
|
||||
$tmpInfo['worksheetName'] = (string) $xml->value;
|
||||
} elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$xml->read(); // Move onto the value node
|
||||
$tmpInfo['lastColumnIndex'] = (int) $xml->value;
|
||||
$tmpInfo['totalColumns'] = (int) $xml->value + 1;
|
||||
} elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$xml->read(); // Move onto the value node
|
||||
$tmpInfo['totalRows'] = (int) $xml->value + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||
$worksheetInfo[] = $tmpInfo;
|
||||
}
|
||||
|
||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||
|
||||
$worksheetInfo[] = $tmpInfo;
|
||||
}
|
||||
|
||||
return $worksheetInfo;
|
||||
|
|
@ -286,7 +207,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -298,49 +219,19 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||
|
||||
$xml = simplexml_load_string($gFileData);
|
||||
$namespacesMeta = $xml->getNamespaces(true);
|
||||
|
||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$worksheetNames[] = (string) $sheet->Name;
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$timezoneObj = new DateTimeZone('Europe/London');
|
||||
|
|
@ -352,7 +243,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
|
||||
// echo '</pre><hr />';
|
||||
//
|
||||
$xml = simplexml_load_string($gFileData);
|
||||
$xml = simplexml_load_string($gFileData, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespacesMeta = $xml->getNamespaces(true);
|
||||
|
||||
// var_dump($namespacesMeta);
|
||||
|
|
@ -620,7 +511,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||
|
||||
// We still set the number format mask for date/time values, even if _readDataOnly is true
|
||||
if ((!$this->_readDataOnly) ||
|
||||
(PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) {
|
||||
(PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
|
||||
$styleArray = array();
|
||||
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
||||
// If _readDataOnly is false, we set all formatting information
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
||||
class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
|
|
@ -100,13 +100,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
), // Bottom border
|
||||
);
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_HTML
|
||||
|
|
@ -116,25 +109,20 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
* Validate that the current file is an HTML file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
protected function _isValidFormat()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
// Reading 2048 bytes should be enough to validate that the format is HTML
|
||||
$data = fread($this->_fileHandle, 2048);
|
||||
if ((strpos($data, '<') !== FALSE) &&
|
||||
(strlen($data) !== strlen(strip_tags($data)))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Read sample data (first 2 KB will do)
|
||||
$fh = fopen($pFilename, 'r');
|
||||
$data = fread($fh, 2048);
|
||||
fclose($fh);
|
||||
|
||||
return true;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +130,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -153,25 +141,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
*
|
||||
|
|
@ -222,7 +191,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
// Simple String content
|
||||
if (trim($cellContent) > '') {
|
||||
// Only actually write it if there's content in the string
|
||||
echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
|
||||
// echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
|
||||
// Write to worksheet to be done here...
|
||||
// ... we return the cell so we can mess about with styles more easily
|
||||
$cell = $sheet->setCellValue($column.$row,$cellContent,true);
|
||||
|
|
@ -238,7 +207,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
|
||||
private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){
|
||||
foreach($element->childNodes as $child){
|
||||
if ($child instanceOf DOMText) {
|
||||
if ($child instanceof DOMText) {
|
||||
$domText = preg_replace('/\s+/',' ',trim($child->nodeValue));
|
||||
if (is_string($cellContent)) {
|
||||
// simply append the text if the cell content is a plain text string
|
||||
|
|
@ -247,12 +216,12 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
// but if we have a rich text run instead, we need to append it correctly
|
||||
// TODO
|
||||
}
|
||||
} elseif($child instanceOf DOMElement) {
|
||||
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
||||
} elseif($child instanceof DOMElement) {
|
||||
// echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
||||
|
||||
$attributeArray = array();
|
||||
foreach($child->attributes as $attribute) {
|
||||
echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
|
||||
// echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
|
||||
$attributeArray[$attribute->name] = $attribute->value;
|
||||
}
|
||||
|
||||
|
|
@ -280,13 +249,13 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
case 'em' :
|
||||
case 'strong':
|
||||
case 'b' :
|
||||
echo 'STYLING, SPAN OR DIV<br />';
|
||||
// echo 'STYLING, SPAN OR DIV<br />';
|
||||
if ($cellContent > '')
|
||||
$cellContent .= ' ';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
if ($cellContent > '')
|
||||
$cellContent .= ' ';
|
||||
echo 'END OF STYLING, SPAN OR DIV<br />';
|
||||
// echo 'END OF STYLING, SPAN OR DIV<br />';
|
||||
break;
|
||||
case 'hr' :
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
|
|
@ -307,14 +276,14 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
++$row;
|
||||
}
|
||||
echo 'HARD LINE BREAK: ' , '<br />';
|
||||
// echo 'HARD LINE BREAK: ' , '<br />';
|
||||
break;
|
||||
case 'a' :
|
||||
echo 'START OF HYPERLINK: ' , '<br />';
|
||||
// echo 'START OF HYPERLINK: ' , '<br />';
|
||||
foreach($attributeArray as $attributeName => $attributeValue) {
|
||||
switch($attributeName) {
|
||||
case 'href':
|
||||
echo 'Link to ' , $attributeValue , '<br />';
|
||||
// echo 'Link to ' , $attributeValue , '<br />';
|
||||
$sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue);
|
||||
if (isset($this->_formats[$child->nodeName])) {
|
||||
$sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]);
|
||||
|
|
@ -324,7 +293,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
}
|
||||
$cellContent .= ' ';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF HYPERLINK:' , '<br />';
|
||||
// echo 'END OF HYPERLINK:' , '<br />';
|
||||
break;
|
||||
case 'h1' :
|
||||
case 'h2' :
|
||||
|
|
@ -338,17 +307,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
if ($this->_tableLevel > 0) {
|
||||
// If we're inside a table, replace with a \n
|
||||
$cellContent .= "\n";
|
||||
echo 'LIST ENTRY: ' , '<br />';
|
||||
// echo 'LIST ENTRY: ' , '<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF LIST ENTRY:' , '<br />';
|
||||
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||
} else {
|
||||
if ($cellContent > '') {
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
$row += 2;
|
||||
}
|
||||
echo 'START OF PARAGRAPH: ' , '<br />';
|
||||
// echo 'START OF PARAGRAPH: ' , '<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF PARAGRAPH:' , '<br />';
|
||||
// echo 'END OF PARAGRAPH:' , '<br />';
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
|
||||
if (isset($this->_formats[$child->nodeName])) {
|
||||
|
|
@ -363,17 +332,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
if ($this->_tableLevel > 0) {
|
||||
// If we're inside a table, replace with a \n
|
||||
$cellContent .= "\n";
|
||||
echo 'LIST ENTRY: ' , '<br />';
|
||||
// echo 'LIST ENTRY: ' , '<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF LIST ENTRY:' , '<br />';
|
||||
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||
} else {
|
||||
if ($cellContent > '') {
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
}
|
||||
++$row;
|
||||
echo 'LIST ENTRY: ' , '<br />';
|
||||
// echo 'LIST ENTRY: ' , '<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF LIST ENTRY:' , '<br />';
|
||||
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
$column = 'A';
|
||||
}
|
||||
|
|
@ -381,11 +350,11 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
case 'table' :
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
$column = $this->_setTableStartColumn($column);
|
||||
echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||
// echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||
if ($this->_tableLevel > 1)
|
||||
--$row;
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||
// echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||
$column = $this->_releaseTableStartColumn();
|
||||
if ($this->_tableLevel > 1) {
|
||||
++$column;
|
||||
|
|
@ -401,15 +370,15 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
++$row;
|
||||
$column = $this->_getTableStartColumn();
|
||||
$cellContent = '';
|
||||
echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||
// echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||
// echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||
break;
|
||||
case 'th' :
|
||||
case 'td' :
|
||||
echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||
// echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||
echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||
// echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||
++$column;
|
||||
break;
|
||||
|
|
@ -433,18 +402,18 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
if (!is_file($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! The given file is not a regular file.");
|
||||
// Open file to validate
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file.");
|
||||
}
|
||||
// Close after validating
|
||||
fclose ($this->_fileHandle);
|
||||
|
||||
// Create new PHPExcel
|
||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||
|
|
@ -454,10 +423,10 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
|
||||
// Create a new DOM object
|
||||
$dom = new domDocument;
|
||||
// Load the HTML file into the DOM object
|
||||
$loaded = $dom->loadHTMLFile($pFilename);
|
||||
if ($loaded === false) {
|
||||
throw new Exception('Failed to load ',$pFilename,' as a DOM Document');
|
||||
// Reload the HTML file into the DOM object
|
||||
$loaded = $dom->loadHTMLFile($pFilename, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
if ($loaded === FALSE) {
|
||||
throw new PHPExcel_Reader_Exception('Failed to load ',$pFilename,' as a DOM Document');
|
||||
}
|
||||
|
||||
// Discard white space
|
||||
|
|
@ -469,8 +438,8 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||
$content = '';
|
||||
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);
|
||||
|
||||
echo '<hr />';
|
||||
var_dump($this->_dataArray);
|
||||
// echo '<hr />';
|
||||
// var_dump($this->_dataArray);
|
||||
|
||||
// Return
|
||||
return $objPHPExcel;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRead($pFilename);
|
||||
|
|
@ -46,8 +46,8 @@ interface PHPExcel_Reader_IReader
|
|||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @throws Exception
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
|
|
@ -72,14 +72,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
*/
|
||||
private $_format = 0;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_SYLK
|
||||
*/
|
||||
|
|
@ -87,63 +79,31 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
* Validate that the current file is a SYLK file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
protected function _isValidFormat()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Read sample data (first 2 KB will do)
|
||||
$fh = fopen($pFilename, 'r');
|
||||
$data = fread($fh, 2048);
|
||||
fclose($fh);
|
||||
$data = fread($this->_fileHandle, 2048);
|
||||
|
||||
// Count delimiters in file
|
||||
$delimiterCount = substr_count($data, ';');
|
||||
if ($delimiterCount < 1) {
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Analyze first line looking for ID; signature
|
||||
$lines = explode("\n", $data);
|
||||
if (substr($lines[0],0,4) != 'ID;P') {
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
*
|
||||
|
|
@ -155,7 +115,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
*
|
||||
|
|
@ -166,25 +125,22 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $this->_inputEncoding;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Open file
|
||||
$fileHandle = fopen($pFilename, 'r');
|
||||
if ($fileHandle === false) {
|
||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
rewind($fileHandle);
|
||||
|
||||
$worksheetInfo = array();
|
||||
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
||||
|
|
@ -206,7 +162,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
|
||||
// explode each row at semicolons while taking into account that literal semicolon (;)
|
||||
// is escaped like this (;;)
|
||||
$rowData = explode("\t",str_replace('?',';',str_replace(';',"\t",str_replace(';;','?',rtrim($rowData)))));
|
||||
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData)))));
|
||||
|
||||
$dataType = array_shift($rowData);
|
||||
if ($dataType == 'C') {
|
||||
|
|
@ -238,13 +194,12 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $worksheetInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -255,21 +210,24 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
// Open file
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
rewind($fileHandle);
|
||||
|
||||
// Create new PHPExcel
|
||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||
|
|
@ -280,12 +238,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
$fromFormats = array('\-', '\ ');
|
||||
$toFormats = array('-', ' ');
|
||||
|
||||
// Open file
|
||||
$fileHandle = fopen($pFilename, 'r');
|
||||
if ($fileHandle === false) {
|
||||
throw new Exception("Could not open file $pFilename for reading.");
|
||||
}
|
||||
|
||||
// Loop through file
|
||||
$rowData = array();
|
||||
$column = $row = '';
|
||||
|
|
@ -433,7 +385,9 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
}
|
||||
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
||||
if (isset($this->_formats[$formatStyle])) {
|
||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
||||
}
|
||||
}
|
||||
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
|
|
@ -473,7 +427,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
|
|
@ -483,7 +436,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_ReferenceHelper
|
||||
{
|
||||
|
|
@ -69,30 +69,336 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert a new column, updating all possible related data
|
||||
* Compare two column addresses
|
||||
* Intended for use as a Callback function for sorting column addresses by column
|
||||
*
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to insert
|
||||
* @param int $pNumRows Number of rows to insert
|
||||
* @throws Exception
|
||||
* @param string $a First column to test (e.g. 'AA')
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
* @return integer
|
||||
*/
|
||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null) {
|
||||
public static function columnSort($a, $b) {
|
||||
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two column addresses
|
||||
* Intended for use as a Callback function for reverse sorting column addresses by column
|
||||
*
|
||||
* @param string $a First column to test (e.g. 'AA')
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
* @return integer
|
||||
*/
|
||||
public static function columnReverseSort($a, $b) {
|
||||
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two cell addresses
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||
*
|
||||
* @param string $a First cell to test (e.g. 'AA1')
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
* @return integer
|
||||
*/
|
||||
public static function cellSort($a, $b) {
|
||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||
|
||||
if ($ar == $br) {
|
||||
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||
}
|
||||
return ($ar < $br) ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two cell addresses
|
||||
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||
*
|
||||
* @param string $a First cell to test (e.g. 'AA1')
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
* @return integer
|
||||
*/
|
||||
public static function cellReverseSort($a, $b) {
|
||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||
|
||||
if ($ar == $br) {
|
||||
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||
}
|
||||
return ($ar < $br) ? 1 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether a cell address falls within a defined range of cells
|
||||
*
|
||||
* @param string $cellAddress Address of the cell we're testing
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @return boolean
|
||||
*/
|
||||
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
|
||||
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
|
||||
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
|
||||
// Is cell within the range of rows/columns if we're deleting
|
||||
if ($pNumRows < 0 &&
|
||||
($cellRow >= ($beforeRow + $pNumRows)) &&
|
||||
($cellRow < $beforeRow)) {
|
||||
return TRUE;
|
||||
} elseif ($pNumCols < 0 &&
|
||||
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
|
||||
($cellColumnIndex < $beforeColumnIndex)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update page breaks when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aBreaks = $pSheet->getBreaks();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
|
||||
foreach ($aBreaks as $key => $value) {
|
||||
if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
|
||||
// If we're deleting, then clear any defined breaks that are within the range
|
||||
// of rows/columns that we're deleting
|
||||
$pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||
} else {
|
||||
// Otherwise update any affected breaks by inserting a new break at the appropriate point
|
||||
// and removing the old affected break
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setBreak($newReference, $value)
|
||||
->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update cell comments when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aComments = $pSheet->getComments();
|
||||
$aNewComments = array(); // the new array of all comments
|
||||
|
||||
foreach ($aComments as $key => &$value) {
|
||||
// Any comments inside a deleted range will be ignored
|
||||
if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
|
||||
// Otherwise build a new array of comments indexed by the adjusted cell reference
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewComments[$newReference] = $value;
|
||||
}
|
||||
}
|
||||
// Replace the comments array with the new set of comments
|
||||
$pSheet->setComments($aNewComments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update hyperlinks when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
|
||||
foreach ($aHyperlinkCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setHyperlink( $newReference, $value );
|
||||
$pSheet->setHyperlink( $key, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update data validations when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
foreach ($aDataValidationCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setDataValidation( $newReference, $value );
|
||||
$pSheet->setDataValidation( $key, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update merged cells when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aMergeCells = $pSheet->getMergeCells();
|
||||
$aNewMergeCells = array(); // the new array of all merge cells
|
||||
foreach ($aMergeCells as $key => &$value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewMergeCells[$newReference] = $newReference;
|
||||
}
|
||||
$pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
|
||||
}
|
||||
|
||||
/**
|
||||
* Update protected cells when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aProtectedCells = $pSheet->getProtectedCells();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
foreach ($aProtectedCells as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->protectCells( $newReference, $value, true );
|
||||
$pSheet->unprotectCells( $key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update column dimensions when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
||||
if (!empty($aColumnDimensions)) {
|
||||
foreach ($aColumnDimensions as $objColumnDimension) {
|
||||
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
|
||||
list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
if ($objColumnDimension->getColumnIndex() != $newReference) {
|
||||
$objColumnDimension->setColumnIndex($newReference);
|
||||
}
|
||||
}
|
||||
$pSheet->refreshColumnDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update row dimensions when inserting/deleting rows/columns
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
*/
|
||||
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
||||
if (!empty($aRowDimensions)) {
|
||||
foreach ($aRowDimensions as $objRowDimension) {
|
||||
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
|
||||
list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
if ($objRowDimension->getRowIndex() != $newReference) {
|
||||
$objRowDimension->setRowIndex($newReference);
|
||||
}
|
||||
}
|
||||
$pSheet->refreshRowDimensions();
|
||||
|
||||
$copyDimension = $pSheet->getRowDimension($beforeRow - 1);
|
||||
for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
|
||||
$newDimension = $pSheet->getRowDimension($i);
|
||||
$newDimension->setRowHeight($copyDimension->getRowHeight());
|
||||
$newDimension->setVisible($copyDimension->getVisible());
|
||||
$newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
|
||||
$newDimension->setCollapsed($copyDimension->getCollapsed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new column or row, updating all possible related data
|
||||
*
|
||||
* @param string $pBefore Insert before this cell address (e.g. 'A1')
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
|
||||
{
|
||||
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
||||
$aCellCollection = $pSheet->getCellCollection();
|
||||
|
||||
// Get coordinates of $pBefore
|
||||
$beforeColumn = 'A';
|
||||
$beforeRow = 1;
|
||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
|
||||
|
||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
|
||||
$beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn);
|
||||
|
||||
// Clear cells if we are removing columns or rows
|
||||
$highestColumn = $pSheet->getHighestColumn();
|
||||
$highestRow = $pSheet->getHighestRow();
|
||||
|
||||
// 1. Clear column strips if we are removing columns
|
||||
if ($pNumCols < 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols > 0) {
|
||||
if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) {
|
||||
for ($i = 1; $i <= $highestRow - 1; ++$i) {
|
||||
for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1 + $pNumCols; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2; ++$j) {
|
||||
for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) {
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i;
|
||||
$pSheet->removeConditionalStyles($coordinate);
|
||||
if ($pSheet->cellExists($coordinate)) {
|
||||
|
|
@ -105,7 +411,7 @@ class PHPExcel_ReferenceHelper
|
|||
|
||||
// 2. Clear row strips if we are removing rows
|
||||
if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) {
|
||||
for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||
for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) {
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j;
|
||||
$pSheet->removeConditionalStyles($coordinate);
|
||||
|
|
@ -117,21 +423,28 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Loop through cells, bottom-up, and change cell coordinates
|
||||
while (($cellID = ($pNumCols < 0 || $pNumRows < 0) ? array_shift($aCellCollection) : array_pop($aCellCollection))) {
|
||||
if($remove) {
|
||||
// It's faster to reverse and pop than to use unshift, especially with large cell collections
|
||||
$aCellCollection = array_reverse($aCellCollection);
|
||||
}
|
||||
while ($cellID = array_pop($aCellCollection)) {
|
||||
$cell = $pSheet->getCell($cellID);
|
||||
$cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
|
||||
|
||||
if ($cellIndex-1 + $pNumCols < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// New coordinates
|
||||
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols ) . ($cell->getRow() + $pNumRows);
|
||||
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
|
||||
|
||||
// Should the cell be updated? Move value and cellXf index from one cell to another.
|
||||
if ((PHPExcel_Cell::columnIndexFromString( $cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) &&
|
||||
if (($cellIndex >= $beforeColumnIndex) &&
|
||||
($cell->getRow() >= $beforeRow)) {
|
||||
|
||||
// Update cell styles
|
||||
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
|
||||
$cell->setXfIndex(0);
|
||||
|
||||
// Insert this cell at its new location
|
||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
|
|
@ -145,7 +458,7 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
|
||||
// Clear the original cell
|
||||
$pSheet->getCell($cell->getCoordinate())->setValue('');
|
||||
$pSheet->getCellCacheController()->deleteCacheData($cellID);
|
||||
|
||||
} else {
|
||||
/* We don't need to update styles for rows/columns before our insertion position,
|
||||
|
|
@ -159,21 +472,20 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Duplicate styles for the newly inserted cells
|
||||
$highestColumn = $pSheet->getHighestColumn();
|
||||
$highestRow = $pSheet->getHighestRow();
|
||||
|
||||
if ($pNumCols > 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 > 0) {
|
||||
if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
|
||||
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
||||
|
||||
// Style
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 ) . $i;
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
|
||||
if ($pSheet->cellExists($coordinate)) {
|
||||
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
||||
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
||||
$pSheet->getConditionalStyles($coordinate) : false;
|
||||
for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols; ++$j) {
|
||||
for ($j = $beforeColumnIndex - 1; $j <= $beforeColumnIndex - 2 + $pNumCols; ++$j) {
|
||||
$pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex);
|
||||
if ($conditionalStyles) {
|
||||
$cloned = array();
|
||||
|
|
@ -189,7 +501,7 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
|
||||
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
|
||||
for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||
|
||||
// Style
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
|
||||
|
|
@ -211,105 +523,29 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Update worksheet: column dimensions
|
||||
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
||||
if (!empty($aColumnDimensions)) {
|
||||
foreach ($aColumnDimensions as $objColumnDimension) {
|
||||
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
|
||||
list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
if ($objColumnDimension->getColumnIndex() != $newReference) {
|
||||
$objColumnDimension->setColumnIndex($newReference);
|
||||
}
|
||||
}
|
||||
$pSheet->refreshColumnDimensions();
|
||||
}
|
||||
|
||||
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: row dimensions
|
||||
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
||||
if (!empty($aRowDimensions)) {
|
||||
foreach ($aRowDimensions as $objRowDimension) {
|
||||
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
|
||||
list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
if ($objRowDimension->getRowIndex() != $newReference) {
|
||||
$objRowDimension->setRowIndex($newReference);
|
||||
}
|
||||
}
|
||||
$pSheet->refreshRowDimensions();
|
||||
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
$copyDimension = $pSheet->getRowDimension($beforeRow - 1);
|
||||
for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
|
||||
$newDimension = $pSheet->getRowDimension($i);
|
||||
$newDimension->setRowHeight($copyDimension->getRowHeight());
|
||||
$newDimension->setVisible($copyDimension->getVisible());
|
||||
$newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
|
||||
$newDimension->setCollapsed($copyDimension->getCollapsed());
|
||||
}
|
||||
}
|
||||
// Update worksheet: page breaks
|
||||
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
|
||||
// Update worksheet: breaks
|
||||
$aBreaks = array_reverse($pSheet->getBreaks(), true);
|
||||
foreach ($aBreaks as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setBreak( $newReference, $value );
|
||||
$pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE );
|
||||
}
|
||||
}
|
||||
|
||||
// Update worksheet: comments
|
||||
$aComments = $pSheet->getComments();
|
||||
$aNewComments = array(); // the new array of all comments
|
||||
foreach ($aComments as $key => &$value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewComments[$newReference] = $value;
|
||||
}
|
||||
$pSheet->setComments($aNewComments); // replace the comments array
|
||||
// Update worksheet: comments
|
||||
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: hyperlinks
|
||||
$aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true);
|
||||
foreach ($aHyperlinkCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setHyperlink( $newReference, $value );
|
||||
$pSheet->setHyperlink( $key, null );
|
||||
}
|
||||
}
|
||||
|
||||
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: data validations
|
||||
$aDataValidationCollection = array_reverse($pSheet->getDataValidationCollection(), true);
|
||||
foreach ($aDataValidationCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setDataValidation( $newReference, $value );
|
||||
$pSheet->setDataValidation( $key, null );
|
||||
}
|
||||
}
|
||||
|
||||
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: merge cells
|
||||
$aMergeCells = $pSheet->getMergeCells();
|
||||
$aNewMergeCells = array(); // the new array of all merge cells
|
||||
foreach ($aMergeCells as $key => &$value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewMergeCells[$newReference] = $newReference;
|
||||
}
|
||||
$pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
|
||||
|
||||
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: protected cells
|
||||
$aProtectedCells = array_reverse($pSheet->getProtectedCells(), true);
|
||||
foreach ($aProtectedCells as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->protectCells( $newReference, $value, true );
|
||||
$pSheet->unprotectCells( $key );
|
||||
}
|
||||
}
|
||||
|
||||
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||
|
||||
// Update worksheet: autofilter
|
||||
$autoFilter = $pSheet->getAutoFilter();
|
||||
|
|
@ -318,7 +554,7 @@ class PHPExcel_ReferenceHelper
|
|||
if ($pNumCols != 0) {
|
||||
$autoFilterColumns = array_keys($autoFilter->getColumns());
|
||||
if (count($autoFilterColumns) > 0) {
|
||||
list($column,$row) = sscanf($pBefore,'%[A-Z]%d');
|
||||
sscanf($pBefore,'%[A-Z]%d', $column, $row);
|
||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
if ($columnIndex <= $rangeEnd[0]) {
|
||||
|
|
@ -369,19 +605,16 @@ class PHPExcel_ReferenceHelper
|
|||
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
|
||||
}
|
||||
|
||||
|
||||
// Update worksheet: freeze pane
|
||||
if ($pSheet->getFreezePane() != '') {
|
||||
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
|
||||
}
|
||||
|
||||
|
||||
// Page setup
|
||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
|
||||
}
|
||||
|
||||
|
||||
// Update worksheet: drawings
|
||||
$aDrawings = $pSheet->getDrawingCollection();
|
||||
foreach ($aDrawings as $objDrawing) {
|
||||
|
|
@ -391,7 +624,6 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Update workbook: named ranges
|
||||
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
||||
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
||||
|
|
@ -414,8 +646,9 @@ class PHPExcel_ReferenceHelper
|
|||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to insert
|
||||
* @param int $pNumRows Number of rows to insert
|
||||
* @param string $sheetName Worksheet name/title
|
||||
* @return string Updated formula
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||
// Update cell references in the formula
|
||||
|
|
@ -445,7 +678,7 @@ class PHPExcel_ReferenceHelper
|
|||
$cellIndex = $column.$row;
|
||||
|
||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||
$cellTokens[$cellIndex] = '/(?<!\d)'.preg_quote($fromString).'(?!\d)/i';
|
||||
$cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i';
|
||||
++$adjustCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -470,7 +703,7 @@ class PHPExcel_ReferenceHelper
|
|||
$cellIndex = $column.$row;
|
||||
|
||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?![A-Z])/i';
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i';
|
||||
++$adjustCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -496,7 +729,7 @@ class PHPExcel_ReferenceHelper
|
|||
$cellIndex = $column.$row;
|
||||
|
||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i';
|
||||
++$adjustCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -504,12 +737,13 @@ class PHPExcel_ReferenceHelper
|
|||
}
|
||||
// Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3];
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
if ($match[3] !== $modified3) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
|
|
@ -518,19 +752,23 @@ class PHPExcel_ReferenceHelper
|
|||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||
$row = trim($row,'$') + 10000000;
|
||||
$cellIndex = $column.$row;
|
||||
$cellIndex = $row . $column;
|
||||
|
||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
|
||||
$cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i';
|
||||
++$adjustCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($adjustCount > 0) {
|
||||
krsort($cellTokens);
|
||||
krsort($newCellTokens);
|
||||
// Update cell references in the formula
|
||||
if ($pNumCols > 0 || $pNumRows > 0) {
|
||||
krsort($cellTokens);
|
||||
krsort($newCellTokens);
|
||||
} else {
|
||||
ksort($cellTokens);
|
||||
ksort($newCellTokens);
|
||||
} // Update cell references in the formula
|
||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
|
||||
}
|
||||
}
|
||||
|
|
@ -549,7 +787,7 @@ class PHPExcel_ReferenceHelper
|
|||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
* @return string Updated cell range
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
// Is it in another worksheet? Will not have to update anything.
|
||||
|
|
@ -603,7 +841,7 @@ class PHPExcel_ReferenceHelper
|
|||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
* @return string Updated cell range
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||
|
|
@ -628,7 +866,7 @@ class PHPExcel_ReferenceHelper
|
|||
// Recreate range string
|
||||
return PHPExcel_Cell::buildRange($range);
|
||||
} else {
|
||||
throw new Exception("Only cell ranges may be passed to this method.");
|
||||
throw new PHPExcel_Exception("Only cell ranges may be passed to this method.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +878,7 @@ class PHPExcel_ReferenceHelper
|
|||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
* @return string Updated cell reference
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
||||
|
|
@ -653,7 +891,6 @@ class PHPExcel_ReferenceHelper
|
|||
// Verify which parts should be updated
|
||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
||||
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
||||
|
||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
||||
$newRow >= $beforeRow);
|
||||
|
||||
|
|
@ -670,16 +907,16 @@ class PHPExcel_ReferenceHelper
|
|||
// Return new reference
|
||||
return $newColumn . $newRow;
|
||||
} else {
|
||||
throw new Exception("Only single cell references may be passed to this method.");
|
||||
throw new PHPExcel_Exception("Only single cell references may be passed to this method.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __clone implementation. Cloning should not be allowed in a Singleton!
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public final function __clone() {
|
||||
throw new Exception("Cloning a Singleton is not allowed!");
|
||||
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,81 +31,81 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Rich text elements
|
||||
*
|
||||
* @var PHPExcel_RichText_ITextElement[]
|
||||
*/
|
||||
private $_richTextElements;
|
||||
/**
|
||||
* Rich text elements
|
||||
*
|
||||
* @var PHPExcel_RichText_ITextElement[]
|
||||
*/
|
||||
private $_richTextElements;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_RichText instance
|
||||
*
|
||||
* @param PHPExcel_Cell $pParent
|
||||
* @throws Exception
|
||||
* @param PHPExcel_Cell $pCell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct(PHPExcel_Cell $pCell = null)
|
||||
{
|
||||
// Initialise variables
|
||||
$this->_richTextElements = array();
|
||||
// Initialise variables
|
||||
$this->_richTextElements = array();
|
||||
|
||||
// Rich-Text string attached to cell?
|
||||
if ($pCell !== NULL) {
|
||||
// Add cell text and style
|
||||
if ($pCell->getValue() != "") {
|
||||
$objRun = new PHPExcel_RichText_Run($pCell->getValue());
|
||||
$objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
|
||||
$this->addText($objRun);
|
||||
}
|
||||
// Rich-Text string attached to cell?
|
||||
if ($pCell !== NULL) {
|
||||
// Add cell text and style
|
||||
if ($pCell->getValue() != "") {
|
||||
$objRun = new PHPExcel_RichText_Run($pCell->getValue());
|
||||
$objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
|
||||
$this->addText($objRun);
|
||||
}
|
||||
|
||||
// Set parent value
|
||||
$pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
}
|
||||
// Set parent value
|
||||
$pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add text
|
||||
*
|
||||
* @param PHPExcel_RichText_ITextElement $pText Rich text element
|
||||
* @throws Exception
|
||||
* @param PHPExcel_RichText_ITextElement $pText Rich text element
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_RichText
|
||||
*/
|
||||
public function addText(PHPExcel_RichText_ITextElement $pText = null)
|
||||
{
|
||||
$this->_richTextElements[] = $pText;
|
||||
return $this;
|
||||
$this->_richTextElements[] = $pText;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create text
|
||||
*
|
||||
* @param string $pText Text
|
||||
* @return PHPExcel_RichText_TextElement
|
||||
* @throws Exception
|
||||
* @param string $pText Text
|
||||
* @return PHPExcel_RichText_TextElement
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function createText($pText = '')
|
||||
{
|
||||
$objText = new PHPExcel_RichText_TextElement($pText);
|
||||
$this->addText($objText);
|
||||
return $objText;
|
||||
$objText = new PHPExcel_RichText_TextElement($pText);
|
||||
$this->addText($objText);
|
||||
return $objText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create text run
|
||||
*
|
||||
* @param string $pText Text
|
||||
* @return PHPExcel_RichText_Run
|
||||
* @throws Exception
|
||||
* @param string $pText Text
|
||||
* @return PHPExcel_RichText_Run
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function createTextRun($pText = '')
|
||||
{
|
||||
$objText = new PHPExcel_RichText_Run($pText);
|
||||
$this->addText($objText);
|
||||
return $objText;
|
||||
$objText = new PHPExcel_RichText_Run($pText);
|
||||
$this->addText($objText);
|
||||
return $objText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -115,16 +115,16 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||
*/
|
||||
public function getPlainText()
|
||||
{
|
||||
// Return value
|
||||
$returnValue = '';
|
||||
// Return value
|
||||
$returnValue = '';
|
||||
|
||||
// Loop through all PHPExcel_RichText_ITextElement
|
||||
foreach ($this->_richTextElements as $text) {
|
||||
$returnValue .= $text->getText();
|
||||
}
|
||||
// Loop through all PHPExcel_RichText_ITextElement
|
||||
foreach ($this->_richTextElements as $text) {
|
||||
$returnValue .= $text->getText();
|
||||
}
|
||||
|
||||
// Return
|
||||
return $returnValue;
|
||||
// Return
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -132,8 +132,9 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->getPlainText();
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getPlainText();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -143,54 +144,56 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||
*/
|
||||
public function getRichTextElements()
|
||||
{
|
||||
return $this->_richTextElements;
|
||||
return $this->_richTextElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rich Text elements
|
||||
*
|
||||
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
|
||||
* @throws Exception
|
||||
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_RichText
|
||||
*/
|
||||
public function setRichTextElements($pElements = null)
|
||||
{
|
||||
if (is_array($pElements)) {
|
||||
$this->_richTextElements = $pElements;
|
||||
} else {
|
||||
throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
|
||||
}
|
||||
return $this;
|
||||
if (is_array($pElements)) {
|
||||
$this->_richTextElements = $pElements;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
$hashElements = '';
|
||||
foreach ($this->_richTextElements as $element) {
|
||||
$hashElements .= $element->getHashCode();
|
||||
}
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
$hashElements = '';
|
||||
foreach ($this->_richTextElements as $element) {
|
||||
$hashElements .= $element->getHashCode();
|
||||
}
|
||||
|
||||
return md5(
|
||||
$hashElements
|
||||
. __CLASS__
|
||||
);
|
||||
return md5(
|
||||
$hashElements
|
||||
. __CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP
|
|||
* Set font
|
||||
*
|
||||
* @param PHPExcel_Style_Font $pFont Font
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_RichText_ITextElement
|
||||
*/
|
||||
public function setFont(PHPExcel_Style_Font $pFont = null) {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,313 +20,368 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Settings
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
class PHPExcel_Settings
|
||||
{
|
||||
/** constants */
|
||||
/** Available Zip library classes */
|
||||
const PCLZIP = 'PHPExcel_Shared_ZipArchive';
|
||||
const ZIPARCHIVE = 'ZipArchive';
|
||||
/** constants */
|
||||
/** Available Zip library classes */
|
||||
const PCLZIP = 'PHPExcel_Shared_ZipArchive';
|
||||
const ZIPARCHIVE = 'ZipArchive';
|
||||
|
||||
/** Optional Chart Rendering libraries */
|
||||
const CHART_RENDERER_JPGRAPH = 'jpgraph';
|
||||
/** Optional Chart Rendering libraries */
|
||||
const CHART_RENDERER_JPGRAPH = 'jpgraph';
|
||||
|
||||
/** Optional PDF Rendering libraries */
|
||||
/** Optional PDF Rendering libraries */
|
||||
const PDF_RENDERER_TCPDF = 'tcPDF';
|
||||
const PDF_RENDERER_DOMPDF = 'DomPDF';
|
||||
const PDF_RENDERER_MPDF = 'mPDF';
|
||||
const PDF_RENDERER_MPDF = 'mPDF';
|
||||
|
||||
|
||||
private static $_chartRenderers = array(
|
||||
self::CHART_RENDERER_JPGRAPH,
|
||||
);
|
||||
private static $_chartRenderers = array(
|
||||
self::CHART_RENDERER_JPGRAPH,
|
||||
);
|
||||
|
||||
private static $_pdfRenderers = array(
|
||||
self::PDF_RENDERER_TCPDF,
|
||||
self::PDF_RENDERER_DOMPDF,
|
||||
self::PDF_RENDERER_MPDF,
|
||||
);
|
||||
private static $_pdfRenderers = array(
|
||||
self::PDF_RENDERER_TCPDF,
|
||||
self::PDF_RENDERER_DOMPDF,
|
||||
self::PDF_RENDERER_MPDF,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Name of the class used for Zip file management
|
||||
* e.g.
|
||||
* ZipArchive
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_zipClass = self::ZIPARCHIVE;
|
||||
/**
|
||||
* Name of the class used for Zip file management
|
||||
* e.g.
|
||||
* ZipArchive
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_zipClass = self::ZIPARCHIVE;
|
||||
|
||||
|
||||
/**
|
||||
* Name of the external Library used for rendering charts
|
||||
* e.g.
|
||||
* jpgraph
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_chartRendererName = NULL;
|
||||
/**
|
||||
* Name of the external Library used for rendering charts
|
||||
* e.g.
|
||||
* jpgraph
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_chartRendererName = NULL;
|
||||
|
||||
/**
|
||||
* Directory Path to the external Library used for rendering charts
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_chartRendererPath = NULL;
|
||||
/**
|
||||
* Directory Path to the external Library used for rendering charts
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_chartRendererPath = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Name of the external Library used for rendering PDF files
|
||||
* e.g.
|
||||
* mPDF
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_pdfRendererName = NULL;
|
||||
/**
|
||||
* Name of the external Library used for rendering PDF files
|
||||
* e.g.
|
||||
* mPDF
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_pdfRendererName = NULL;
|
||||
|
||||
/**
|
||||
* Directory Path to the external Library used for rendering PDF files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_pdfRendererPath = NULL;
|
||||
/**
|
||||
* Directory Path to the external Library used for rendering PDF files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_pdfRendererPath = NULL;
|
||||
|
||||
/**
|
||||
* Default options for libxml loader
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private static $_libXmlLoaderOptions = null;
|
||||
|
||||
/**
|
||||
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
|
||||
*
|
||||
* @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management
|
||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setZipClass($zipClass)
|
||||
{
|
||||
if (($zipClass === self::PCLZIP) ||
|
||||
($zipClass === self::ZIPARCHIVE)) {
|
||||
self::$_zipClass = $zipClass;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
} // function setZipClass()
|
||||
|
||||
|
||||
/**
|
||||
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
|
||||
*
|
||||
* @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management
|
||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setZipClass($zipClass) {
|
||||
if (($zipClass === self::PCLZIP) ||
|
||||
($zipClass === self::ZIPARCHIVE)) {
|
||||
self::$_zipClass = $zipClass;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
} // function setZipClass()
|
||||
/**
|
||||
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
|
||||
* or Zip file management
|
||||
*
|
||||
* @return string Name of the Zip handler Class that PHPExcel is configured to use
|
||||
* for Zip file management
|
||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
*/
|
||||
public static function getZipClass()
|
||||
{
|
||||
return self::$_zipClass;
|
||||
} // function getZipClass()
|
||||
|
||||
|
||||
/**
|
||||
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
|
||||
* for Zip file management
|
||||
*
|
||||
* @return string Name of the Zip handler Class that PHPExcel is configured to use
|
||||
* for Zip file management
|
||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
*/
|
||||
public static function getZipClass() {
|
||||
return self::$_zipClass;
|
||||
} // function getZipClass()
|
||||
/**
|
||||
* Return the name of the method that is currently configured for cell cacheing
|
||||
*
|
||||
* @return string Name of the cacheing method
|
||||
*/
|
||||
public static function getCacheStorageMethod()
|
||||
{
|
||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
|
||||
} // function getCacheStorageMethod()
|
||||
|
||||
|
||||
/**
|
||||
* Return the name of the method that is currently configured for cell cacheing
|
||||
*
|
||||
* @return string Name of the cacheing method
|
||||
*/
|
||||
public static function getCacheStorageMethod() {
|
||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
|
||||
} // function getCacheStorageMethod()
|
||||
/**
|
||||
* Return the name of the class that is currently being used for cell cacheing
|
||||
*
|
||||
* @return string Name of the class currently being used for cacheing
|
||||
*/
|
||||
public static function getCacheStorageClass()
|
||||
{
|
||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
|
||||
} // function getCacheStorageClass()
|
||||
|
||||
|
||||
/**
|
||||
* Return the name of the class that is currently being used for cell cacheing
|
||||
*
|
||||
* @return string Name of the class currently being used for cacheing
|
||||
*/
|
||||
public static function getCacheStorageClass() {
|
||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
|
||||
} // function getCacheStorageClass()
|
||||
/**
|
||||
* Set the method that should be used for cell cacheing
|
||||
*
|
||||
* @param string $method Name of the cacheing method
|
||||
* @param array $arguments Optional configuration arguments for the cacheing method
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setCacheStorageMethod(
|
||||
$method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
|
||||
$arguments = array()
|
||||
)
|
||||
{
|
||||
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
|
||||
} // function setCacheStorageMethod()
|
||||
|
||||
|
||||
/**
|
||||
* Set the method that should be used for cell cacheing
|
||||
*
|
||||
* @param string $method Name of the cacheing method
|
||||
* @param array $arguments Optional configuration arguments for the cacheing method
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
|
||||
$arguments = array()) {
|
||||
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
|
||||
} // function setCacheStorageMethod()
|
||||
/**
|
||||
* Set the locale code to use for formula translations and any special formatting
|
||||
*
|
||||
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setLocale($locale='en_us')
|
||||
{
|
||||
return PHPExcel_Calculation::getInstance()->setLocale($locale);
|
||||
} // function setLocale()
|
||||
|
||||
|
||||
/**
|
||||
* Set the locale code to use for formula translations and any special formatting
|
||||
*
|
||||
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setLocale($locale='en_us') {
|
||||
return PHPExcel_Calculation::getInstance()->setLocale($locale);
|
||||
} // function setLocale()
|
||||
/**
|
||||
* Set details of the external library that PHPExcel should use for rendering charts
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
*
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRenderer($libraryName, $libraryBaseDir)
|
||||
{
|
||||
if (!self::setChartRendererName($libraryName))
|
||||
return FALSE;
|
||||
return self::setChartRendererPath($libraryBaseDir);
|
||||
} // function setChartRenderer()
|
||||
|
||||
|
||||
/**
|
||||
* Set details of the external library that PHPExcel should use for rendering charts
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRenderer($libraryName, $libraryBaseDir) {
|
||||
if (!self::setChartRendererName($libraryName))
|
||||
return FALSE;
|
||||
return self::setChartRendererPath($libraryBaseDir);
|
||||
} // function setChartRenderer()
|
||||
/**
|
||||
* Identify to PHPExcel the external library to use for rendering charts
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
*
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRendererName($libraryName)
|
||||
{
|
||||
if (!in_array($libraryName,self::$_chartRenderers)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self::$_chartRendererName = $libraryName;
|
||||
|
||||
return TRUE;
|
||||
} // function setChartRendererName()
|
||||
|
||||
|
||||
/**
|
||||
* Identify to PHPExcel the external library to use for rendering charts
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRendererName($libraryName) {
|
||||
if (!in_array($libraryName,self::$_chartRenderers)) {
|
||||
return FALSE;
|
||||
}
|
||||
/**
|
||||
* Tell PHPExcel where to find the external library to use for rendering charts
|
||||
*
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRendererPath($libraryBaseDir)
|
||||
{
|
||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||
return FALSE;
|
||||
}
|
||||
self::$_chartRendererPath = $libraryBaseDir;
|
||||
|
||||
self::$_chartRendererName = $libraryName;
|
||||
|
||||
return TRUE;
|
||||
} // function setChartRendererName()
|
||||
return TRUE;
|
||||
} // function setChartRendererPath()
|
||||
|
||||
|
||||
/**
|
||||
* Tell PHPExcel where to find the external library to use for rendering charts
|
||||
*
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setChartRendererPath($libraryBaseDir) {
|
||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||
return FALSE;
|
||||
}
|
||||
self::$_chartRendererPath = $libraryBaseDir;
|
||||
|
||||
return TRUE;
|
||||
} // function setChartRendererPath()
|
||||
/**
|
||||
* Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph)
|
||||
*
|
||||
* @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
*/
|
||||
public static function getChartRendererName()
|
||||
{
|
||||
return self::$_chartRendererName;
|
||||
} // function getChartRendererName()
|
||||
|
||||
|
||||
/**
|
||||
* Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph)
|
||||
*
|
||||
* @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||
*/
|
||||
public static function getChartRendererName() {
|
||||
return self::$_chartRendererName;
|
||||
} // function getChartRendererName()
|
||||
/**
|
||||
* Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use
|
||||
*
|
||||
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
*/
|
||||
public static function getChartRendererPath()
|
||||
{
|
||||
return self::$_chartRendererPath;
|
||||
} // function getChartRendererPath()
|
||||
|
||||
|
||||
/**
|
||||
* Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use
|
||||
*
|
||||
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
*/
|
||||
public static function getChartRendererPath() {
|
||||
return self::$_chartRendererPath;
|
||||
} // function getChartRendererPath()
|
||||
/**
|
||||
* Set details of the external library that PHPExcel should use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
*
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRenderer($libraryName, $libraryBaseDir)
|
||||
{
|
||||
if (!self::setPdfRendererName($libraryName))
|
||||
return FALSE;
|
||||
return self::setPdfRendererPath($libraryBaseDir);
|
||||
} // function setPdfRenderer()
|
||||
|
||||
|
||||
/**
|
||||
* Set details of the external library that PHPExcel should use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRenderer($libraryName, $libraryBaseDir) {
|
||||
if (!self::setPdfRendererName($libraryName))
|
||||
return FALSE;
|
||||
return self::setPdfRendererPath($libraryBaseDir);
|
||||
} // function setPdfRenderer()
|
||||
/**
|
||||
* Identify to PHPExcel the external library to use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
*
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRendererName($libraryName)
|
||||
{
|
||||
if (!in_array($libraryName,self::$_pdfRenderers)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self::$_pdfRendererName = $libraryName;
|
||||
|
||||
return TRUE;
|
||||
} // function setPdfRendererName()
|
||||
|
||||
|
||||
/**
|
||||
* Identify to PHPExcel the external library to use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRendererName($libraryName) {
|
||||
if (!in_array($libraryName,self::$_pdfRenderers)) {
|
||||
return FALSE;
|
||||
}
|
||||
/**
|
||||
* Tell PHPExcel where to find the external library to use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRendererPath($libraryBaseDir)
|
||||
{
|
||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||
return FALSE;
|
||||
}
|
||||
self::$_pdfRendererPath = $libraryBaseDir;
|
||||
|
||||
self::$_pdfRendererName = $libraryName;
|
||||
|
||||
return TRUE;
|
||||
} // function setPdfRendererName()
|
||||
return TRUE;
|
||||
} // function setPdfRendererPath()
|
||||
|
||||
|
||||
/**
|
||||
* Tell PHPExcel where to find the external library to use for rendering PDF files
|
||||
*
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setPdfRendererPath($libraryBaseDir) {
|
||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||
return FALSE;
|
||||
}
|
||||
self::$_pdfRendererPath = $libraryBaseDir;
|
||||
/**
|
||||
* Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf)
|
||||
*
|
||||
* @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
*/
|
||||
public static function getPdfRendererName()
|
||||
{
|
||||
return self::$_pdfRendererName;
|
||||
} // function getPdfRendererName()
|
||||
|
||||
return TRUE;
|
||||
} // function setPdfRendererPath()
|
||||
/**
|
||||
* Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use
|
||||
*
|
||||
* @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
*/
|
||||
public static function getPdfRendererPath()
|
||||
{
|
||||
return self::$_pdfRendererPath;
|
||||
} // function getPdfRendererPath()
|
||||
|
||||
/**
|
||||
* Set default options for libxml loader
|
||||
*
|
||||
* @param int $options Default options for libxml loader
|
||||
*/
|
||||
public static function setLibXmlLoaderOptions($options = null)
|
||||
{
|
||||
if (is_null($options)) {
|
||||
$options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
|
||||
}
|
||||
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||
self::$_libXmlLoaderOptions = $options;
|
||||
} // function setLibXmlLoaderOptions
|
||||
|
||||
/**
|
||||
* Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf)
|
||||
*
|
||||
* @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||
*/
|
||||
public static function getPdfRendererName() {
|
||||
return self::$_pdfRendererName;
|
||||
} // function getPdfRendererName()
|
||||
|
||||
|
||||
/**
|
||||
* Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use
|
||||
*
|
||||
* @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
|
||||
* currently configured to use
|
||||
*/
|
||||
public static function getPdfRendererPath() {
|
||||
return self::$_pdfRendererPath;
|
||||
} // function getPdfRendererPath()
|
||||
|
||||
}
|
||||
/**
|
||||
* Get default options for libxml loader.
|
||||
* Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
|
||||
*
|
||||
* @return int Default options for libxml loader
|
||||
*/
|
||||
public static function getLibXmlLoaderOptions()
|
||||
{
|
||||
if (is_null(self::$_libXmlLoaderOptions)) {
|
||||
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
|
||||
}
|
||||
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||
return self::$_libXmlLoaderOptions;
|
||||
} // function getLibXmlLoaderOptions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_CodePage
|
||||
{
|
||||
|
|
@ -39,16 +39,16 @@ class PHPExcel_Shared_CodePage
|
|||
* Convert Microsoft Code Page Identifier to Code Page Name which iconv
|
||||
* and mbstring understands
|
||||
*
|
||||
* @param int $number Microsoft Code Page Indentifier
|
||||
* @param integer $codePage Microsoft Code Page Indentifier
|
||||
* @return string Code Page Name
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public static function NumberToName($codePage = '1252')
|
||||
public static function NumberToName($codePage = 1252)
|
||||
{
|
||||
switch ($codePage) {
|
||||
case 367: return 'ASCII'; break; // ASCII
|
||||
case 437: return 'CP437'; break; // OEM US
|
||||
case 720: throw new Exception('Code page 720 not supported.');
|
||||
case 720: throw new PHPExcel_Exception('Code page 720 not supported.');
|
||||
break; // OEM Arabic
|
||||
case 737: return 'CP737'; break; // OEM Greek
|
||||
case 775: return 'CP775'; break; // OEM Baltic
|
||||
|
|
@ -85,17 +85,18 @@ class PHPExcel_Shared_CodePage
|
|||
case 10000: return 'MAC'; break; // Apple Roman
|
||||
case 10006: return 'MACGREEK'; break; // Macintosh Greek
|
||||
case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic
|
||||
case 10008: return 'CP936'; break; // Macintosh - Simplified Chinese (GB 2312)
|
||||
case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe
|
||||
case 10079: return 'MACICELAND'; break; // Macintosh Icelandic
|
||||
case 10081: return 'MACTURKISH'; break; // Macintosh Turkish
|
||||
case 32768: return 'MAC'; break; // Apple Roman
|
||||
case 32769: throw new Exception('Code page 32769 not supported.');
|
||||
case 32769: throw new PHPExcel_Exception('Code page 32769 not supported.');
|
||||
break; // ANSI Latin I (BIFF2-BIFF3)
|
||||
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
||||
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
||||
}
|
||||
|
||||
throw new Exception('Unknown codepage: ' . $codePage);
|
||||
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -21,9 +21,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Date
|
||||
{
|
||||
|
|
@ -58,36 +58,40 @@ class PHPExcel_Shared_Date
|
|||
'Sep' => 'September',
|
||||
'Oct' => 'October',
|
||||
'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
|
||||
*
|
||||
* @private
|
||||
* @var int
|
||||
*/
|
||||
private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||
|
||||
/*
|
||||
* Object type for PHP Date/Time values
|
||||
*
|
||||
* @private
|
||||
* @var string
|
||||
*/
|
||||
public static $dateTimeObjectType = 'DateTime';
|
||||
|
||||
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||
|
||||
/**
|
||||
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
||||
*
|
||||
* @param integer $baseDate Excel base date
|
||||
* @param integer $baseDate Excel base date (1900 or 1904)
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setExcelCalendar($baseDate) {
|
||||
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
||||
($baseDate == self::CALENDAR_MAC_1904)) {
|
||||
self::$ExcelBaseDate = $baseDate;
|
||||
self::$_excelBaseDate = $baseDate;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -97,33 +101,36 @@ class PHPExcel_Shared_Date
|
|||
/**
|
||||
* Return the Excel calendar (Windows 1900 or Mac 1904)
|
||||
*
|
||||
* @return integer $baseDate Excel base date
|
||||
* @return integer Excel base date (1900 or 1904)
|
||||
*/
|
||||
public static function getExcelCalendar() {
|
||||
return self::$ExcelBaseDate;
|
||||
return self::$_excelBaseDate;
|
||||
} // function getExcelCalendar()
|
||||
|
||||
|
||||
/**
|
||||
* Convert a date from Excel to PHP
|
||||
* Convert a date from Excel to PHP
|
||||
*
|
||||
* @param long $dateValue Excel date/time value
|
||||
* @return long PHP serialized date/time
|
||||
* @param long $dateValue Excel date/time value
|
||||
* @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as
|
||||
* a UST timestamp, or adjusted to UST
|
||||
* @param string $timezone The timezone for finding the adjustment from UST
|
||||
* @return long PHP serialized date/time
|
||||
*/
|
||||
public static function ExcelToPHP($dateValue = 0) {
|
||||
if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||
$myExcelBaseDate = 25569;
|
||||
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||
$my_excelBaseDate = 25569;
|
||||
// Adjust for the spurious 29-Feb-1900 (Day 60)
|
||||
if ($dateValue < 60) {
|
||||
--$myExcelBaseDate;
|
||||
--$my_excelBaseDate;
|
||||
}
|
||||
} else {
|
||||
$myExcelBaseDate = 24107;
|
||||
$my_excelBaseDate = 24107;
|
||||
}
|
||||
|
||||
// Perform conversion
|
||||
if ($dateValue >= 1) {
|
||||
$utcDays = $dateValue - $myExcelBaseDate;
|
||||
$utcDays = $dateValue - $my_excelBaseDate;
|
||||
$returnValue = round($utcDays * 86400);
|
||||
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
||||
$returnValue = (integer) $returnValue;
|
||||
|
|
@ -135,16 +142,20 @@ class PHPExcel_Shared_Date
|
|||
$returnValue = (integer) gmmktime($hours, $mins, $secs);
|
||||
}
|
||||
|
||||
$timezoneAdjustment = ($adjustToTimezone) ?
|
||||
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
|
||||
0;
|
||||
|
||||
// Return
|
||||
return $returnValue;
|
||||
return $returnValue + $timezoneAdjustment;
|
||||
} // function ExcelToPHP()
|
||||
|
||||
|
||||
/**
|
||||
* Convert a date from Excel to a PHP Date/Time object
|
||||
*
|
||||
* @param long $dateValue Excel date/time value
|
||||
* @return long PHP date/time object
|
||||
* @param integer $dateValue Excel date/time value
|
||||
* @return integer PHP date/time object
|
||||
*/
|
||||
public static function ExcelToPHPObject($dateValue = 0) {
|
||||
$dateTime = self::ExcelToPHP($dateValue);
|
||||
|
|
@ -162,17 +173,20 @@ class PHPExcel_Shared_Date
|
|||
|
||||
|
||||
/**
|
||||
* Convert a date from PHP to Excel
|
||||
* Convert a date from PHP to Excel
|
||||
*
|
||||
* @param mixed $dateValue PHP serialized date/time or date object
|
||||
* @return mixed Excel date/time value
|
||||
* or boolean FALSE on failure
|
||||
* @param mixed $dateValue PHP serialized date/time or date object
|
||||
* @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as
|
||||
* a UST timestamp, or adjusted to UST
|
||||
* @param string $timezone The timezone for finding the adjustment from UST
|
||||
* @return mixed Excel date/time value
|
||||
* or boolean FALSE on failure
|
||||
*/
|
||||
public static function PHPToExcel($dateValue = 0) {
|
||||
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||
$saveTimeZone = date_default_timezone_get();
|
||||
date_default_timezone_set('UTC');
|
||||
$retValue = FALSE;
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof self::$dateTimeObjectType)) {
|
||||
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||
);
|
||||
|
|
@ -199,16 +213,16 @@ class PHPExcel_Shared_Date
|
|||
* @return long Excel date/time value
|
||||
*/
|
||||
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
|
||||
if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||
//
|
||||
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
|
||||
// This affects every date following 28th February 1900
|
||||
//
|
||||
$excel1900isLeapYear = TRUE;
|
||||
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
|
||||
$myExcelBaseDate = 2415020;
|
||||
$my_excelBaseDate = 2415020;
|
||||
} else {
|
||||
$myExcelBaseDate = 2416481;
|
||||
$my_excelBaseDate = 2416481;
|
||||
$excel1900isLeapYear = FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +237,7 @@ class PHPExcel_Shared_Date
|
|||
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
||||
$century = substr($year,0,2);
|
||||
$decade = substr($year,2,2);
|
||||
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myExcelBaseDate + $excel1900isLeapYear;
|
||||
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear;
|
||||
|
||||
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
||||
|
||||
|
|
@ -239,7 +253,7 @@ class PHPExcel_Shared_Date
|
|||
*/
|
||||
public static function isDateTime(PHPExcel_Cell $pCell) {
|
||||
return self::isDateTimeFormat(
|
||||
$pCell->getParent()->getStyle(
|
||||
$pCell->getWorksheet()->getStyle(
|
||||
$pCell->getCoordinate()
|
||||
)->getNumberFormat()
|
||||
);
|
||||
|
|
@ -266,11 +280,14 @@ class PHPExcel_Shared_Date
|
|||
* @return boolean
|
||||
*/
|
||||
public static function isDateTimeFormatCode($pFormatCode = '') {
|
||||
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
|
||||
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
|
||||
return FALSE;
|
||||
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
|
||||
// Scientific format
|
||||
return FALSE;
|
||||
// Switch on formatcode
|
||||
switch ($pFormatCode) {
|
||||
// General contains an epoch letter 'e', so we trap for it explicitly here
|
||||
case PHPExcel_Style_NumberFormat::FORMAT_GENERAL:
|
||||
return FALSE;
|
||||
// Explicitly defined date formats
|
||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:
|
||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2:
|
||||
|
|
@ -306,10 +323,11 @@ class PHPExcel_Shared_Date
|
|||
// We might also have a format mask containing quoted strings...
|
||||
// we don't want to test for any of our characters within the quoted blocks
|
||||
if (strpos($pFormatCode,'"') !== FALSE) {
|
||||
$i = FALSE;
|
||||
$segMatcher = FALSE;
|
||||
foreach(explode('"',$pFormatCode) as $subVal) {
|
||||
// Only test in alternate array entries (the non-quoted blocks)
|
||||
if (($i = !$i) && (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
||||
if (($segMatcher = !$segMatcher) &&
|
||||
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -353,4 +371,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Drawing
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Excel5
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ class PHPExcel_Shared_Excel5
|
|||
* This holds for Arial 10
|
||||
*
|
||||
* @param PHPExcel_Worksheet $sheet The sheet
|
||||
* @param integer $col The column
|
||||
* @param string $col The column
|
||||
* @return integer The width in pixels
|
||||
*/
|
||||
public static function sizeCol($sheet, $col = 'A')
|
||||
|
|
@ -136,9 +136,9 @@ class PHPExcel_Shared_Excel5
|
|||
*
|
||||
* @param PHPExcel_Worksheet $sheet
|
||||
* @param string $startColumn
|
||||
* @param integer $startOffset Offset within start cell measured in 1/1024 of the cell width
|
||||
* @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
|
||||
* @param string $endColumn
|
||||
* @param integer $endOffset Offset within end cell measured in 1/1024 of the cell width
|
||||
* @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
|
||||
* @return integer Horizontal measured in pixels
|
||||
*/
|
||||
public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
|
||||
|
|
@ -166,10 +166,10 @@ class PHPExcel_Shared_Excel5
|
|||
* The distanceY is found as sum of all the spanning rows minus two offsets
|
||||
*
|
||||
* @param PHPExcel_Worksheet $sheet
|
||||
* @param string $startRow (1-based)
|
||||
* @param integer $startOffset Offset within start cell measured in 1/256 of the cell height
|
||||
* @param string $endRow (1-based)
|
||||
* @param integer $endOffset Offset within end cell measured in 1/256 of the cell height
|
||||
* @param integer $startRow (1-based)
|
||||
* @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
|
||||
* @param integer $endRow (1-based)
|
||||
* @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
|
||||
* @return integer Vertical distance measured in pixels
|
||||
*/
|
||||
public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,10 +31,39 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_File
|
||||
{
|
||||
/*
|
||||
* Use Temp or File Upload Temp for temporary files
|
||||
*
|
||||
* @protected
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $_useUploadTempDirectory = FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* Set the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||
*
|
||||
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
||||
*/
|
||||
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
|
||||
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
||||
} // function setUseUploadTempDirectory()
|
||||
|
||||
|
||||
/**
|
||||
* Get the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||
*
|
||||
* @return boolean Use File Upload Temporary directory (true or false)
|
||||
*/
|
||||
public static function getUseUploadTempDirectory() {
|
||||
return self::$_useUploadTempDirectory;
|
||||
} // function getUseUploadTempDirectory()
|
||||
|
||||
|
||||
/**
|
||||
* Verify if a file exists
|
||||
*
|
||||
|
|
@ -105,9 +134,19 @@ class PHPExcel_Shared_File
|
|||
*/
|
||||
public static function sys_get_temp_dir()
|
||||
{
|
||||
if (self::$_useUploadTempDirectory) {
|
||||
// use upload-directory when defined to allow running on environments having very restricted
|
||||
// open_basedir configs
|
||||
if (ini_get('upload_tmp_dir') !== FALSE) {
|
||||
if ($temp = ini_get('upload_tmp_dir')) {
|
||||
if (file_exists($temp))
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||
|
||||
if ( !function_exists('sys_get_temp_dir')) {
|
||||
if ($temp = getenv('TMP') ) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.8, 2012-10-12
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Font
|
||||
{
|
||||
|
|
@ -244,11 +244,11 @@ class PHPExcel_Shared_Font
|
|||
/**
|
||||
* Calculate an (approximate) OpenXML column width, based on font size and text contained
|
||||
*
|
||||
* @param int $fontSize Font size (in pixels or points)
|
||||
* @param bool $fontSizeInPixels Is the font size specified in pixels (true) or in points (false) ?
|
||||
* @param string $cellText Text to calculate width
|
||||
* @param int $rotation Rotation angle
|
||||
* @return int Column width
|
||||
* @param PHPExcel_Style_Font $font Font object
|
||||
* @param PHPExcel_RichText|string $cellText Text to calculate width
|
||||
* @param integer $rotation Rotation angle
|
||||
* @param PHPExcel_Style_Font|NULL $defaultFont Font object
|
||||
* @return integer Column width
|
||||
*/
|
||||
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ class PHPExcel_Shared_Font
|
|||
try {
|
||||
// If autosize method is set to 'approx', use approximation
|
||||
if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) {
|
||||
throw new Exception('AutoSize method is set to approx');
|
||||
throw new PHPExcel_Exception('AutoSize method is set to approx');
|
||||
}
|
||||
|
||||
// Width of text in pixels excl. padding
|
||||
|
|
@ -280,7 +280,7 @@ class PHPExcel_Shared_Font
|
|||
// Excel adds some padding, use 1.07 of the width of an 'n' glyph
|
||||
$columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding
|
||||
|
||||
} catch (Exception $e) {
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
// Width of text in pixels excl. padding, approximation
|
||||
$columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation);
|
||||
|
||||
|
|
@ -302,11 +302,11 @@ class PHPExcel_Shared_Font
|
|||
* @param PHPExcel_Style_Font
|
||||
* @param int $rotation
|
||||
* @return int
|
||||
* @throws Exception
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
|
||||
if (!function_exists('imagettfbbox')) {
|
||||
throw new Exception('GD library needs to be enabled');
|
||||
throw new PHPExcel_Exception('GD library needs to be enabled');
|
||||
}
|
||||
|
||||
// font size should really be supplied in pixels in GD2,
|
||||
|
|
@ -425,7 +425,7 @@ class PHPExcel_Shared_Font
|
|||
*/
|
||||
public static function getTrueTypeFontFileFromFont($font) {
|
||||
if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
|
||||
throw new Exception('Valid directory to TrueType Font files not specified');
|
||||
throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified');
|
||||
}
|
||||
|
||||
$name = $font->getName();
|
||||
|
|
@ -530,7 +530,7 @@ class PHPExcel_Shared_Font
|
|||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
|
||||
throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -538,7 +538,7 @@ class PHPExcel_Shared_Font
|
|||
|
||||
// Check if file actually exists
|
||||
if (!file_exists($fontFile)) {
|
||||
throw New Exception('TrueType Font file not found');
|
||||
throw New PHPExcel_Exception('TrueType Font file not found');
|
||||
}
|
||||
|
||||
return $fontFile;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class CholeskyDecomposition {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(ArgumentTypeException));
|
||||
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
|
|
@ -136,13 +136,13 @@ class CholeskyDecomposition {
|
|||
|
||||
return new Matrix($X, $this->m, $nx);
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixSPDException));
|
||||
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException));
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixDimensionException));
|
||||
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException));
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(ArgumentTypeException));
|
||||
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||
}
|
||||
} // function solve()
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||
}
|
||||
return $d;
|
||||
} else {
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||
}
|
||||
} // function det()
|
||||
|
||||
|
|
@ -218,8 +218,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||
*
|
||||
* @param $B A Matrix with as many rows as A and any number of columns.
|
||||
* @return X so that L*U*X = B(piv,:)
|
||||
* @exception IllegalArgumentException Matrix row dimensions must agree.
|
||||
* @exception RuntimeException Matrix is singular.
|
||||
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
|
||||
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
|
||||
*/
|
||||
public function solve($B) {
|
||||
if ($B->getRowDimension() == $this->m) {
|
||||
|
|
@ -248,10 +248,10 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||
}
|
||||
return $X;
|
||||
} else {
|
||||
throw new Exception(self::MatrixSingularException);
|
||||
throw new PHPExcel_Calculation_Exception(self::MatrixSingularException);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(self::MatrixSquareException);
|
||||
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
|
||||
}
|
||||
} // function solve()
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user