正在显示
261 个修改的文件
包含
4939 行增加
和
0 行删除
Export_Excel.php
0 → 100644
| 1 | +<?php | ||
| 2 | + /** | ||
| 3 | + * 该文件为导出数据库内容为Excel文件 | ||
| 4 | + * 需要数据库phpexcel下的student表,请注意有数据! | ||
| 5 | + * 附加题:判断数据库为空或条件查询无内容时显示无数据,并停止导出流程 | ||
| 6 | + * Created by PhpStorm. | ||
| 7 | + * User: shu | ||
| 8 | + * Date: 2019-06-28 | ||
| 9 | + * Time: 23:48 | ||
| 10 | + */ | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + $link = mysqli_connect('127.0.0.1','root','root','phpexcel'); | ||
| 14 | + mysqli_set_charset($link,'utf8mb4'); | ||
| 15 | + | ||
| 16 | + include("./PHPExcel_Croe/PHPExcel.php"); | ||
| 17 | + | ||
| 18 | + $data = mysqli_fetch_all(mysqli_query($link,"SELECT * FROM student"),MYSQLI_ASSOC); | ||
| 19 | + //PHPExcel支持读模版 所以我还是比较喜欢先做好一个Excel的模版 比较好,不然要写很多代码 模版我放在根目录了 | ||
| 20 | + //创建一个读Excel模版的对象 | ||
| 21 | + $objReader = PHPExcel_IOFactory::createReader ( 'Excel2007' ); | ||
| 22 | + //读取模板文件 | ||
| 23 | + $objPHPExcel = $objReader->load ("template.xlsx" ); | ||
| 24 | + //获取当前活动的表 | ||
| 25 | + $objActSheet = $objPHPExcel->getActiveSheet (); | ||
| 26 | + //单独设置单元格信息 | ||
| 27 | + $objActSheet->setTitle ( '导出学生信息' ); | ||
| 28 | + $objActSheet->setCellValue ( 'A1', '学生信息导出' ); | ||
| 29 | + $objActSheet->setCellValue ( 'H3', '导出时间:' . date ( 'Y年m月d日 H:i:s' ) ); | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + //具体有多少列 看你的数据走 会涉及到计算 | ||
| 33 | + //现在就开始填充数据了 (从数据库中) $data | ||
| 34 | + $baseRow = 3; //数据从N-1行开始往下输出 这里是避免头信息被覆盖 | ||
| 35 | + foreach ( $data as $r => $dataRow ) { | ||
| 36 | + $row = $baseRow + $r; | ||
| 37 | + //将数据填充到相对应的位置 | ||
| 38 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, $dataRow ['id'] ); //学员编号 | ||
| 39 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, $dataRow ['sno'] ); //真实姓名 | ||
| 40 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, $dataRow ['name'] ); //真实姓名 | ||
| 41 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'D' . $row, $dataRow ['department'] ); //真实姓名 | ||
| 42 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'E' . $row, $dataRow ['major'] ); //真实姓名 | ||
| 43 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'F' . $row, $dataRow ['class'] ); //真实姓名 | ||
| 44 | + } | ||
| 45 | + //导出 | ||
| 46 | + $filename = '学生信息导出'.time (); | ||
| 47 | + header ( 'Content-Type: application/vnd.ms-excel' ); | ||
| 48 | + header ( 'Content-Disposition: attachment;filename="' . $filename . '.xls"' ); //"'.$filename.'.xls" | ||
| 49 | + header ( 'Cache-Control: max-age=0' ); | ||
| 50 | + $objWriter = PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' ); //在内存中准备一个excel2003文件 | ||
| 51 | + $objWriter->save ( 'php://output' ); | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + |
PHPExcel_Croe/PHPExcel.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Autoloader.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +PHPExcel_Autoloader::register(); | ||
| 4 | +// As we always try to run the autoloader before anything else, we can use it to do a few | ||
| 5 | +// simple checks and initialisations | ||
| 6 | +//PHPExcel_Shared_ZipStreamWrapper::register(); | ||
| 7 | +// check mbstring.func_overload | ||
| 8 | +if (ini_get('mbstring.func_overload') & 2) { | ||
| 9 | + throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); | ||
| 10 | +} | ||
| 11 | +PHPExcel_Shared_String::buildCharacterSets(); | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * PHPExcel | ||
| 15 | + * | ||
| 16 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 17 | + * | ||
| 18 | + * This library is free software; you can redistribute it and/or | ||
| 19 | + * modify it under the terms of the GNU Lesser General Public | ||
| 20 | + * License as published by the Free Software Foundation; either | ||
| 21 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 22 | + * | ||
| 23 | + * This library is distributed in the hope that it will be useful, | ||
| 24 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 25 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 26 | + * Lesser General Public License for more details. | ||
| 27 | + * | ||
| 28 | + * You should have received a copy of the GNU Lesser General Public | ||
| 29 | + * License along with this library; if not, write to the Free Software | ||
| 30 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 31 | + * | ||
| 32 | + * @category PHPExcel | ||
| 33 | + * @package PHPExcel | ||
| 34 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 35 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 36 | + * @version ##VERSION##, ##DATE## | ||
| 37 | + */ | ||
| 38 | +class PHPExcel_Autoloader | ||
| 39 | +{ | ||
| 40 | + /** | ||
| 41 | + * Register the Autoloader with SPL | ||
| 42 | + * | ||
| 43 | + */ | ||
| 44 | + public static function register() | ||
| 45 | + { | ||
| 46 | + if (function_exists('__autoload')) { | ||
| 47 | + // Register any existing autoloader function with SPL, so we don't get any clashes | ||
| 48 | + spl_autoload_register('__autoload'); | ||
| 49 | + } | ||
| 50 | + // Register ourselves with SPL | ||
| 51 | + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { | ||
| 52 | + return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true); | ||
| 53 | + } else { | ||
| 54 | + return spl_autoload_register(array('PHPExcel_Autoloader', 'load')); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Autoload a class identified by name | ||
| 60 | + * | ||
| 61 | + * @param string $pClassName Name of the object to load | ||
| 62 | + */ | ||
| 63 | + public static function load($pClassName) | ||
| 64 | + { | ||
| 65 | + if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) { | ||
| 66 | + // Either already loaded, or not a PHPExcel class request | ||
| 67 | + return false; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + $pClassFilePath = PHPEXCEL_ROOT . | ||
| 71 | + str_replace('_', DIRECTORY_SEPARATOR, $pClassName) . | ||
| 72 | + '.php'; | ||
| 73 | + | ||
| 74 | + if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) { | ||
| 75 | + // Can't load | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + require($pClassFilePath); | ||
| 80 | + } | ||
| 81 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_APC | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Prefix used to uniquely identify cache data for this worksheet | ||
| 32 | + * | ||
| 33 | + * @access private | ||
| 34 | + * @var string | ||
| 35 | + */ | ||
| 36 | + private $cachePrefix = null; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Cache timeout | ||
| 40 | + * | ||
| 41 | + * @access private | ||
| 42 | + * @var integer | ||
| 43 | + */ | ||
| 44 | + private $cacheTime = 600; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 48 | + * and the 'nullify' the current cell object | ||
| 49 | + * | ||
| 50 | + * @access private | ||
| 51 | + * @return void | ||
| 52 | + * @throws PHPExcel_Exception | ||
| 53 | + */ | ||
| 54 | + protected function storeData() | ||
| 55 | + { | ||
| 56 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 57 | + $this->currentObject->detach(); | ||
| 58 | + | ||
| 59 | + if (!apc_store( | ||
| 60 | + $this->cachePrefix . $this->currentObjectID . '.cache', | ||
| 61 | + serialize($this->currentObject), | ||
| 62 | + $this->cacheTime | ||
| 63 | + )) { | ||
| 64 | + $this->__destruct(); | ||
| 65 | + throw new PHPExcel_Exception('Failed to store cell ' . $this->currentObjectID . ' in APC'); | ||
| 66 | + } | ||
| 67 | + $this->currentCellIsDirty = false; | ||
| 68 | + } | ||
| 69 | + $this->currentObjectID = $this->currentObject = null; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * Add or Update a cell in cache identified by coordinate address | ||
| 74 | + * | ||
| 75 | + * @access public | ||
| 76 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 77 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 78 | + * @return PHPExcel_Cell | ||
| 79 | + * @throws PHPExcel_Exception | ||
| 80 | + */ | ||
| 81 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 82 | + { | ||
| 83 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 84 | + $this->storeData(); | ||
| 85 | + } | ||
| 86 | + $this->cellCache[$pCoord] = true; | ||
| 87 | + | ||
| 88 | + $this->currentObjectID = $pCoord; | ||
| 89 | + $this->currentObject = $cell; | ||
| 90 | + $this->currentCellIsDirty = true; | ||
| 91 | + | ||
| 92 | + return $cell; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||
| 97 | + * | ||
| 98 | + * @access public | ||
| 99 | + * @param string $pCoord Coordinate address of the cell to check | ||
| 100 | + * @throws PHPExcel_Exception | ||
| 101 | + * @return boolean | ||
| 102 | + */ | ||
| 103 | + public function isDataSet($pCoord) | ||
| 104 | + { | ||
| 105 | + // Check if the requested entry is the current object, or exists in the cache | ||
| 106 | + if (parent::isDataSet($pCoord)) { | ||
| 107 | + if ($this->currentObjectID == $pCoord) { | ||
| 108 | + return true; | ||
| 109 | + } | ||
| 110 | + // Check if the requested entry still exists in apc | ||
| 111 | + $success = apc_fetch($this->cachePrefix.$pCoord.'.cache'); | ||
| 112 | + if ($success === false) { | ||
| 113 | + // Entry no longer exists in APC, so clear it from the cache array | ||
| 114 | + parent::deleteCacheData($pCoord); | ||
| 115 | + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); | ||
| 116 | + } | ||
| 117 | + return true; | ||
| 118 | + } | ||
| 119 | + return false; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * Get cell at a specific coordinate | ||
| 124 | + * | ||
| 125 | + * @access public | ||
| 126 | + * @param string $pCoord Coordinate of the cell | ||
| 127 | + * @throws PHPExcel_Exception | ||
| 128 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 129 | + */ | ||
| 130 | + public function getCacheData($pCoord) | ||
| 131 | + { | ||
| 132 | + if ($pCoord === $this->currentObjectID) { | ||
| 133 | + return $this->currentObject; | ||
| 134 | + } | ||
| 135 | + $this->storeData(); | ||
| 136 | + | ||
| 137 | + // Check if the entry that has been requested actually exists | ||
| 138 | + if (parent::isDataSet($pCoord)) { | ||
| 139 | + $obj = apc_fetch($this->cachePrefix . $pCoord . '.cache'); | ||
| 140 | + if ($obj === false) { | ||
| 141 | + // Entry no longer exists in APC, so clear it from the cache array | ||
| 142 | + parent::deleteCacheData($pCoord); | ||
| 143 | + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); | ||
| 144 | + } | ||
| 145 | + } else { | ||
| 146 | + // Return null if requested entry doesn't exist in cache | ||
| 147 | + return null; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + // Set current entry to the requested entry | ||
| 151 | + $this->currentObjectID = $pCoord; | ||
| 152 | + $this->currentObject = unserialize($obj); | ||
| 153 | + // Re-attach this as the cell's parent | ||
| 154 | + $this->currentObject->attach($this); | ||
| 155 | + | ||
| 156 | + // Return requested entry | ||
| 157 | + return $this->currentObject; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * Get a list of all cell addresses currently held in cache | ||
| 162 | + * | ||
| 163 | + * @return string[] | ||
| 164 | + */ | ||
| 165 | + public function getCellList() | ||
| 166 | + { | ||
| 167 | + if ($this->currentObjectID !== null) { | ||
| 168 | + $this->storeData(); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + return parent::getCellList(); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * Delete a cell in cache identified by coordinate address | ||
| 176 | + * | ||
| 177 | + * @access public | ||
| 178 | + * @param string $pCoord Coordinate address of the cell to delete | ||
| 179 | + * @throws PHPExcel_Exception | ||
| 180 | + */ | ||
| 181 | + public function deleteCacheData($pCoord) | ||
| 182 | + { | ||
| 183 | + // Delete the entry from APC | ||
| 184 | + apc_delete($this->cachePrefix.$pCoord.'.cache'); | ||
| 185 | + | ||
| 186 | + // Delete the entry from our cell address array | ||
| 187 | + parent::deleteCacheData($pCoord); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * Clone the cell collection | ||
| 192 | + * | ||
| 193 | + * @access public | ||
| 194 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 195 | + * @throws PHPExcel_Exception | ||
| 196 | + * @return void | ||
| 197 | + */ | ||
| 198 | + public function copyCellCollection(PHPExcel_Worksheet $parent) | ||
| 199 | + { | ||
| 200 | + parent::copyCellCollection($parent); | ||
| 201 | + // Get a new id for the new file name | ||
| 202 | + $baseUnique = $this->getUniqueID(); | ||
| 203 | + $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||
| 204 | + $cacheList = $this->getCellList(); | ||
| 205 | + foreach ($cacheList as $cellID) { | ||
| 206 | + if ($cellID != $this->currentObjectID) { | ||
| 207 | + $obj = apc_fetch($this->cachePrefix . $cellID . '.cache'); | ||
| 208 | + if ($obj === false) { | ||
| 209 | + // Entry no longer exists in APC, so clear it from the cache array | ||
| 210 | + parent::deleteCacheData($cellID); | ||
| 211 | + throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC'); | ||
| 212 | + } | ||
| 213 | + if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) { | ||
| 214 | + $this->__destruct(); | ||
| 215 | + throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC'); | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + $this->cachePrefix = $newCachePrefix; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + /** | ||
| 223 | + * Clear the cell collection and disconnect from our parent | ||
| 224 | + * | ||
| 225 | + * @return void | ||
| 226 | + */ | ||
| 227 | + public function unsetWorksheetCells() | ||
| 228 | + { | ||
| 229 | + if ($this->currentObject !== null) { | ||
| 230 | + $this->currentObject->detach(); | ||
| 231 | + $this->currentObject = $this->currentObjectID = null; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + // Flush the APC cache | ||
| 235 | + $this->__destruct(); | ||
| 236 | + | ||
| 237 | + $this->cellCache = array(); | ||
| 238 | + | ||
| 239 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 240 | + $this->parent = null; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + /** | ||
| 244 | + * Initialise this new cell collection | ||
| 245 | + * | ||
| 246 | + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection | ||
| 247 | + * @param array of mixed $arguments Additional initialisation arguments | ||
| 248 | + */ | ||
| 249 | + public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||
| 250 | + { | ||
| 251 | + $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; | ||
| 252 | + | ||
| 253 | + if ($this->cachePrefix === null) { | ||
| 254 | + $baseUnique = $this->getUniqueID(); | ||
| 255 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||
| 256 | + $this->cacheTime = $cacheTime; | ||
| 257 | + | ||
| 258 | + parent::__construct($parent); | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + /** | ||
| 263 | + * Destroy this cell collection | ||
| 264 | + */ | ||
| 265 | + public function __destruct() | ||
| 266 | + { | ||
| 267 | + $cacheList = $this->getCellList(); | ||
| 268 | + foreach ($cacheList as $cellID) { | ||
| 269 | + apc_delete($this->cachePrefix . $cellID . '.cache'); | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /** | ||
| 274 | + * Identify whether the caching method is currently available | ||
| 275 | + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||
| 276 | + * | ||
| 277 | + * @return boolean | ||
| 278 | + */ | ||
| 279 | + public static function cacheMethodIsAvailable() | ||
| 280 | + { | ||
| 281 | + if (!function_exists('apc_store')) { | ||
| 282 | + return false; | ||
| 283 | + } | ||
| 284 | + if (apc_sma_info() === false) { | ||
| 285 | + return false; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + return true; | ||
| 289 | + } | ||
| 290 | +} |
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_DiscISAM | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Name of the file for this cache | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + private $fileName = null; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * File handle for this cache file | ||
| 39 | + * | ||
| 40 | + * @var resource | ||
| 41 | + */ | ||
| 42 | + private $fileHandle = null; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Directory/Folder where the cache file is located | ||
| 46 | + * | ||
| 47 | + * @var string | ||
| 48 | + */ | ||
| 49 | + private $cacheDirectory = null; | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 53 | + * and the 'nullify' the current cell object | ||
| 54 | + * | ||
| 55 | + * @return void | ||
| 56 | + * @throws PHPExcel_Exception | ||
| 57 | + */ | ||
| 58 | + protected function storeData() | ||
| 59 | + { | ||
| 60 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 61 | + $this->currentObject->detach(); | ||
| 62 | + | ||
| 63 | + fseek($this->fileHandle, 0, SEEK_END); | ||
| 64 | + | ||
| 65 | + $this->cellCache[$this->currentObjectID] = array( | ||
| 66 | + 'ptr' => ftell($this->fileHandle), | ||
| 67 | + 'sz' => fwrite($this->fileHandle, serialize($this->currentObject)) | ||
| 68 | + ); | ||
| 69 | + $this->currentCellIsDirty = false; | ||
| 70 | + } | ||
| 71 | + $this->currentObjectID = $this->currentObject = null; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * Add or Update a cell in cache identified by coordinate address | ||
| 76 | + * | ||
| 77 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 78 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 79 | + * @return PHPExcel_Cell | ||
| 80 | + * @throws PHPExcel_Exception | ||
| 81 | + */ | ||
| 82 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 83 | + { | ||
| 84 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 85 | + $this->storeData(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + $this->currentObjectID = $pCoord; | ||
| 89 | + $this->currentObject = $cell; | ||
| 90 | + $this->currentCellIsDirty = true; | ||
| 91 | + | ||
| 92 | + return $cell; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * Get cell at a specific coordinate | ||
| 97 | + * | ||
| 98 | + * @param string $pCoord Coordinate of the cell | ||
| 99 | + * @throws PHPExcel_Exception | ||
| 100 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 101 | + */ | ||
| 102 | + public function getCacheData($pCoord) | ||
| 103 | + { | ||
| 104 | + if ($pCoord === $this->currentObjectID) { | ||
| 105 | + return $this->currentObject; | ||
| 106 | + } | ||
| 107 | + $this->storeData(); | ||
| 108 | + | ||
| 109 | + // Check if the entry that has been requested actually exists | ||
| 110 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 111 | + // Return null if requested entry doesn't exist in cache | ||
| 112 | + return null; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + // Set current entry to the requested entry | ||
| 116 | + $this->currentObjectID = $pCoord; | ||
| 117 | + fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']); | ||
| 118 | + $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz'])); | ||
| 119 | + // Re-attach this as the cell's parent | ||
| 120 | + $this->currentObject->attach($this); | ||
| 121 | + | ||
| 122 | + // Return requested entry | ||
| 123 | + return $this->currentObject; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * Get a list of all cell addresses currently held in cache | ||
| 128 | + * | ||
| 129 | + * @return string[] | ||
| 130 | + */ | ||
| 131 | + public function getCellList() | ||
| 132 | + { | ||
| 133 | + if ($this->currentObjectID !== null) { | ||
| 134 | + $this->storeData(); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + return parent::getCellList(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * Clone the cell collection | ||
| 142 | + * | ||
| 143 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 144 | + */ | ||
| 145 | + public function copyCellCollection(PHPExcel_Worksheet $parent) | ||
| 146 | + { | ||
| 147 | + parent::copyCellCollection($parent); | ||
| 148 | + // Get a new id for the new file name | ||
| 149 | + $baseUnique = $this->getUniqueID(); | ||
| 150 | + $newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; | ||
| 151 | + // Copy the existing cell cache file | ||
| 152 | + copy($this->fileName, $newFileName); | ||
| 153 | + $this->fileName = $newFileName; | ||
| 154 | + // Open the copied cell cache file | ||
| 155 | + $this->fileHandle = fopen($this->fileName, 'a+'); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * Clear the cell collection and disconnect from our parent | ||
| 160 | + * | ||
| 161 | + */ | ||
| 162 | + public function unsetWorksheetCells() | ||
| 163 | + { | ||
| 164 | + if (!is_null($this->currentObject)) { | ||
| 165 | + $this->currentObject->detach(); | ||
| 166 | + $this->currentObject = $this->currentObjectID = null; | ||
| 167 | + } | ||
| 168 | + $this->cellCache = array(); | ||
| 169 | + | ||
| 170 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 171 | + $this->parent = null; | ||
| 172 | + | ||
| 173 | + // Close down the temporary cache file | ||
| 174 | + $this->__destruct(); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * Initialise this new cell collection | ||
| 179 | + * | ||
| 180 | + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection | ||
| 181 | + * @param array of mixed $arguments Additional initialisation arguments | ||
| 182 | + */ | ||
| 183 | + public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||
| 184 | + { | ||
| 185 | + $this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null)) | ||
| 186 | + ? $arguments['dir'] | ||
| 187 | + : PHPExcel_Shared_File::sys_get_temp_dir(); | ||
| 188 | + | ||
| 189 | + parent::__construct($parent); | ||
| 190 | + if (is_null($this->fileHandle)) { | ||
| 191 | + $baseUnique = $this->getUniqueID(); | ||
| 192 | + $this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; | ||
| 193 | + $this->fileHandle = fopen($this->fileName, 'a+'); | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + /** | ||
| 198 | + * Destroy this cell collection | ||
| 199 | + */ | ||
| 200 | + public function __destruct() | ||
| 201 | + { | ||
| 202 | + if (!is_null($this->fileHandle)) { | ||
| 203 | + fclose($this->fileHandle); | ||
| 204 | + unlink($this->fileName); | ||
| 205 | + } | ||
| 206 | + $this->fileHandle = null; | ||
| 207 | + } | ||
| 208 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_ICache | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +interface PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Add or Update a cell in cache identified by coordinate address | ||
| 32 | + * | ||
| 33 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 34 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 35 | + * @return PHPExcel_Cell | ||
| 36 | + * @throws PHPExcel_Exception | ||
| 37 | + */ | ||
| 38 | + public function addCacheData($pCoord, PHPExcel_Cell $cell); | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * Add or Update a cell in cache | ||
| 42 | + * | ||
| 43 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 44 | + * @return PHPExcel_Cell | ||
| 45 | + * @throws PHPExcel_Exception | ||
| 46 | + */ | ||
| 47 | + public function updateCacheData(PHPExcel_Cell $cell); | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Fetch a cell from cache identified by coordinate address | ||
| 51 | + * | ||
| 52 | + * @param string $pCoord Coordinate address of the cell to retrieve | ||
| 53 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 54 | + * @throws PHPExcel_Exception | ||
| 55 | + */ | ||
| 56 | + public function getCacheData($pCoord); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Delete a cell in cache identified by coordinate address | ||
| 60 | + * | ||
| 61 | + * @param string $pCoord Coordinate address of the cell to delete | ||
| 62 | + * @throws PHPExcel_Exception | ||
| 63 | + */ | ||
| 64 | + public function deleteCacheData($pCoord); | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||
| 68 | + * | ||
| 69 | + * @param string $pCoord Coordinate address of the cell to check | ||
| 70 | + * @return boolean | ||
| 71 | + */ | ||
| 72 | + public function isDataSet($pCoord); | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * Get a list of all cell addresses currently held in cache | ||
| 76 | + * | ||
| 77 | + * @return string[] | ||
| 78 | + */ | ||
| 79 | + public function getCellList(); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * Get the list of all cell addresses currently held in cache sorted by column and row | ||
| 83 | + * | ||
| 84 | + * @return string[] | ||
| 85 | + */ | ||
| 86 | + public function getSortedCellList(); | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Clone the cell collection | ||
| 90 | + * | ||
| 91 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 92 | + * @return void | ||
| 93 | + */ | ||
| 94 | + public function copyCellCollection(PHPExcel_Worksheet $parent); | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * Identify whether the caching method is currently available | ||
| 98 | + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||
| 99 | + * | ||
| 100 | + * @return boolean | ||
| 101 | + */ | ||
| 102 | + public static function cacheMethodIsAvailable(); | ||
| 103 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_Igbinary | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 32 | + * and the 'nullify' the current cell object | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + * @throws PHPExcel_Exception | ||
| 36 | + */ | ||
| 37 | + protected function storeData() | ||
| 38 | + { | ||
| 39 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 40 | + $this->currentObject->detach(); | ||
| 41 | + | ||
| 42 | + $this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject); | ||
| 43 | + $this->currentCellIsDirty = false; | ||
| 44 | + } | ||
| 45 | + $this->currentObjectID = $this->currentObject = null; | ||
| 46 | + } // function _storeData() | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Add or Update a cell in cache identified by coordinate address | ||
| 51 | + * | ||
| 52 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 53 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 54 | + * @return PHPExcel_Cell | ||
| 55 | + * @throws PHPExcel_Exception | ||
| 56 | + */ | ||
| 57 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 58 | + { | ||
| 59 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 60 | + $this->storeData(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + $this->currentObjectID = $pCoord; | ||
| 64 | + $this->currentObject = $cell; | ||
| 65 | + $this->currentCellIsDirty = true; | ||
| 66 | + | ||
| 67 | + return $cell; | ||
| 68 | + } // function addCacheData() | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Get cell at a specific coordinate | ||
| 73 | + * | ||
| 74 | + * @param string $pCoord Coordinate of the cell | ||
| 75 | + * @throws PHPExcel_Exception | ||
| 76 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 77 | + */ | ||
| 78 | + public function getCacheData($pCoord) | ||
| 79 | + { | ||
| 80 | + if ($pCoord === $this->currentObjectID) { | ||
| 81 | + return $this->currentObject; | ||
| 82 | + } | ||
| 83 | + $this->storeData(); | ||
| 84 | + | ||
| 85 | + // Check if the entry that has been requested actually exists | ||
| 86 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 87 | + // Return null if requested entry doesn't exist in cache | ||
| 88 | + return null; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + // Set current entry to the requested entry | ||
| 92 | + $this->currentObjectID = $pCoord; | ||
| 93 | + $this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]); | ||
| 94 | + // Re-attach this as the cell's parent | ||
| 95 | + $this->currentObject->attach($this); | ||
| 96 | + | ||
| 97 | + // Return requested entry | ||
| 98 | + return $this->currentObject; | ||
| 99 | + } // function getCacheData() | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Get a list of all cell addresses currently held in cache | ||
| 104 | + * | ||
| 105 | + * @return string[] | ||
| 106 | + */ | ||
| 107 | + public function getCellList() | ||
| 108 | + { | ||
| 109 | + if ($this->currentObjectID !== null) { | ||
| 110 | + $this->storeData(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return parent::getCellList(); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * Clear the cell collection and disconnect from our parent | ||
| 119 | + * | ||
| 120 | + * @return void | ||
| 121 | + */ | ||
| 122 | + public function unsetWorksheetCells() | ||
| 123 | + { | ||
| 124 | + if (!is_null($this->currentObject)) { | ||
| 125 | + $this->currentObject->detach(); | ||
| 126 | + $this->currentObject = $this->currentObjectID = null; | ||
| 127 | + } | ||
| 128 | + $this->cellCache = array(); | ||
| 129 | + | ||
| 130 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 131 | + $this->parent = null; | ||
| 132 | + } // function unsetWorksheetCells() | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * Identify whether the caching method is currently available | ||
| 137 | + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||
| 138 | + * | ||
| 139 | + * @return boolean | ||
| 140 | + */ | ||
| 141 | + public static function cacheMethodIsAvailable() | ||
| 142 | + { | ||
| 143 | + if (!function_exists('igbinary_serialize')) { | ||
| 144 | + return false; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + return true; | ||
| 148 | + } | ||
| 149 | +} |
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_Memory | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Dummy method callable from CacheBase, but unused by Memory cache | ||
| 32 | + * | ||
| 33 | + * @return void | ||
| 34 | + */ | ||
| 35 | + protected function storeData() | ||
| 36 | + { | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Add or Update a cell in cache identified by coordinate address | ||
| 41 | + * | ||
| 42 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 43 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 44 | + * @return PHPExcel_Cell | ||
| 45 | + * @throws PHPExcel_Exception | ||
| 46 | + */ | ||
| 47 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 48 | + { | ||
| 49 | + $this->cellCache[$pCoord] = $cell; | ||
| 50 | + | ||
| 51 | + // Set current entry to the new/updated entry | ||
| 52 | + $this->currentObjectID = $pCoord; | ||
| 53 | + | ||
| 54 | + return $cell; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Get cell at a specific coordinate | ||
| 60 | + * | ||
| 61 | + * @param string $pCoord Coordinate of the cell | ||
| 62 | + * @throws PHPExcel_Exception | ||
| 63 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 64 | + */ | ||
| 65 | + public function getCacheData($pCoord) | ||
| 66 | + { | ||
| 67 | + // Check if the entry that has been requested actually exists | ||
| 68 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 69 | + $this->currentObjectID = null; | ||
| 70 | + // Return null if requested entry doesn't exist in cache | ||
| 71 | + return null; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + // Set current entry to the requested entry | ||
| 75 | + $this->currentObjectID = $pCoord; | ||
| 76 | + | ||
| 77 | + // Return requested entry | ||
| 78 | + return $this->cellCache[$pCoord]; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * Clone the cell collection | ||
| 84 | + * | ||
| 85 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 86 | + */ | ||
| 87 | + public function copyCellCollection(PHPExcel_Worksheet $parent) | ||
| 88 | + { | ||
| 89 | + parent::copyCellCollection($parent); | ||
| 90 | + | ||
| 91 | + $newCollection = array(); | ||
| 92 | + foreach ($this->cellCache as $k => &$cell) { | ||
| 93 | + $newCollection[$k] = clone $cell; | ||
| 94 | + $newCollection[$k]->attach($this); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + $this->cellCache = $newCollection; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * Clear the cell collection and disconnect from our parent | ||
| 102 | + * | ||
| 103 | + */ | ||
| 104 | + public function unsetWorksheetCells() | ||
| 105 | + { | ||
| 106 | + // Because cells are all stored as intact objects in memory, we need to detach each one from the parent | ||
| 107 | + foreach ($this->cellCache as $k => &$cell) { | ||
| 108 | + $cell->detach(); | ||
| 109 | + $this->cellCache[$k] = null; | ||
| 110 | + } | ||
| 111 | + unset($cell); | ||
| 112 | + | ||
| 113 | + $this->cellCache = array(); | ||
| 114 | + | ||
| 115 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 116 | + $this->parent = null; | ||
| 117 | + } | ||
| 118 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_MemoryGZip | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 32 | + * and the 'nullify' the current cell object | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + * @throws PHPExcel_Exception | ||
| 36 | + */ | ||
| 37 | + protected function storeData() | ||
| 38 | + { | ||
| 39 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 40 | + $this->currentObject->detach(); | ||
| 41 | + | ||
| 42 | + $this->cellCache[$this->currentObjectID] = gzdeflate(serialize($this->currentObject)); | ||
| 43 | + $this->currentCellIsDirty = false; | ||
| 44 | + } | ||
| 45 | + $this->currentObjectID = $this->currentObject = null; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Add or Update a cell in cache identified by coordinate address | ||
| 51 | + * | ||
| 52 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 53 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 54 | + * @return PHPExcel_Cell | ||
| 55 | + * @throws PHPExcel_Exception | ||
| 56 | + */ | ||
| 57 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 58 | + { | ||
| 59 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 60 | + $this->storeData(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + $this->currentObjectID = $pCoord; | ||
| 64 | + $this->currentObject = $cell; | ||
| 65 | + $this->currentCellIsDirty = true; | ||
| 66 | + | ||
| 67 | + return $cell; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Get cell at a specific coordinate | ||
| 73 | + * | ||
| 74 | + * @param string $pCoord Coordinate of the cell | ||
| 75 | + * @throws PHPExcel_Exception | ||
| 76 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 77 | + */ | ||
| 78 | + public function getCacheData($pCoord) | ||
| 79 | + { | ||
| 80 | + if ($pCoord === $this->currentObjectID) { | ||
| 81 | + return $this->currentObject; | ||
| 82 | + } | ||
| 83 | + $this->storeData(); | ||
| 84 | + | ||
| 85 | + // Check if the entry that has been requested actually exists | ||
| 86 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 87 | + // Return null if requested entry doesn't exist in cache | ||
| 88 | + return null; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + // Set current entry to the requested entry | ||
| 92 | + $this->currentObjectID = $pCoord; | ||
| 93 | + $this->currentObject = unserialize(gzinflate($this->cellCache[$pCoord])); | ||
| 94 | + // Re-attach this as the cell's parent | ||
| 95 | + $this->currentObject->attach($this); | ||
| 96 | + | ||
| 97 | + // Return requested entry | ||
| 98 | + return $this->currentObject; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Get a list of all cell addresses currently held in cache | ||
| 104 | + * | ||
| 105 | + * @return string[] | ||
| 106 | + */ | ||
| 107 | + public function getCellList() | ||
| 108 | + { | ||
| 109 | + if ($this->currentObjectID !== null) { | ||
| 110 | + $this->storeData(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return parent::getCellList(); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * Clear the cell collection and disconnect from our parent | ||
| 119 | + * | ||
| 120 | + * @return void | ||
| 121 | + */ | ||
| 122 | + public function unsetWorksheetCells() | ||
| 123 | + { | ||
| 124 | + if (!is_null($this->currentObject)) { | ||
| 125 | + $this->currentObject->detach(); | ||
| 126 | + $this->currentObject = $this->currentObjectID = null; | ||
| 127 | + } | ||
| 128 | + $this->cellCache = array(); | ||
| 129 | + | ||
| 130 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 131 | + $this->parent = null; | ||
| 132 | + } | ||
| 133 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_MemorySerialized | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 32 | + * and the 'nullify' the current cell object | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + * @throws PHPExcel_Exception | ||
| 36 | + */ | ||
| 37 | + protected function storeData() | ||
| 38 | + { | ||
| 39 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 40 | + $this->currentObject->detach(); | ||
| 41 | + | ||
| 42 | + $this->cellCache[$this->currentObjectID] = serialize($this->currentObject); | ||
| 43 | + $this->currentCellIsDirty = false; | ||
| 44 | + } | ||
| 45 | + $this->currentObjectID = $this->currentObject = null; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Add or Update a cell in cache identified by coordinate address | ||
| 50 | + * | ||
| 51 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 52 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 53 | + * @return PHPExcel_Cell | ||
| 54 | + * @throws PHPExcel_Exception | ||
| 55 | + */ | ||
| 56 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 57 | + { | ||
| 58 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 59 | + $this->storeData(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + $this->currentObjectID = $pCoord; | ||
| 63 | + $this->currentObject = $cell; | ||
| 64 | + $this->currentCellIsDirty = true; | ||
| 65 | + | ||
| 66 | + return $cell; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * Get cell at a specific coordinate | ||
| 71 | + * | ||
| 72 | + * @param string $pCoord Coordinate of the cell | ||
| 73 | + * @throws PHPExcel_Exception | ||
| 74 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 75 | + */ | ||
| 76 | + public function getCacheData($pCoord) | ||
| 77 | + { | ||
| 78 | + if ($pCoord === $this->currentObjectID) { | ||
| 79 | + return $this->currentObject; | ||
| 80 | + } | ||
| 81 | + $this->storeData(); | ||
| 82 | + | ||
| 83 | + // Check if the entry that has been requested actually exists | ||
| 84 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 85 | + // Return null if requested entry doesn't exist in cache | ||
| 86 | + return null; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + // Set current entry to the requested entry | ||
| 90 | + $this->currentObjectID = $pCoord; | ||
| 91 | + $this->currentObject = unserialize($this->cellCache[$pCoord]); | ||
| 92 | + // Re-attach this as the cell's parent | ||
| 93 | + $this->currentObject->attach($this); | ||
| 94 | + | ||
| 95 | + // Return requested entry | ||
| 96 | + return $this->currentObject; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * Get a list of all cell addresses currently held in cache | ||
| 101 | + * | ||
| 102 | + * @return string[] | ||
| 103 | + */ | ||
| 104 | + public function getCellList() | ||
| 105 | + { | ||
| 106 | + if ($this->currentObjectID !== null) { | ||
| 107 | + $this->storeData(); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + return parent::getCellList(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * Clear the cell collection and disconnect from our parent | ||
| 115 | + * | ||
| 116 | + * @return void | ||
| 117 | + */ | ||
| 118 | + public function unsetWorksheetCells() | ||
| 119 | + { | ||
| 120 | + if (!is_null($this->currentObject)) { | ||
| 121 | + $this->currentObject->detach(); | ||
| 122 | + $this->currentObject = $this->currentObjectID = null; | ||
| 123 | + } | ||
| 124 | + $this->cellCache = array(); | ||
| 125 | + | ||
| 126 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 127 | + $this->parent = null; | ||
| 128 | + } | ||
| 129 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_PHPTemp | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Name of the file for this cache | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + private $fileHandle = null; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Memory limit to use before reverting to file cache | ||
| 39 | + * | ||
| 40 | + * @var integer | ||
| 41 | + */ | ||
| 42 | + private $memoryCacheSize = null; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 46 | + * and the 'nullify' the current cell object | ||
| 47 | + * | ||
| 48 | + * @return void | ||
| 49 | + * @throws PHPExcel_Exception | ||
| 50 | + */ | ||
| 51 | + protected function storeData() | ||
| 52 | + { | ||
| 53 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 54 | + $this->currentObject->detach(); | ||
| 55 | + | ||
| 56 | + fseek($this->fileHandle, 0, SEEK_END); | ||
| 57 | + | ||
| 58 | + $this->cellCache[$this->currentObjectID] = array( | ||
| 59 | + 'ptr' => ftell($this->fileHandle), | ||
| 60 | + 'sz' => fwrite($this->fileHandle, serialize($this->currentObject)) | ||
| 61 | + ); | ||
| 62 | + $this->currentCellIsDirty = false; | ||
| 63 | + } | ||
| 64 | + $this->currentObjectID = $this->currentObject = null; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Add or Update a cell in cache identified by coordinate address | ||
| 70 | + * | ||
| 71 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 72 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 73 | + * @return PHPExcel_Cell | ||
| 74 | + * @throws PHPExcel_Exception | ||
| 75 | + */ | ||
| 76 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 77 | + { | ||
| 78 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 79 | + $this->storeData(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + $this->currentObjectID = $pCoord; | ||
| 83 | + $this->currentObject = $cell; | ||
| 84 | + $this->currentCellIsDirty = true; | ||
| 85 | + | ||
| 86 | + return $cell; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * Get cell at a specific coordinate | ||
| 92 | + * | ||
| 93 | + * @param string $pCoord Coordinate of the cell | ||
| 94 | + * @throws PHPExcel_Exception | ||
| 95 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 96 | + */ | ||
| 97 | + public function getCacheData($pCoord) | ||
| 98 | + { | ||
| 99 | + if ($pCoord === $this->currentObjectID) { | ||
| 100 | + return $this->currentObject; | ||
| 101 | + } | ||
| 102 | + $this->storeData(); | ||
| 103 | + | ||
| 104 | + // Check if the entry that has been requested actually exists | ||
| 105 | + if (!isset($this->cellCache[$pCoord])) { | ||
| 106 | + // Return null if requested entry doesn't exist in cache | ||
| 107 | + return null; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + // Set current entry to the requested entry | ||
| 111 | + $this->currentObjectID = $pCoord; | ||
| 112 | + fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']); | ||
| 113 | + $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz'])); | ||
| 114 | + // Re-attach this as the cell's parent | ||
| 115 | + $this->currentObject->attach($this); | ||
| 116 | + | ||
| 117 | + // Return requested entry | ||
| 118 | + return $this->currentObject; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * Get a list of all cell addresses currently held in cache | ||
| 123 | + * | ||
| 124 | + * @return string[] | ||
| 125 | + */ | ||
| 126 | + public function getCellList() | ||
| 127 | + { | ||
| 128 | + if ($this->currentObjectID !== null) { | ||
| 129 | + $this->storeData(); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + return parent::getCellList(); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * Clone the cell collection | ||
| 137 | + * | ||
| 138 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 139 | + * @return void | ||
| 140 | + */ | ||
| 141 | + public function copyCellCollection(PHPExcel_Worksheet $parent) | ||
| 142 | + { | ||
| 143 | + parent::copyCellCollection($parent); | ||
| 144 | + // Open a new stream for the cell cache data | ||
| 145 | + $newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+'); | ||
| 146 | + // Copy the existing cell cache data to the new stream | ||
| 147 | + fseek($this->fileHandle, 0); | ||
| 148 | + while (!feof($this->fileHandle)) { | ||
| 149 | + fwrite($newFileHandle, fread($this->fileHandle, 1024)); | ||
| 150 | + } | ||
| 151 | + $this->fileHandle = $newFileHandle; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + /** | ||
| 155 | + * Clear the cell collection and disconnect from our parent | ||
| 156 | + * | ||
| 157 | + * @return void | ||
| 158 | + */ | ||
| 159 | + public function unsetWorksheetCells() | ||
| 160 | + { | ||
| 161 | + if (!is_null($this->currentObject)) { | ||
| 162 | + $this->currentObject->detach(); | ||
| 163 | + $this->currentObject = $this->currentObjectID = null; | ||
| 164 | + } | ||
| 165 | + $this->cellCache = array(); | ||
| 166 | + | ||
| 167 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 168 | + $this->parent = null; | ||
| 169 | + | ||
| 170 | + // Close down the php://temp file | ||
| 171 | + $this->__destruct(); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * Initialise this new cell collection | ||
| 176 | + * | ||
| 177 | + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection | ||
| 178 | + * @param array of mixed $arguments Additional initialisation arguments | ||
| 179 | + */ | ||
| 180 | + public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||
| 181 | + { | ||
| 182 | + $this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; | ||
| 183 | + | ||
| 184 | + parent::__construct($parent); | ||
| 185 | + if (is_null($this->fileHandle)) { | ||
| 186 | + $this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+'); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * Destroy this cell collection | ||
| 192 | + */ | ||
| 193 | + public function __destruct() | ||
| 194 | + { | ||
| 195 | + if (!is_null($this->fileHandle)) { | ||
| 196 | + fclose($this->fileHandle); | ||
| 197 | + } | ||
| 198 | + $this->fileHandle = null; | ||
| 199 | + } | ||
| 200 | +} |
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorage_Wincache | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Prefix used to uniquely identify cache data for this worksheet | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + private $cachePrefix = null; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Cache timeout | ||
| 39 | + * | ||
| 40 | + * @var integer | ||
| 41 | + */ | ||
| 42 | + private $cacheTime = 600; | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Store cell data in cache for the current cell object if it's "dirty", | ||
| 47 | + * and the 'nullify' the current cell object | ||
| 48 | + * | ||
| 49 | + * @return void | ||
| 50 | + * @throws PHPExcel_Exception | ||
| 51 | + */ | ||
| 52 | + protected function storeData() | ||
| 53 | + { | ||
| 54 | + if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { | ||
| 55 | + $this->currentObject->detach(); | ||
| 56 | + | ||
| 57 | + $obj = serialize($this->currentObject); | ||
| 58 | + if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) { | ||
| 59 | + if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { | ||
| 60 | + $this->__destruct(); | ||
| 61 | + throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); | ||
| 62 | + } | ||
| 63 | + } else { | ||
| 64 | + if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { | ||
| 65 | + $this->__destruct(); | ||
| 66 | + throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + $this->currentCellIsDirty = false; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + $this->currentObjectID = $this->currentObject = null; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * Add or Update a cell in cache identified by coordinate address | ||
| 77 | + * | ||
| 78 | + * @param string $pCoord Coordinate address of the cell to update | ||
| 79 | + * @param PHPExcel_Cell $cell Cell to update | ||
| 80 | + * @return PHPExcel_Cell | ||
| 81 | + * @throws PHPExcel_Exception | ||
| 82 | + */ | ||
| 83 | + public function addCacheData($pCoord, PHPExcel_Cell $cell) | ||
| 84 | + { | ||
| 85 | + if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { | ||
| 86 | + $this->storeData(); | ||
| 87 | + } | ||
| 88 | + $this->cellCache[$pCoord] = true; | ||
| 89 | + | ||
| 90 | + $this->currentObjectID = $pCoord; | ||
| 91 | + $this->currentObject = $cell; | ||
| 92 | + $this->currentCellIsDirty = true; | ||
| 93 | + | ||
| 94 | + return $cell; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? | ||
| 99 | + * | ||
| 100 | + * @param string $pCoord Coordinate address of the cell to check | ||
| 101 | + * @return boolean | ||
| 102 | + */ | ||
| 103 | + public function isDataSet($pCoord) | ||
| 104 | + { | ||
| 105 | + // Check if the requested entry is the current object, or exists in the cache | ||
| 106 | + if (parent::isDataSet($pCoord)) { | ||
| 107 | + if ($this->currentObjectID == $pCoord) { | ||
| 108 | + return true; | ||
| 109 | + } | ||
| 110 | + // Check if the requested entry still exists in cache | ||
| 111 | + $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache'); | ||
| 112 | + if ($success === false) { | ||
| 113 | + // Entry no longer exists in Wincache, so clear it from the cache array | ||
| 114 | + parent::deleteCacheData($pCoord); | ||
| 115 | + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | ||
| 116 | + } | ||
| 117 | + return true; | ||
| 118 | + } | ||
| 119 | + return false; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * Get cell at a specific coordinate | ||
| 125 | + * | ||
| 126 | + * @param string $pCoord Coordinate of the cell | ||
| 127 | + * @throws PHPExcel_Exception | ||
| 128 | + * @return PHPExcel_Cell Cell that was found, or null if not found | ||
| 129 | + */ | ||
| 130 | + public function getCacheData($pCoord) | ||
| 131 | + { | ||
| 132 | + if ($pCoord === $this->currentObjectID) { | ||
| 133 | + return $this->currentObject; | ||
| 134 | + } | ||
| 135 | + $this->storeData(); | ||
| 136 | + | ||
| 137 | + // Check if the entry that has been requested actually exists | ||
| 138 | + $obj = null; | ||
| 139 | + if (parent::isDataSet($pCoord)) { | ||
| 140 | + $success = false; | ||
| 141 | + $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success); | ||
| 142 | + if ($success === false) { | ||
| 143 | + // Entry no longer exists in WinCache, so clear it from the cache array | ||
| 144 | + parent::deleteCacheData($pCoord); | ||
| 145 | + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); | ||
| 146 | + } | ||
| 147 | + } else { | ||
| 148 | + // Return null if requested entry doesn't exist in cache | ||
| 149 | + return null; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + // Set current entry to the requested entry | ||
| 153 | + $this->currentObjectID = $pCoord; | ||
| 154 | + $this->currentObject = unserialize($obj); | ||
| 155 | + // Re-attach this as the cell's parent | ||
| 156 | + $this->currentObject->attach($this); | ||
| 157 | + | ||
| 158 | + // Return requested entry | ||
| 159 | + return $this->currentObject; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * Get a list of all cell addresses currently held in cache | ||
| 165 | + * | ||
| 166 | + * @return string[] | ||
| 167 | + */ | ||
| 168 | + public function getCellList() | ||
| 169 | + { | ||
| 170 | + if ($this->currentObjectID !== null) { | ||
| 171 | + $this->storeData(); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + return parent::getCellList(); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * Delete a cell in cache identified by coordinate address | ||
| 179 | + * | ||
| 180 | + * @param string $pCoord Coordinate address of the cell to delete | ||
| 181 | + * @throws PHPExcel_Exception | ||
| 182 | + */ | ||
| 183 | + public function deleteCacheData($pCoord) | ||
| 184 | + { | ||
| 185 | + // Delete the entry from Wincache | ||
| 186 | + wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache'); | ||
| 187 | + | ||
| 188 | + // Delete the entry from our cell address array | ||
| 189 | + parent::deleteCacheData($pCoord); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + /** | ||
| 193 | + * Clone the cell collection | ||
| 194 | + * | ||
| 195 | + * @param PHPExcel_Worksheet $parent The new worksheet | ||
| 196 | + * @return void | ||
| 197 | + */ | ||
| 198 | + public function copyCellCollection(PHPExcel_Worksheet $parent) | ||
| 199 | + { | ||
| 200 | + parent::copyCellCollection($parent); | ||
| 201 | + // Get a new id for the new file name | ||
| 202 | + $baseUnique = $this->getUniqueID(); | ||
| 203 | + $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; | ||
| 204 | + $cacheList = $this->getCellList(); | ||
| 205 | + foreach ($cacheList as $cellID) { | ||
| 206 | + if ($cellID != $this->currentObjectID) { | ||
| 207 | + $success = false; | ||
| 208 | + $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success); | ||
| 209 | + if ($success === false) { | ||
| 210 | + // Entry no longer exists in WinCache, so clear it from the cache array | ||
| 211 | + parent::deleteCacheData($cellID); | ||
| 212 | + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); | ||
| 213 | + } | ||
| 214 | + if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) { | ||
| 215 | + $this->__destruct(); | ||
| 216 | + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + $this->cachePrefix = $newCachePrefix; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + | ||
| 224 | + /** | ||
| 225 | + * Clear the cell collection and disconnect from our parent | ||
| 226 | + * | ||
| 227 | + * @return void | ||
| 228 | + */ | ||
| 229 | + public function unsetWorksheetCells() | ||
| 230 | + { | ||
| 231 | + if (!is_null($this->currentObject)) { | ||
| 232 | + $this->currentObject->detach(); | ||
| 233 | + $this->currentObject = $this->currentObjectID = null; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + // Flush the WinCache cache | ||
| 237 | + $this->__destruct(); | ||
| 238 | + | ||
| 239 | + $this->cellCache = array(); | ||
| 240 | + | ||
| 241 | + // detach ourself from the worksheet, so that it can then delete this object successfully | ||
| 242 | + $this->parent = null; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + /** | ||
| 246 | + * Initialise this new cell collection | ||
| 247 | + * | ||
| 248 | + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection | ||
| 249 | + * @param array of mixed $arguments Additional initialisation arguments | ||
| 250 | + */ | ||
| 251 | + public function __construct(PHPExcel_Worksheet $parent, $arguments) | ||
| 252 | + { | ||
| 253 | + $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; | ||
| 254 | + | ||
| 255 | + if (is_null($this->cachePrefix)) { | ||
| 256 | + $baseUnique = $this->getUniqueID(); | ||
| 257 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.'; | ||
| 258 | + $this->cacheTime = $cacheTime; | ||
| 259 | + | ||
| 260 | + parent::__construct($parent); | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * Destroy this cell collection | ||
| 266 | + */ | ||
| 267 | + public function __destruct() | ||
| 268 | + { | ||
| 269 | + $cacheList = $this->getCellList(); | ||
| 270 | + foreach ($cacheList as $cellID) { | ||
| 271 | + wincache_ucache_delete($this->cachePrefix.$cellID.'.cache'); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + /** | ||
| 276 | + * Identify whether the caching method is currently available | ||
| 277 | + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build | ||
| 278 | + * | ||
| 279 | + * @return boolean | ||
| 280 | + */ | ||
| 281 | + public static function cacheMethodIsAvailable() | ||
| 282 | + { | ||
| 283 | + if (!function_exists('wincache_ucache_add')) { | ||
| 284 | + return false; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + return true; | ||
| 288 | + } | ||
| 289 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CachedObjectStorageFactory | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_CachedObjectStorage | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CachedObjectStorageFactory | ||
| 29 | +{ | ||
| 30 | + const cache_in_memory = 'Memory'; | ||
| 31 | + const cache_in_memory_gzip = 'MemoryGZip'; | ||
| 32 | + const cache_in_memory_serialized = 'MemorySerialized'; | ||
| 33 | + const cache_igbinary = 'Igbinary'; | ||
| 34 | + const cache_to_discISAM = 'DiscISAM'; | ||
| 35 | + const cache_to_apc = 'APC'; | ||
| 36 | + const cache_to_memcache = 'Memcache'; | ||
| 37 | + const cache_to_phpTemp = 'PHPTemp'; | ||
| 38 | + const cache_to_wincache = 'Wincache'; | ||
| 39 | + const cache_to_sqlite = 'SQLite'; | ||
| 40 | + const cache_to_sqlite3 = 'SQLite3'; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * Name of the method used for cell cacheing | ||
| 44 | + * | ||
| 45 | + * @var string | ||
| 46 | + */ | ||
| 47 | + private static $cacheStorageMethod = null; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Name of the class used for cell cacheing | ||
| 51 | + * | ||
| 52 | + * @var string | ||
| 53 | + */ | ||
| 54 | + private static $cacheStorageClass = null; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * List of all possible cache storage methods | ||
| 58 | + * | ||
| 59 | + * @var string[] | ||
| 60 | + */ | ||
| 61 | + private static $storageMethods = array( | ||
| 62 | + self::cache_in_memory, | ||
| 63 | + self::cache_in_memory_gzip, | ||
| 64 | + self::cache_in_memory_serialized, | ||
| 65 | + self::cache_igbinary, | ||
| 66 | + self::cache_to_phpTemp, | ||
| 67 | + self::cache_to_discISAM, | ||
| 68 | + self::cache_to_apc, | ||
| 69 | + self::cache_to_memcache, | ||
| 70 | + self::cache_to_wincache, | ||
| 71 | + self::cache_to_sqlite, | ||
| 72 | + self::cache_to_sqlite3, | ||
| 73 | + ); | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * Default arguments for each cache storage method | ||
| 77 | + * | ||
| 78 | + * @var array of mixed array | ||
| 79 | + */ | ||
| 80 | + private static $storageMethodDefaultParameters = array( | ||
| 81 | + self::cache_in_memory => array( | ||
| 82 | + ), | ||
| 83 | + self::cache_in_memory_gzip => array( | ||
| 84 | + ), | ||
| 85 | + self::cache_in_memory_serialized => array( | ||
| 86 | + ), | ||
| 87 | + self::cache_igbinary => array( | ||
| 88 | + ), | ||
| 89 | + self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB' | ||
| 90 | + ), | ||
| 91 | + self::cache_to_discISAM => array( 'dir' => null | ||
| 92 | + ), | ||
| 93 | + self::cache_to_apc => array( 'cacheTime' => 600 | ||
| 94 | + ), | ||
| 95 | + self::cache_to_memcache => array( 'memcacheServer' => 'localhost', | ||
| 96 | + 'memcachePort' => 11211, | ||
| 97 | + 'cacheTime' => 600 | ||
| 98 | + ), | ||
| 99 | + self::cache_to_wincache => array( 'cacheTime' => 600 | ||
| 100 | + ), | ||
| 101 | + self::cache_to_sqlite => array( | ||
| 102 | + ), | ||
| 103 | + self::cache_to_sqlite3 => array( | ||
| 104 | + ), | ||
| 105 | + ); | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * Arguments for the active cache storage method | ||
| 109 | + * | ||
| 110 | + * @var array of mixed array | ||
| 111 | + */ | ||
| 112 | + private static $storageMethodParameters = array(); | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * Return the current cache storage method | ||
| 116 | + * | ||
| 117 | + * @return string|null | ||
| 118 | + **/ | ||
| 119 | + public static function getCacheStorageMethod() | ||
| 120 | + { | ||
| 121 | + return self::$cacheStorageMethod; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * Return the current cache storage class | ||
| 126 | + * | ||
| 127 | + * @return PHPExcel_CachedObjectStorage_ICache|null | ||
| 128 | + **/ | ||
| 129 | + public static function getCacheStorageClass() | ||
| 130 | + { | ||
| 131 | + return self::$cacheStorageClass; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * Return the list of all possible cache storage methods | ||
| 136 | + * | ||
| 137 | + * @return string[] | ||
| 138 | + **/ | ||
| 139 | + public static function getAllCacheStorageMethods() | ||
| 140 | + { | ||
| 141 | + return self::$storageMethods; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * Return the list of all available cache storage methods | ||
| 146 | + * | ||
| 147 | + * @return string[] | ||
| 148 | + **/ | ||
| 149 | + public static function getCacheStorageMethods() | ||
| 150 | + { | ||
| 151 | + $activeMethods = array(); | ||
| 152 | + foreach (self::$storageMethods as $storageMethod) { | ||
| 153 | + $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; | ||
| 154 | + if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { | ||
| 155 | + $activeMethods[] = $storageMethod; | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + return $activeMethods; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + /** | ||
| 162 | + * Identify the cache storage method to use | ||
| 163 | + * | ||
| 164 | + * @param string $method Name of the method to use for cell cacheing | ||
| 165 | + * @param array of mixed $arguments Additional arguments to pass to the cell caching class | ||
| 166 | + * when instantiating | ||
| 167 | + * @return boolean | ||
| 168 | + **/ | ||
| 169 | + public static function initialize($method = self::cache_in_memory, $arguments = array()) | ||
| 170 | + { | ||
| 171 | + if (!in_array($method, self::$storageMethods)) { | ||
| 172 | + return false; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; | ||
| 176 | + if (!call_user_func(array( $cacheStorageClass, | ||
| 177 | + 'cacheMethodIsAvailable'))) { | ||
| 178 | + return false; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + self::$storageMethodParameters[$method] = self::$storageMethodDefaultParameters[$method]; | ||
| 182 | + foreach ($arguments as $k => $v) { | ||
| 183 | + if (array_key_exists($k, self::$storageMethodParameters[$method])) { | ||
| 184 | + self::$storageMethodParameters[$method][$k] = $v; | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + if (self::$cacheStorageMethod === null) { | ||
| 189 | + self::$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; | ||
| 190 | + self::$cacheStorageMethod = $method; | ||
| 191 | + } | ||
| 192 | + return true; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + /** | ||
| 196 | + * Initialise the cache storage | ||
| 197 | + * | ||
| 198 | + * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet | ||
| 199 | + * @return PHPExcel_CachedObjectStorage_ICache | ||
| 200 | + **/ | ||
| 201 | + public static function getInstance(PHPExcel_Worksheet $parent) | ||
| 202 | + { | ||
| 203 | + $cacheMethodIsAvailable = true; | ||
| 204 | + if (self::$cacheStorageMethod === null) { | ||
| 205 | + $cacheMethodIsAvailable = self::initialize(); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + if ($cacheMethodIsAvailable) { | ||
| 209 | + $instance = new self::$cacheStorageClass( | ||
| 210 | + $parent, | ||
| 211 | + self::$storageMethodParameters[self::$cacheStorageMethod] | ||
| 212 | + ); | ||
| 213 | + if ($instance !== null) { | ||
| 214 | + return $instance; | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + return false; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * Clear the cache storage | ||
| 223 | + * | ||
| 224 | + **/ | ||
| 225 | + public static function finalize() | ||
| 226 | + { | ||
| 227 | + self::$cacheStorageMethod = null; | ||
| 228 | + self::$cacheStorageClass = null; | ||
| 229 | + self::$storageMethodParameters = array(); | ||
| 230 | + } | ||
| 231 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CalcEngine_CyclicReferenceStack | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CalcEngine_CyclicReferenceStack | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * The call stack for calculated cells | ||
| 32 | + * | ||
| 33 | + * @var mixed[] | ||
| 34 | + */ | ||
| 35 | + private $stack = array(); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Return the number of entries on the stack | ||
| 39 | + * | ||
| 40 | + * @return integer | ||
| 41 | + */ | ||
| 42 | + public function count() | ||
| 43 | + { | ||
| 44 | + return count($this->stack); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Push a new entry onto the stack | ||
| 49 | + * | ||
| 50 | + * @param mixed $value | ||
| 51 | + */ | ||
| 52 | + public function push($value) | ||
| 53 | + { | ||
| 54 | + $this->stack[$value] = $value; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Pop the last entry from the stack | ||
| 59 | + * | ||
| 60 | + * @return mixed | ||
| 61 | + */ | ||
| 62 | + public function pop() | ||
| 63 | + { | ||
| 64 | + return array_pop($this->stack); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * Test to see if a specified entry exists on the stack | ||
| 69 | + * | ||
| 70 | + * @param mixed $value The value to test | ||
| 71 | + */ | ||
| 72 | + public function onStack($value) | ||
| 73 | + { | ||
| 74 | + return isset($this->stack[$value]); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * Clear the stack | ||
| 79 | + */ | ||
| 80 | + public function clear() | ||
| 81 | + { | ||
| 82 | + $this->stack = array(); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * Return an array of all entries on the stack | ||
| 87 | + * | ||
| 88 | + * @return mixed[] | ||
| 89 | + */ | ||
| 90 | + public function showStack() | ||
| 91 | + { | ||
| 92 | + return $this->stack; | ||
| 93 | + } | ||
| 94 | +} |
PHPExcel_Croe/PHPExcel/CalcEngine/Logger.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_CalcEngine_Logger | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_CalcEngine_Logger | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Flag to determine whether a debug log should be generated by the calculation engine | ||
| 32 | + * If true, then a debug log will be generated | ||
| 33 | + * If false, then a debug log will not be generated | ||
| 34 | + * | ||
| 35 | + * @var boolean | ||
| 36 | + */ | ||
| 37 | + private $writeDebugLog = false; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Flag to determine whether a debug log should be echoed by the calculation engine | ||
| 41 | + * If true, then a debug log will be echoed | ||
| 42 | + * If false, then a debug log will not be echoed | ||
| 43 | + * A debug log can only be echoed if it is generated | ||
| 44 | + * | ||
| 45 | + * @var boolean | ||
| 46 | + */ | ||
| 47 | + private $echoDebugLog = false; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * The debug log generated by the calculation engine | ||
| 51 | + * | ||
| 52 | + * @var string[] | ||
| 53 | + */ | ||
| 54 | + private $debugLog = array(); | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * The calculation engine cell reference stack | ||
| 58 | + * | ||
| 59 | + * @var PHPExcel_CalcEngine_CyclicReferenceStack | ||
| 60 | + */ | ||
| 61 | + private $cellStack; | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * Instantiate a Calculation engine logger | ||
| 65 | + * | ||
| 66 | + * @param PHPExcel_CalcEngine_CyclicReferenceStack $stack | ||
| 67 | + */ | ||
| 68 | + public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) | ||
| 69 | + { | ||
| 70 | + $this->cellStack = $stack; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * Enable/Disable Calculation engine logging | ||
| 75 | + * | ||
| 76 | + * @param boolean $pValue | ||
| 77 | + */ | ||
| 78 | + public function setWriteDebugLog($pValue = false) | ||
| 79 | + { | ||
| 80 | + $this->writeDebugLog = $pValue; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * Return whether calculation engine logging is enabled or disabled | ||
| 85 | + * | ||
| 86 | + * @return boolean | ||
| 87 | + */ | ||
| 88 | + public function getWriteDebugLog() | ||
| 89 | + { | ||
| 90 | + return $this->writeDebugLog; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Enable/Disable echoing of debug log information | ||
| 95 | + * | ||
| 96 | + * @param boolean $pValue | ||
| 97 | + */ | ||
| 98 | + public function setEchoDebugLog($pValue = false) | ||
| 99 | + { | ||
| 100 | + $this->echoDebugLog = $pValue; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * Return whether echoing of debug log information is enabled or disabled | ||
| 105 | + * | ||
| 106 | + * @return boolean | ||
| 107 | + */ | ||
| 108 | + public function getEchoDebugLog() | ||
| 109 | + { | ||
| 110 | + return $this->echoDebugLog; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * Write an entry to the calculation engine debug log | ||
| 115 | + */ | ||
| 116 | + public function writeDebugLog() | ||
| 117 | + { | ||
| 118 | + // Only write the debug log if logging is enabled | ||
| 119 | + if ($this->writeDebugLog) { | ||
| 120 | + $message = implode(func_get_args()); | ||
| 121 | + $cellReference = implode(' -> ', $this->cellStack->showStack()); | ||
| 122 | + if ($this->echoDebugLog) { | ||
| 123 | + echo $cellReference, | ||
| 124 | + ($this->cellStack->count() > 0 ? ' => ' : ''), | ||
| 125 | + $message, | ||
| 126 | + PHP_EOL; | ||
| 127 | + } | ||
| 128 | + $this->debugLog[] = $cellReference . | ||
| 129 | + ($this->cellStack->count() > 0 ? ' => ' : '') . | ||
| 130 | + $message; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * Clear the calculation engine debug log | ||
| 136 | + */ | ||
| 137 | + public function clearLog() | ||
| 138 | + { | ||
| 139 | + $this->debugLog = array(); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * Return the calculation engine debug log | ||
| 144 | + * | ||
| 145 | + * @return string[] | ||
| 146 | + */ | ||
| 147 | + public function getLog() | ||
| 148 | + { | ||
| 149 | + return $this->debugLog; | ||
| 150 | + } | ||
| 151 | +} |
PHPExcel_Croe/PHPExcel/Calculation.php
0 → 100755
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异太大,无法显示。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Calculation_Exception | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Calculation_Exception extends PHPExcel_Exception | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Error handler callback | ||
| 32 | + * | ||
| 33 | + * @param mixed $code | ||
| 34 | + * @param mixed $string | ||
| 35 | + * @param mixed $file | ||
| 36 | + * @param mixed $line | ||
| 37 | + * @param mixed $context | ||
| 38 | + */ | ||
| 39 | + public static function errorHandlerCallback($code, $string, $file, $line, $context) | ||
| 40 | + { | ||
| 41 | + $e = new self($string, $code); | ||
| 42 | + $e->line = $line; | ||
| 43 | + $e->file = $file; | ||
| 44 | + throw $e; | ||
| 45 | + } | ||
| 46 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Calculation_ExceptionHandler | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Calculation_ExceptionHandler | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Register errorhandler | ||
| 32 | + */ | ||
| 33 | + public function __construct() | ||
| 34 | + { | ||
| 35 | + set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Unregister errorhandler | ||
| 40 | + */ | ||
| 41 | + public function __destruct() | ||
| 42 | + { | ||
| 43 | + restore_error_handler(); | ||
| 44 | + } | ||
| 45 | +} |
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/* | ||
| 4 | +PARTLY BASED ON: | ||
| 5 | + Copyright (c) 2007 E. W. Bachtal, Inc. | ||
| 6 | + | ||
| 7 | + Permission is hereby granted, free of charge, to any person obtaining a copy of this software | ||
| 8 | + and associated documentation files (the "Software"), to deal in the Software without restriction, | ||
| 9 | + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 10 | + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | + subject to the following conditions: | ||
| 12 | + | ||
| 13 | + The above copyright notice and this permission notice shall be included in all copies or substantial | ||
| 14 | + portions of the Software. | ||
| 15 | + | ||
| 16 | + The software is provided "as is", without warranty of any kind, express or implied, including but not | ||
| 17 | + limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In | ||
| 18 | + no event shall the authors or copyright holders be liable for any claim, damages or other liability, | ||
| 19 | + whether in an action of contract, tort or otherwise, arising from, out of or in connection with the | ||
| 20 | + software or the use or other dealings in the software. | ||
| 21 | + | ||
| 22 | + http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html | ||
| 23 | + http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html | ||
| 24 | +*/ | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * PHPExcel_Calculation_FormulaToken | ||
| 28 | + * | ||
| 29 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 30 | + * | ||
| 31 | + * This library is free software; you can redistribute it and/or | ||
| 32 | + * modify it under the terms of the GNU Lesser General Public | ||
| 33 | + * License as published by the Free Software Foundation; either | ||
| 34 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 35 | + * | ||
| 36 | + * This library is distributed in the hope that it will be useful, | ||
| 37 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 38 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 39 | + * Lesser General Public License for more details. | ||
| 40 | + * | ||
| 41 | + * You should have received a copy of the GNU Lesser General Public | ||
| 42 | + * License along with this library; if not, write to the Free Software | ||
| 43 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 44 | + * | ||
| 45 | + * @category PHPExcel | ||
| 46 | + * @package PHPExcel_Calculation | ||
| 47 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 48 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 49 | + * @version ##VERSION##, ##DATE## | ||
| 50 | + */ | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +class PHPExcel_Calculation_FormulaToken | ||
| 54 | +{ | ||
| 55 | + /* Token types */ | ||
| 56 | + const TOKEN_TYPE_NOOP = 'Noop'; | ||
| 57 | + const TOKEN_TYPE_OPERAND = 'Operand'; | ||
| 58 | + const TOKEN_TYPE_FUNCTION = 'Function'; | ||
| 59 | + const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression'; | ||
| 60 | + const TOKEN_TYPE_ARGUMENT = 'Argument'; | ||
| 61 | + const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix'; | ||
| 62 | + const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix'; | ||
| 63 | + const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix'; | ||
| 64 | + const TOKEN_TYPE_WHITESPACE = 'Whitespace'; | ||
| 65 | + const TOKEN_TYPE_UNKNOWN = 'Unknown'; | ||
| 66 | + | ||
| 67 | + /* Token subtypes */ | ||
| 68 | + const TOKEN_SUBTYPE_NOTHING = 'Nothing'; | ||
| 69 | + const TOKEN_SUBTYPE_START = 'Start'; | ||
| 70 | + const TOKEN_SUBTYPE_STOP = 'Stop'; | ||
| 71 | + const TOKEN_SUBTYPE_TEXT = 'Text'; | ||
| 72 | + const TOKEN_SUBTYPE_NUMBER = 'Number'; | ||
| 73 | + const TOKEN_SUBTYPE_LOGICAL = 'Logical'; | ||
| 74 | + const TOKEN_SUBTYPE_ERROR = 'Error'; | ||
| 75 | + const TOKEN_SUBTYPE_RANGE = 'Range'; | ||
| 76 | + const TOKEN_SUBTYPE_MATH = 'Math'; | ||
| 77 | + const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; | ||
| 78 | + const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; | ||
| 79 | + const TOKEN_SUBTYPE_UNION = 'Union'; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * Value | ||
| 83 | + * | ||
| 84 | + * @var string | ||
| 85 | + */ | ||
| 86 | + private $value; | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Token Type (represented by TOKEN_TYPE_*) | ||
| 90 | + * | ||
| 91 | + * @var string | ||
| 92 | + */ | ||
| 93 | + private $tokenType; | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * Token SubType (represented by TOKEN_SUBTYPE_*) | ||
| 97 | + * | ||
| 98 | + * @var string | ||
| 99 | + */ | ||
| 100 | + private $tokenSubType; | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Create a new PHPExcel_Calculation_FormulaToken | ||
| 104 | + * | ||
| 105 | + * @param string $pValue | ||
| 106 | + * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) | ||
| 107 | + * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) | ||
| 108 | + */ | ||
| 109 | + public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) | ||
| 110 | + { | ||
| 111 | + // Initialise values | ||
| 112 | + $this->value = $pValue; | ||
| 113 | + $this->tokenType = $pTokenType; | ||
| 114 | + $this->tokenSubType = $pTokenSubType; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * Get Value | ||
| 119 | + * | ||
| 120 | + * @return string | ||
| 121 | + */ | ||
| 122 | + public function getValue() | ||
| 123 | + { | ||
| 124 | + return $this->value; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * Set Value | ||
| 129 | + * | ||
| 130 | + * @param string $value | ||
| 131 | + */ | ||
| 132 | + public function setValue($value) | ||
| 133 | + { | ||
| 134 | + $this->value = $value; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * Get Token Type (represented by TOKEN_TYPE_*) | ||
| 139 | + * | ||
| 140 | + * @return string | ||
| 141 | + */ | ||
| 142 | + public function getTokenType() | ||
| 143 | + { | ||
| 144 | + return $this->tokenType; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * Set Token Type | ||
| 149 | + * | ||
| 150 | + * @param string $value | ||
| 151 | + */ | ||
| 152 | + public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) | ||
| 153 | + { | ||
| 154 | + $this->tokenType = $value; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * Get Token SubType (represented by TOKEN_SUBTYPE_*) | ||
| 159 | + * | ||
| 160 | + * @return string | ||
| 161 | + */ | ||
| 162 | + public function getTokenSubType() | ||
| 163 | + { | ||
| 164 | + return $this->tokenSubType; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + /** | ||
| 168 | + * Set Token SubType | ||
| 169 | + * | ||
| 170 | + * @param string $value | ||
| 171 | + */ | ||
| 172 | + public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) | ||
| 173 | + { | ||
| 174 | + $this->tokenSubType = $value; | ||
| 175 | + } | ||
| 176 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Calculation_Function | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Calculation_Function | ||
| 29 | +{ | ||
| 30 | + /* Function categories */ | ||
| 31 | + const CATEGORY_CUBE = 'Cube'; | ||
| 32 | + const CATEGORY_DATABASE = 'Database'; | ||
| 33 | + const CATEGORY_DATE_AND_TIME = 'Date and Time'; | ||
| 34 | + const CATEGORY_ENGINEERING = 'Engineering'; | ||
| 35 | + const CATEGORY_FINANCIAL = 'Financial'; | ||
| 36 | + const CATEGORY_INFORMATION = 'Information'; | ||
| 37 | + const CATEGORY_LOGICAL = 'Logical'; | ||
| 38 | + const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference'; | ||
| 39 | + const CATEGORY_MATH_AND_TRIG = 'Math and Trig'; | ||
| 40 | + const CATEGORY_STATISTICAL = 'Statistical'; | ||
| 41 | + const CATEGORY_TEXT_AND_DATA = 'Text and Data'; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Category (represented by CATEGORY_*) | ||
| 45 | + * | ||
| 46 | + * @var string | ||
| 47 | + */ | ||
| 48 | + private $category; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Excel name | ||
| 52 | + * | ||
| 53 | + * @var string | ||
| 54 | + */ | ||
| 55 | + private $excelName; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * PHPExcel name | ||
| 59 | + * | ||
| 60 | + * @var string | ||
| 61 | + */ | ||
| 62 | + private $phpExcelName; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * Create a new PHPExcel_Calculation_Function | ||
| 66 | + * | ||
| 67 | + * @param string $pCategory Category (represented by CATEGORY_*) | ||
| 68 | + * @param string $pExcelName Excel function name | ||
| 69 | + * @param string $pPHPExcelName PHPExcel function mapping | ||
| 70 | + * @throws PHPExcel_Calculation_Exception | ||
| 71 | + */ | ||
| 72 | + public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null) | ||
| 73 | + { | ||
| 74 | + if (($pCategory !== null) && ($pExcelName !== null) && ($pPHPExcelName !== null)) { | ||
| 75 | + // Initialise values | ||
| 76 | + $this->category = $pCategory; | ||
| 77 | + $this->excelName = $pExcelName; | ||
| 78 | + $this->phpExcelName = $pPHPExcelName; | ||
| 79 | + } else { | ||
| 80 | + throw new PHPExcel_Calculation_Exception("Invalid parameters passed."); | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Get Category (represented by CATEGORY_*) | ||
| 86 | + * | ||
| 87 | + * @return string | ||
| 88 | + */ | ||
| 89 | + public function getCategory() | ||
| 90 | + { | ||
| 91 | + return $this->category; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Set Category (represented by CATEGORY_*) | ||
| 96 | + * | ||
| 97 | + * @param string $value | ||
| 98 | + * @throws PHPExcel_Calculation_Exception | ||
| 99 | + */ | ||
| 100 | + public function setCategory($value = null) | ||
| 101 | + { | ||
| 102 | + if (!is_null($value)) { | ||
| 103 | + $this->category = $value; | ||
| 104 | + } else { | ||
| 105 | + throw new PHPExcel_Calculation_Exception("Invalid parameter passed."); | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * Get Excel name | ||
| 111 | + * | ||
| 112 | + * @return string | ||
| 113 | + */ | ||
| 114 | + public function getExcelName() | ||
| 115 | + { | ||
| 116 | + return $this->excelName; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * Set Excel name | ||
| 121 | + * | ||
| 122 | + * @param string $value | ||
| 123 | + */ | ||
| 124 | + public function setExcelName($value) | ||
| 125 | + { | ||
| 126 | + $this->excelName = $value; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * Get PHPExcel name | ||
| 131 | + * | ||
| 132 | + * @return string | ||
| 133 | + */ | ||
| 134 | + public function getPHPExcelName() | ||
| 135 | + { | ||
| 136 | + return $this->phpExcelName; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * Set PHPExcel name | ||
| 141 | + * | ||
| 142 | + * @param string $value | ||
| 143 | + */ | ||
| 144 | + public function setPHPExcelName($value) | ||
| 145 | + { | ||
| 146 | + $this->phpExcelName = $value; | ||
| 147 | + } | ||
| 148 | +} |
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Calculation_Token_Stack | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Calculation | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Calculation_Token_Stack | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * The parser stack for formulae | ||
| 32 | + * | ||
| 33 | + * @var mixed[] | ||
| 34 | + */ | ||
| 35 | + private $stack = array(); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Count of entries in the parser stack | ||
| 39 | + * | ||
| 40 | + * @var integer | ||
| 41 | + */ | ||
| 42 | + private $count = 0; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Return the number of entries on the stack | ||
| 46 | + * | ||
| 47 | + * @return integer | ||
| 48 | + */ | ||
| 49 | + public function count() | ||
| 50 | + { | ||
| 51 | + return $this->count; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * Push a new entry onto the stack | ||
| 56 | + * | ||
| 57 | + * @param mixed $type | ||
| 58 | + * @param mixed $value | ||
| 59 | + * @param mixed $reference | ||
| 60 | + */ | ||
| 61 | + public function push($type, $value, $reference = null) | ||
| 62 | + { | ||
| 63 | + $this->stack[$this->count++] = array( | ||
| 64 | + 'type' => $type, | ||
| 65 | + 'value' => $value, | ||
| 66 | + 'reference' => $reference | ||
| 67 | + ); | ||
| 68 | + if ($type == 'Function') { | ||
| 69 | + $localeFunction = PHPExcel_Calculation::localeFunc($value); | ||
| 70 | + if ($localeFunction != $value) { | ||
| 71 | + $this->stack[($this->count - 1)]['localeValue'] = $localeFunction; | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * Pop the last entry from the stack | ||
| 78 | + * | ||
| 79 | + * @return mixed | ||
| 80 | + */ | ||
| 81 | + public function pop() | ||
| 82 | + { | ||
| 83 | + if ($this->count > 0) { | ||
| 84 | + return $this->stack[--$this->count]; | ||
| 85 | + } | ||
| 86 | + return null; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * Return an entry from the stack without removing it | ||
| 91 | + * | ||
| 92 | + * @param integer $n number indicating how far back in the stack we want to look | ||
| 93 | + * @return mixed | ||
| 94 | + */ | ||
| 95 | + public function last($n = 1) | ||
| 96 | + { | ||
| 97 | + if ($this->count - $n < 0) { | ||
| 98 | + return null; | ||
| 99 | + } | ||
| 100 | + return $this->stack[$this->count - $n]; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * Clear the stack | ||
| 105 | + */ | ||
| 106 | + public function clear() | ||
| 107 | + { | ||
| 108 | + $this->stack = array(); | ||
| 109 | + $this->count = 0; | ||
| 110 | + } | ||
| 111 | +} |
| 1 | +ABS | ||
| 2 | +ACCRINT | ||
| 3 | +ACCRINTM | ||
| 4 | +ACOS | ||
| 5 | +ACOSH | ||
| 6 | +ADDRESS | ||
| 7 | +AMORDEGRC | ||
| 8 | +AMORLINC | ||
| 9 | +AND | ||
| 10 | +AREAS | ||
| 11 | +ASC | ||
| 12 | +ASIN | ||
| 13 | +ASINH | ||
| 14 | +ATAN | ||
| 15 | +ATAN2 | ||
| 16 | +ATANH | ||
| 17 | +AVEDEV | ||
| 18 | +AVERAGE | ||
| 19 | +AVERAGEA | ||
| 20 | +AVERAGEIF | ||
| 21 | +AVERAGEIFS | ||
| 22 | +BAHTTEXT | ||
| 23 | +BESSELI | ||
| 24 | +BESSELJ | ||
| 25 | +BESSELK | ||
| 26 | +BESSELY | ||
| 27 | +BETADIST | ||
| 28 | +BETAINV | ||
| 29 | +BIN2DEC | ||
| 30 | +BIN2HEX | ||
| 31 | +BIN2OCT | ||
| 32 | +BINOMDIST | ||
| 33 | +CEILING | ||
| 34 | +CELL | ||
| 35 | +CHAR | ||
| 36 | +CHIDIST | ||
| 37 | +CHIINV | ||
| 38 | +CHITEST | ||
| 39 | +CHOOSE | ||
| 40 | +CLEAN | ||
| 41 | +CODE | ||
| 42 | +COLUMN | ||
| 43 | +COLUMNS | ||
| 44 | +COMBIN | ||
| 45 | +COMPLEX | ||
| 46 | +CONCATENATE | ||
| 47 | +CONFIDENCE | ||
| 48 | +CONVERT | ||
| 49 | +CORREL | ||
| 50 | +COS | ||
| 51 | +COSH | ||
| 52 | +COUNT | ||
| 53 | +COUNTA | ||
| 54 | +COUNTBLANK | ||
| 55 | +COUNTIF | ||
| 56 | +COUNTIFS | ||
| 57 | +COUPDAYBS | ||
| 58 | +COUPDAYBS | ||
| 59 | +COUPDAYSNC | ||
| 60 | +COUPNCD | ||
| 61 | +COUPNUM | ||
| 62 | +COUPPCD | ||
| 63 | +COVAR | ||
| 64 | +CRITBINOM | ||
| 65 | +CUBEKPIMEMBER | ||
| 66 | +CUBEMEMBER | ||
| 67 | +CUBEMEMBERPROPERTY | ||
| 68 | +CUBERANKEDMEMBER | ||
| 69 | +CUBESET | ||
| 70 | +CUBESETCOUNT | ||
| 71 | +CUBEVALUE | ||
| 72 | +CUMIPMT | ||
| 73 | +CUMPRINC | ||
| 74 | +DATE | ||
| 75 | +DATEDIF | ||
| 76 | +DATEVALUE | ||
| 77 | +DAVERAGE | ||
| 78 | +DAY | ||
| 79 | +DAYS360 | ||
| 80 | +DB | ||
| 81 | +DCOUNT | ||
| 82 | +DCOUNTA | ||
| 83 | +DDB | ||
| 84 | +DEC2BIN | ||
| 85 | +DEC2HEX | ||
| 86 | +DEC2OCT | ||
| 87 | +DEGREES | ||
| 88 | +DELTA | ||
| 89 | +DEVSQ | ||
| 90 | +DGET | ||
| 91 | +DISC | ||
| 92 | +DMAX | ||
| 93 | +DMIN | ||
| 94 | +DOLLAR | ||
| 95 | +DOLLARDE | ||
| 96 | +DOLLARFR | ||
| 97 | +DPRODUCT | ||
| 98 | +DSTDEV | ||
| 99 | +DSTDEVP | ||
| 100 | +DSUM | ||
| 101 | +DURATION | ||
| 102 | +DVAR | ||
| 103 | +DVARP | ||
| 104 | +EDATE | ||
| 105 | +EFFECT | ||
| 106 | +EOMONTH | ||
| 107 | +ERF | ||
| 108 | +ERFC | ||
| 109 | +ERROR.TYPE | ||
| 110 | +EVEN | ||
| 111 | +EXACT | ||
| 112 | +EXP | ||
| 113 | +EXPONDIST | ||
| 114 | +FACT | ||
| 115 | +FACTDOUBLE | ||
| 116 | +FALSE | ||
| 117 | +FDIST | ||
| 118 | +FIND | ||
| 119 | +FINDB | ||
| 120 | +FINV | ||
| 121 | +FISHER | ||
| 122 | +FISHERINV | ||
| 123 | +FIXED | ||
| 124 | +FLOOR | ||
| 125 | +FORECAST | ||
| 126 | +FREQUENCY | ||
| 127 | +FTEST | ||
| 128 | +FV | ||
| 129 | +FVSCHEDULE | ||
| 130 | +GAMAMDIST | ||
| 131 | +GAMMAINV | ||
| 132 | +GAMMALN | ||
| 133 | +GCD | ||
| 134 | +GEOMEAN | ||
| 135 | +GESTEP | ||
| 136 | +GETPIVOTDATA | ||
| 137 | +GROWTH | ||
| 138 | +HARMEAN | ||
| 139 | +HEX2BIN | ||
| 140 | +HEX2OCT | ||
| 141 | +HLOOKUP | ||
| 142 | +HOUR | ||
| 143 | +HYPERLINK | ||
| 144 | +HYPGEOMDIST | ||
| 145 | +IF | ||
| 146 | +IFERROR | ||
| 147 | +IMABS | ||
| 148 | +IMAGINARY | ||
| 149 | +IMARGUMENT | ||
| 150 | +IMCONJUGATE | ||
| 151 | +IMCOS | ||
| 152 | +IMEXP | ||
| 153 | +IMLN | ||
| 154 | +IMLOG10 | ||
| 155 | +IMLOG2 | ||
| 156 | +IMPOWER | ||
| 157 | +IMPRODUCT | ||
| 158 | +IMREAL | ||
| 159 | +IMSIN | ||
| 160 | +IMSQRT | ||
| 161 | +IMSUB | ||
| 162 | +IMSUM | ||
| 163 | +INDEX | ||
| 164 | +INDIRECT | ||
| 165 | +INFO | ||
| 166 | +INT | ||
| 167 | +INTERCEPT | ||
| 168 | +INTRATE | ||
| 169 | +IPMT | ||
| 170 | +IRR | ||
| 171 | +ISBLANK | ||
| 172 | +ISERR | ||
| 173 | +ISERROR | ||
| 174 | +ISEVEN | ||
| 175 | +ISLOGICAL | ||
| 176 | +ISNA | ||
| 177 | +ISNONTEXT | ||
| 178 | +ISNUMBER | ||
| 179 | +ISODD | ||
| 180 | +ISPMT | ||
| 181 | +ISREF | ||
| 182 | +ISTEXT | ||
| 183 | +JIS | ||
| 184 | +KURT | ||
| 185 | +LARGE | ||
| 186 | +LCM | ||
| 187 | +LEFT | ||
| 188 | +LEFTB | ||
| 189 | +LEN | ||
| 190 | +LENB | ||
| 191 | +LINEST | ||
| 192 | +LN | ||
| 193 | +LOG | ||
| 194 | +LOG10 | ||
| 195 | +LOGEST | ||
| 196 | +LOGINV | ||
| 197 | +LOGNORMDIST | ||
| 198 | +LOOKUP | ||
| 199 | +LOWER | ||
| 200 | +MATCH | ||
| 201 | +MAX | ||
| 202 | +MAXA | ||
| 203 | +MDETERM | ||
| 204 | +MDURATION | ||
| 205 | +MEDIAN | ||
| 206 | +MID | ||
| 207 | +MIDB | ||
| 208 | +MIN | ||
| 209 | +MINA | ||
| 210 | +MINUTE | ||
| 211 | +MINVERSE | ||
| 212 | +MIRR | ||
| 213 | +MMULT | ||
| 214 | +MOD | ||
| 215 | +MODE | ||
| 216 | +MONTH | ||
| 217 | +MROUND | ||
| 218 | +MULTINOMIAL | ||
| 219 | +N | ||
| 220 | +NA | ||
| 221 | +NEGBINOMDIST | ||
| 222 | +NETWORKDAYS | ||
| 223 | +NOMINAL | ||
| 224 | +NORMDIST | ||
| 225 | +NORMINV | ||
| 226 | +NORMSDIST | ||
| 227 | +NORMSINV | ||
| 228 | +NOT | ||
| 229 | +NOW | ||
| 230 | +NPER | ||
| 231 | +NPV | ||
| 232 | +OCT2BIN | ||
| 233 | +OCT2DEC | ||
| 234 | +OCT2HEX | ||
| 235 | +ODD | ||
| 236 | +ODDFPRICE | ||
| 237 | +ODDFYIELD | ||
| 238 | +ODDLPRICE | ||
| 239 | +ODDLYIELD | ||
| 240 | +OFFSET | ||
| 241 | +OR | ||
| 242 | +PEARSON | ||
| 243 | +PERCENTILE | ||
| 244 | +PERCENTRANK | ||
| 245 | +PERMUT | ||
| 246 | +PHONETIC | ||
| 247 | +PI | ||
| 248 | +PMT | ||
| 249 | +POISSON | ||
| 250 | +POWER | ||
| 251 | +PPMT | ||
| 252 | +PRICE | ||
| 253 | +PRICEDISC | ||
| 254 | +PRICEMAT | ||
| 255 | +PROB | ||
| 256 | +PRODUCT | ||
| 257 | +PROPER | ||
| 258 | +PV | ||
| 259 | +QUARTILE | ||
| 260 | +QUOTIENT | ||
| 261 | +RADIANS | ||
| 262 | +RAND | ||
| 263 | +RANDBETWEEN | ||
| 264 | +RANK | ||
| 265 | +RATE | ||
| 266 | +RECEIVED | ||
| 267 | +REPLACE | ||
| 268 | +REPLACEB | ||
| 269 | +REPT | ||
| 270 | +RIGHT | ||
| 271 | +RIGHTB | ||
| 272 | +ROMAN | ||
| 273 | +ROUND | ||
| 274 | +ROUNDDOWN | ||
| 275 | +ROUNDUP | ||
| 276 | +ROW | ||
| 277 | +ROWS | ||
| 278 | +RSQ | ||
| 279 | +RTD | ||
| 280 | +SEARCH | ||
| 281 | +SEARCHB | ||
| 282 | +SECOND | ||
| 283 | +SERIESSUM | ||
| 284 | +SIGN | ||
| 285 | +SIN | ||
| 286 | +SINH | ||
| 287 | +SKEW | ||
| 288 | +SLN | ||
| 289 | +SLOPE | ||
| 290 | +SMALL | ||
| 291 | +SQRT | ||
| 292 | +SQRTPI | ||
| 293 | +STANDARDIZE | ||
| 294 | +STDEV | ||
| 295 | +STDEVA | ||
| 296 | +STDEVP | ||
| 297 | +STDEVPA | ||
| 298 | +STEYX | ||
| 299 | +SUBSTITUTE | ||
| 300 | +SUBTOTAL | ||
| 301 | +SUM | ||
| 302 | +SUMIF | ||
| 303 | +SUMIFS | ||
| 304 | +SUMPRODUCT | ||
| 305 | +SUMSQ | ||
| 306 | +SUMX2MY2 | ||
| 307 | +SUMX2PY2 | ||
| 308 | +SUMXMY2 | ||
| 309 | +SYD | ||
| 310 | +T | ||
| 311 | +TAN | ||
| 312 | +TANH | ||
| 313 | +TBILLEQ | ||
| 314 | +TBILLPRICE | ||
| 315 | +TBILLYIELD | ||
| 316 | +TDIST | ||
| 317 | +TEXT | ||
| 318 | +TIME | ||
| 319 | +TIMEVALUE | ||
| 320 | +TINV | ||
| 321 | +TODAY | ||
| 322 | +TRANSPOSE | ||
| 323 | +TREND | ||
| 324 | +TRIM | ||
| 325 | +TRIMMEAN | ||
| 326 | +TRUE | ||
| 327 | +TRUNC | ||
| 328 | +TTEST | ||
| 329 | +TYPE | ||
| 330 | +UPPER | ||
| 331 | +USDOLLAR | ||
| 332 | +VALUE | ||
| 333 | +VAR | ||
| 334 | +VARA | ||
| 335 | +VARP | ||
| 336 | +VARPA | ||
| 337 | +VDB | ||
| 338 | +VERSION | ||
| 339 | +VLOOKUP | ||
| 340 | +WEEKDAY | ||
| 341 | +WEEKNUM | ||
| 342 | +WEIBULL | ||
| 343 | +WORKDAY | ||
| 344 | +XIRR | ||
| 345 | +XNPV | ||
| 346 | +YEAR | ||
| 347 | +YEARFRAC | ||
| 348 | +YIELD | ||
| 349 | +YIELDDISC | ||
| 350 | +YIELDMAT | ||
| 351 | +ZTEST |
PHPExcel_Croe/PHPExcel/Cell.php
0 → 100755
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** PHPExcel root directory */ | ||
| 4 | +if (!defined('PHPEXCEL_ROOT')) { | ||
| 5 | + /** | ||
| 6 | + * @ignore | ||
| 7 | + */ | ||
| 8 | + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); | ||
| 9 | + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * PHPExcel_Cell_AdvancedValueBinder | ||
| 14 | + * | ||
| 15 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 16 | + * | ||
| 17 | + * This library is free software; you can redistribute it and/or | ||
| 18 | + * modify it under the terms of the GNU Lesser General Public | ||
| 19 | + * License as published by the Free Software Foundation; either | ||
| 20 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 21 | + * | ||
| 22 | + * This library is distributed in the hope that it will be useful, | ||
| 23 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 25 | + * Lesser General Public License for more details. | ||
| 26 | + * | ||
| 27 | + * You should have received a copy of the GNU Lesser General Public | ||
| 28 | + * License along with this library; if not, write to the Free Software | ||
| 29 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | + * | ||
| 31 | + * @category PHPExcel | ||
| 32 | + * @package PHPExcel_Cell | ||
| 33 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 34 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 35 | + * @version ##VERSION##, ##DATE## | ||
| 36 | + */ | ||
| 37 | +class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder | ||
| 38 | +{ | ||
| 39 | + /** | ||
| 40 | + * Bind value to a cell | ||
| 41 | + * | ||
| 42 | + * @param PHPExcel_Cell $cell Cell to bind value to | ||
| 43 | + * @param mixed $value Value to bind in cell | ||
| 44 | + * @return boolean | ||
| 45 | + */ | ||
| 46 | + public function bindValue(PHPExcel_Cell $cell, $value = null) | ||
| 47 | + { | ||
| 48 | + // sanitize UTF-8 strings | ||
| 49 | + if (is_string($value)) { | ||
| 50 | + $value = PHPExcel_Shared_String::SanitizeUTF8($value); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + // Find out data type | ||
| 54 | + $dataType = parent::dataTypeForValue($value); | ||
| 55 | + | ||
| 56 | + // Style logic - strings | ||
| 57 | + if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { | ||
| 58 | + // Test for booleans using locale-setting | ||
| 59 | + if ($value == PHPExcel_Calculation::getTRUE()) { | ||
| 60 | + $cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL); | ||
| 61 | + return true; | ||
| 62 | + } elseif ($value == PHPExcel_Calculation::getFALSE()) { | ||
| 63 | + $cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL); | ||
| 64 | + return true; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + // Check for number in scientific format | ||
| 68 | + if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { | ||
| 69 | + $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + // Check for fraction | ||
| 74 | + if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) { | ||
| 75 | + // Convert value to number | ||
| 76 | + $value = $matches[2] / $matches[3]; | ||
| 77 | + if ($matches[1] == '-') { | ||
| 78 | + $value = 0 - $value; | ||
| 79 | + } | ||
| 80 | + $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 81 | + // Set style | ||
| 82 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 83 | + ->getNumberFormat()->setFormatCode('??/??'); | ||
| 84 | + return true; | ||
| 85 | + } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) { | ||
| 86 | + // Convert value to number | ||
| 87 | + $value = $matches[2] + ($matches[3] / $matches[4]); | ||
| 88 | + if ($matches[1] == '-') { | ||
| 89 | + $value = 0 - $value; | ||
| 90 | + } | ||
| 91 | + $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 92 | + // Set style | ||
| 93 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 94 | + ->getNumberFormat()->setFormatCode('# ??/??'); | ||
| 95 | + return true; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // Check for percentage | ||
| 99 | + if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) { | ||
| 100 | + // Convert value to number | ||
| 101 | + $value = (float) str_replace('%', '', $value) / 100; | ||
| 102 | + $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 103 | + // Set style | ||
| 104 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 105 | + ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); | ||
| 106 | + return true; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + // Check for currency | ||
| 110 | + $currencyCode = PHPExcel_Shared_String::getCurrencyCode(); | ||
| 111 | + $decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator(); | ||
| 112 | + $thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator(); | ||
| 113 | + if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) { | ||
| 114 | + // Convert value to number | ||
| 115 | + $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value)); | ||
| 116 | + $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 117 | + // Set style | ||
| 118 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 119 | + ->getNumberFormat()->setFormatCode( | ||
| 120 | + str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE) | ||
| 121 | + ); | ||
| 122 | + return true; | ||
| 123 | + } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { | ||
| 124 | + // Convert value to number | ||
| 125 | + $value = (float) trim(str_replace(array('$',','), '', $value)); | ||
| 126 | + $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 127 | + // Set style | ||
| 128 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 129 | + ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); | ||
| 130 | + return true; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + // Check for time without seconds e.g. '9:45', '09:45' | ||
| 134 | + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { | ||
| 135 | + // Convert value to number | ||
| 136 | + list($h, $m) = explode(':', $value); | ||
| 137 | + $days = $h / 24 + $m / 1440; | ||
| 138 | + $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 139 | + // Set style | ||
| 140 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 141 | + ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3); | ||
| 142 | + return true; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + // Check for time with seconds '9:45:59', '09:45:59' | ||
| 146 | + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) { | ||
| 147 | + // Convert value to number | ||
| 148 | + list($h, $m, $s) = explode(':', $value); | ||
| 149 | + $days = $h / 24 + $m / 1440 + $s / 86400; | ||
| 150 | + // Convert value to number | ||
| 151 | + $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 152 | + // Set style | ||
| 153 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 154 | + ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4); | ||
| 155 | + return true; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' | ||
| 159 | + if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) { | ||
| 160 | + // Convert value to number | ||
| 161 | + $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC); | ||
| 162 | + // Determine style. Either there is a time part or not. Look for ':' | ||
| 163 | + if (strpos($value, ':') !== false) { | ||
| 164 | + $formatCode = 'yyyy-mm-dd h:mm'; | ||
| 165 | + } else { | ||
| 166 | + $formatCode = 'yyyy-mm-dd'; | ||
| 167 | + } | ||
| 168 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 169 | + ->getNumberFormat()->setFormatCode($formatCode); | ||
| 170 | + return true; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + // Check for newline character "\n" | ||
| 174 | + if (strpos($value, "\n") !== false) { | ||
| 175 | + $value = PHPExcel_Shared_String::SanitizeUTF8($value); | ||
| 176 | + $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); | ||
| 177 | + // Set style | ||
| 178 | + $cell->getWorksheet()->getStyle($cell->getCoordinate()) | ||
| 179 | + ->getAlignment()->setWrapText(true); | ||
| 180 | + return true; | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + // Not bound yet? Use parent... | ||
| 185 | + return parent::bindValue($cell, $value); | ||
| 186 | + } | ||
| 187 | +} |
PHPExcel_Croe/PHPExcel/Cell/DataType.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Cell_DataType | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Cell | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Cell_DataType | ||
| 29 | +{ | ||
| 30 | + /* Data types */ | ||
| 31 | + const TYPE_STRING2 = 'str'; | ||
| 32 | + const TYPE_STRING = 's'; | ||
| 33 | + const TYPE_FORMULA = 'f'; | ||
| 34 | + const TYPE_NUMERIC = 'n'; | ||
| 35 | + const TYPE_BOOL = 'b'; | ||
| 36 | + const TYPE_NULL = 'null'; | ||
| 37 | + const TYPE_INLINE = 'inlineStr'; | ||
| 38 | + const TYPE_ERROR = 'e'; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * List of error codes | ||
| 42 | + * | ||
| 43 | + * @var array | ||
| 44 | + */ | ||
| 45 | + private static $errorCodes = array( | ||
| 46 | + '#NULL!' => 0, | ||
| 47 | + '#DIV/0!' => 1, | ||
| 48 | + '#VALUE!' => 2, | ||
| 49 | + '#REF!' => 3, | ||
| 50 | + '#NAME?' => 4, | ||
| 51 | + '#NUM!' => 5, | ||
| 52 | + '#N/A' => 6 | ||
| 53 | + ); | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Get list of error codes | ||
| 57 | + * | ||
| 58 | + * @return array | ||
| 59 | + */ | ||
| 60 | + public static function getErrorCodes() | ||
| 61 | + { | ||
| 62 | + return self::$errorCodes; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * DataType for value | ||
| 67 | + * | ||
| 68 | + * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0 | ||
| 69 | + * @param mixed $pValue | ||
| 70 | + * @return string | ||
| 71 | + */ | ||
| 72 | + public static function dataTypeForValue($pValue = null) | ||
| 73 | + { | ||
| 74 | + return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * Check a string that it satisfies Excel requirements | ||
| 79 | + * | ||
| 80 | + * @param mixed Value to sanitize to an Excel string | ||
| 81 | + * @return mixed Sanitized value | ||
| 82 | + */ | ||
| 83 | + public static function checkString($pValue = null) | ||
| 84 | + { | ||
| 85 | + if ($pValue instanceof PHPExcel_RichText) { | ||
| 86 | + // TODO: Sanitize Rich-Text string (max. character count is 32,767) | ||
| 87 | + return $pValue; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + // string must never be longer than 32,767 characters, truncate if necessary | ||
| 91 | + $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767); | ||
| 92 | + | ||
| 93 | + // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" | ||
| 94 | + $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); | ||
| 95 | + | ||
| 96 | + return $pValue; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * Check a value that it is a valid error code | ||
| 101 | + * | ||
| 102 | + * @param mixed Value to sanitize to an Excel error code | ||
| 103 | + * @return string Sanitized value | ||
| 104 | + */ | ||
| 105 | + public static function checkErrorCode($pValue = null) | ||
| 106 | + { | ||
| 107 | + $pValue = (string) $pValue; | ||
| 108 | + | ||
| 109 | + if (!array_key_exists($pValue, self::$errorCodes)) { | ||
| 110 | + $pValue = '#NULL!'; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return $pValue; | ||
| 114 | + } | ||
| 115 | +} |
此文件的差异被折叠,
点击展开。
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** PHPExcel root directory */ | ||
| 4 | +if (!defined('PHPEXCEL_ROOT')) { | ||
| 5 | + /** | ||
| 6 | + * @ignore | ||
| 7 | + */ | ||
| 8 | + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); | ||
| 9 | + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * PHPExcel_Cell_DefaultValueBinder | ||
| 14 | + * | ||
| 15 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 16 | + * | ||
| 17 | + * This library is free software; you can redistribute it and/or | ||
| 18 | + * modify it under the terms of the GNU Lesser General Public | ||
| 19 | + * License as published by the Free Software Foundation; either | ||
| 20 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 21 | + * | ||
| 22 | + * This library is distributed in the hope that it will be useful, | ||
| 23 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 25 | + * Lesser General Public License for more details. | ||
| 26 | + * | ||
| 27 | + * You should have received a copy of the GNU Lesser General Public | ||
| 28 | + * License along with this library; if not, write to the Free Software | ||
| 29 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | + * | ||
| 31 | + * @category PHPExcel | ||
| 32 | + * @package PHPExcel_Cell | ||
| 33 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 34 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 35 | + * @version ##VERSION##, ##DATE## | ||
| 36 | + */ | ||
| 37 | +class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder | ||
| 38 | +{ | ||
| 39 | + /** | ||
| 40 | + * Bind value to a cell | ||
| 41 | + * | ||
| 42 | + * @param PHPExcel_Cell $cell Cell to bind value to | ||
| 43 | + * @param mixed $value Value to bind in cell | ||
| 44 | + * @return boolean | ||
| 45 | + */ | ||
| 46 | + public function bindValue(PHPExcel_Cell $cell, $value = null) | ||
| 47 | + { | ||
| 48 | + // sanitize UTF-8 strings | ||
| 49 | + if (is_string($value)) { | ||
| 50 | + $value = PHPExcel_Shared_String::SanitizeUTF8($value); | ||
| 51 | + } elseif (is_object($value)) { | ||
| 52 | + // Handle any objects that might be injected | ||
| 53 | + if ($value instanceof DateTime) { | ||
| 54 | + $value = $value->format('Y-m-d H:i:s'); | ||
| 55 | + } elseif (!($value instanceof PHPExcel_RichText)) { | ||
| 56 | + $value = (string) $value; | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + // Set value explicit | ||
| 61 | + $cell->setValueExplicit($value, self::dataTypeForValue($value)); | ||
| 62 | + | ||
| 63 | + // Done! | ||
| 64 | + return true; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * DataType for value | ||
| 69 | + * | ||
| 70 | + * @param mixed $pValue | ||
| 71 | + * @return string | ||
| 72 | + */ | ||
| 73 | + public static function dataTypeForValue($pValue = null) | ||
| 74 | + { | ||
| 75 | + // Match the value against a few data types | ||
| 76 | + if ($pValue === null) { | ||
| 77 | + return PHPExcel_Cell_DataType::TYPE_NULL; | ||
| 78 | + } elseif ($pValue === '') { | ||
| 79 | + return PHPExcel_Cell_DataType::TYPE_STRING; | ||
| 80 | + } elseif ($pValue instanceof PHPExcel_RichText) { | ||
| 81 | + return PHPExcel_Cell_DataType::TYPE_INLINE; | ||
| 82 | + } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { | ||
| 83 | + return PHPExcel_Cell_DataType::TYPE_FORMULA; | ||
| 84 | + } elseif (is_bool($pValue)) { | ||
| 85 | + return PHPExcel_Cell_DataType::TYPE_BOOL; | ||
| 86 | + } elseif (is_float($pValue) || is_int($pValue)) { | ||
| 87 | + return PHPExcel_Cell_DataType::TYPE_NUMERIC; | ||
| 88 | + } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) { | ||
| 89 | + $tValue = ltrim($pValue, '+-'); | ||
| 90 | + if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') { | ||
| 91 | + return PHPExcel_Cell_DataType::TYPE_STRING; | ||
| 92 | + } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) { | ||
| 93 | + return PHPExcel_Cell_DataType::TYPE_STRING; | ||
| 94 | + } | ||
| 95 | + return PHPExcel_Cell_DataType::TYPE_NUMERIC; | ||
| 96 | + } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { | ||
| 97 | + return PHPExcel_Cell_DataType::TYPE_ERROR; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + return PHPExcel_Cell_DataType::TYPE_STRING; | ||
| 101 | + } | ||
| 102 | +} |
PHPExcel_Croe/PHPExcel/Cell/Hyperlink.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Cell_Hyperlink | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Cell | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Cell_Hyperlink | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * URL to link the cell to | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + private $url; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Tooltip to display on the hyperlink | ||
| 39 | + * | ||
| 40 | + * @var string | ||
| 41 | + */ | ||
| 42 | + private $tooltip; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Create a new PHPExcel_Cell_Hyperlink | ||
| 46 | + * | ||
| 47 | + * @param string $pUrl Url to link the cell to | ||
| 48 | + * @param string $pTooltip Tooltip to display on the hyperlink | ||
| 49 | + */ | ||
| 50 | + public function __construct($pUrl = '', $pTooltip = '') | ||
| 51 | + { | ||
| 52 | + // Initialise member variables | ||
| 53 | + $this->url = $pUrl; | ||
| 54 | + $this->tooltip = $pTooltip; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Get URL | ||
| 59 | + * | ||
| 60 | + * @return string | ||
| 61 | + */ | ||
| 62 | + public function getUrl() | ||
| 63 | + { | ||
| 64 | + return $this->url; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * Set URL | ||
| 69 | + * | ||
| 70 | + * @param string $value | ||
| 71 | + * @return PHPExcel_Cell_Hyperlink | ||
| 72 | + */ | ||
| 73 | + public function setUrl($value = '') | ||
| 74 | + { | ||
| 75 | + $this->url = $value; | ||
| 76 | + return $this; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * Get tooltip | ||
| 81 | + * | ||
| 82 | + * @return string | ||
| 83 | + */ | ||
| 84 | + public function getTooltip() | ||
| 85 | + { | ||
| 86 | + return $this->tooltip; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * Set tooltip | ||
| 91 | + * | ||
| 92 | + * @param string $value | ||
| 93 | + * @return PHPExcel_Cell_Hyperlink | ||
| 94 | + */ | ||
| 95 | + public function setTooltip($value = '') | ||
| 96 | + { | ||
| 97 | + $this->tooltip = $value; | ||
| 98 | + return $this; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * Is this hyperlink internal? (to another worksheet) | ||
| 103 | + * | ||
| 104 | + * @return boolean | ||
| 105 | + */ | ||
| 106 | + public function isInternal() | ||
| 107 | + { | ||
| 108 | + return strpos($this->url, 'sheet://') !== false; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * Get hash code | ||
| 113 | + * | ||
| 114 | + * @return string Hash code | ||
| 115 | + */ | ||
| 116 | + public function getHashCode() | ||
| 117 | + { | ||
| 118 | + return md5( | ||
| 119 | + $this->url . | ||
| 120 | + $this->tooltip . | ||
| 121 | + __CLASS__ | ||
| 122 | + ); | ||
| 123 | + } | ||
| 124 | +} |
PHPExcel_Croe/PHPExcel/Cell/IValueBinder.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Cell | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * PHPExcel_Cell_IValueBinder | ||
| 32 | + * | ||
| 33 | + * @category PHPExcel | ||
| 34 | + * @package PHPExcel_Cell | ||
| 35 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 36 | + */ | ||
| 37 | +interface PHPExcel_Cell_IValueBinder | ||
| 38 | +{ | ||
| 39 | + /** | ||
| 40 | + * Bind value to a cell | ||
| 41 | + * | ||
| 42 | + * @param PHPExcel_Cell $cell Cell to bind value to | ||
| 43 | + * @param mixed $value Value to bind in cell | ||
| 44 | + * @return boolean | ||
| 45 | + */ | ||
| 46 | + public function bindValue(PHPExcel_Cell $cell, $value = null); | ||
| 47 | +} |
PHPExcel_Croe/PHPExcel/Chart.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/Axis.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/DataSeries.php
0 → 100755
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * PHPExcel | ||
| 4 | + * | ||
| 5 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 6 | + * | ||
| 7 | + * This library is free software; you can redistribute it and/or | ||
| 8 | + * modify it under the terms of the GNU Lesser General Public | ||
| 9 | + * License as published by the Free Software Foundation; either | ||
| 10 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | + * | ||
| 12 | + * This library is distributed in the hope that it will be useful, | ||
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | + * Lesser General Public License for more details. | ||
| 16 | + * | ||
| 17 | + * You should have received a copy of the GNU Lesser General Public | ||
| 18 | + * License along with this library; if not, write to the Free Software | ||
| 19 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * @category PHPExcel | ||
| 22 | + * @package PHPExcel_Chart | ||
| 23 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 24 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 25 | + * @version ##VERSION##, ##DATE## | ||
| 26 | + */ | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * PHPExcel_Chart_DataSeries | ||
| 31 | + * | ||
| 32 | + * @category PHPExcel | ||
| 33 | + * @package PHPExcel_Chart | ||
| 34 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 35 | + */ | ||
| 36 | +class PHPExcel_Chart_DataSeries | ||
| 37 | +{ | ||
| 38 | + const TYPE_BARCHART = 'barChart'; | ||
| 39 | + const TYPE_BARCHART_3D = 'bar3DChart'; | ||
| 40 | + const TYPE_LINECHART = 'lineChart'; | ||
| 41 | + const TYPE_LINECHART_3D = 'line3DChart'; | ||
| 42 | + const TYPE_AREACHART = 'areaChart'; | ||
| 43 | + const TYPE_AREACHART_3D = 'area3DChart'; | ||
| 44 | + const TYPE_PIECHART = 'pieChart'; | ||
| 45 | + const TYPE_PIECHART_3D = 'pie3DChart'; | ||
| 46 | + const TYPE_DOUGHTNUTCHART = 'doughnutChart'; | ||
| 47 | + const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym | ||
| 48 | + const TYPE_SCATTERCHART = 'scatterChart'; | ||
| 49 | + const TYPE_SURFACECHART = 'surfaceChart'; | ||
| 50 | + const TYPE_SURFACECHART_3D = 'surface3DChart'; | ||
| 51 | + const TYPE_RADARCHART = 'radarChart'; | ||
| 52 | + const TYPE_BUBBLECHART = 'bubbleChart'; | ||
| 53 | + const TYPE_STOCKCHART = 'stockChart'; | ||
| 54 | + const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym | ||
| 55 | + | ||
| 56 | + const GROUPING_CLUSTERED = 'clustered'; | ||
| 57 | + const GROUPING_STACKED = 'stacked'; | ||
| 58 | + const GROUPING_PERCENT_STACKED = 'percentStacked'; | ||
| 59 | + const GROUPING_STANDARD = 'standard'; | ||
| 60 | + | ||
| 61 | + const DIRECTION_BAR = 'bar'; | ||
| 62 | + const DIRECTION_HORIZONTAL = self::DIRECTION_BAR; | ||
| 63 | + const DIRECTION_COL = 'col'; | ||
| 64 | + const DIRECTION_COLUMN = self::DIRECTION_COL; | ||
| 65 | + const DIRECTION_VERTICAL = self::DIRECTION_COL; | ||
| 66 | + | ||
| 67 | + const STYLE_LINEMARKER = 'lineMarker'; | ||
| 68 | + const STYLE_SMOOTHMARKER = 'smoothMarker'; | ||
| 69 | + const STYLE_MARKER = 'marker'; | ||
| 70 | + const STYLE_FILLED = 'filled'; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * Series Plot Type | ||
| 75 | + * | ||
| 76 | + * @var string | ||
| 77 | + */ | ||
| 78 | + private $plotType; | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * Plot Grouping Type | ||
| 82 | + * | ||
| 83 | + * @var boolean | ||
| 84 | + */ | ||
| 85 | + private $plotGrouping; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * Plot Direction | ||
| 89 | + * | ||
| 90 | + * @var boolean | ||
| 91 | + */ | ||
| 92 | + private $plotDirection; | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Plot Style | ||
| 96 | + * | ||
| 97 | + * @var string | ||
| 98 | + */ | ||
| 99 | + private $plotStyle; | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * Order of plots in Series | ||
| 103 | + * | ||
| 104 | + * @var array of integer | ||
| 105 | + */ | ||
| 106 | + private $plotOrder = array(); | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * Plot Label | ||
| 110 | + * | ||
| 111 | + * @var array of PHPExcel_Chart_DataSeriesValues | ||
| 112 | + */ | ||
| 113 | + private $plotLabel = array(); | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * Plot Category | ||
| 117 | + * | ||
| 118 | + * @var array of PHPExcel_Chart_DataSeriesValues | ||
| 119 | + */ | ||
| 120 | + private $plotCategory = array(); | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * Smooth Line | ||
| 124 | + * | ||
| 125 | + * @var string | ||
| 126 | + */ | ||
| 127 | + private $smoothLine; | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * Plot Values | ||
| 131 | + * | ||
| 132 | + * @var array of PHPExcel_Chart_DataSeriesValues | ||
| 133 | + */ | ||
| 134 | + private $plotValues = array(); | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Create a new PHPExcel_Chart_DataSeries | ||
| 138 | + */ | ||
| 139 | + public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null) | ||
| 140 | + { | ||
| 141 | + $this->plotType = $plotType; | ||
| 142 | + $this->plotGrouping = $plotGrouping; | ||
| 143 | + $this->plotOrder = $plotOrder; | ||
| 144 | + $keys = array_keys($plotValues); | ||
| 145 | + $this->plotValues = $plotValues; | ||
| 146 | + if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { | ||
| 147 | + $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + $this->plotLabel = $plotLabel; | ||
| 151 | + if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { | ||
| 152 | + $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); | ||
| 153 | + } | ||
| 154 | + $this->plotCategory = $plotCategory; | ||
| 155 | + $this->smoothLine = $smoothLine; | ||
| 156 | + $this->plotStyle = $plotStyle; | ||
| 157 | + | ||
| 158 | + if (is_null($plotDirection)) { | ||
| 159 | + $plotDirection = self::DIRECTION_COL; | ||
| 160 | + } | ||
| 161 | + $this->plotDirection = $plotDirection; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + /** | ||
| 165 | + * Get Plot Type | ||
| 166 | + * | ||
| 167 | + * @return string | ||
| 168 | + */ | ||
| 169 | + public function getPlotType() | ||
| 170 | + { | ||
| 171 | + return $this->plotType; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * Set Plot Type | ||
| 176 | + * | ||
| 177 | + * @param string $plotType | ||
| 178 | + * @return PHPExcel_Chart_DataSeries | ||
| 179 | + */ | ||
| 180 | + public function setPlotType($plotType = '') | ||
| 181 | + { | ||
| 182 | + $this->plotType = $plotType; | ||
| 183 | + return $this; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + /** | ||
| 187 | + * Get Plot Grouping Type | ||
| 188 | + * | ||
| 189 | + * @return string | ||
| 190 | + */ | ||
| 191 | + public function getPlotGrouping() | ||
| 192 | + { | ||
| 193 | + return $this->plotGrouping; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 197 | + * Set Plot Grouping Type | ||
| 198 | + * | ||
| 199 | + * @param string $groupingType | ||
| 200 | + * @return PHPExcel_Chart_DataSeries | ||
| 201 | + */ | ||
| 202 | + public function setPlotGrouping($groupingType = null) | ||
| 203 | + { | ||
| 204 | + $this->plotGrouping = $groupingType; | ||
| 205 | + return $this; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * Get Plot Direction | ||
| 210 | + * | ||
| 211 | + * @return string | ||
| 212 | + */ | ||
| 213 | + public function getPlotDirection() | ||
| 214 | + { | ||
| 215 | + return $this->plotDirection; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + /** | ||
| 219 | + * Set Plot Direction | ||
| 220 | + * | ||
| 221 | + * @param string $plotDirection | ||
| 222 | + * @return PHPExcel_Chart_DataSeries | ||
| 223 | + */ | ||
| 224 | + public function setPlotDirection($plotDirection = null) | ||
| 225 | + { | ||
| 226 | + $this->plotDirection = $plotDirection; | ||
| 227 | + return $this; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + /** | ||
| 231 | + * Get Plot Order | ||
| 232 | + * | ||
| 233 | + * @return string | ||
| 234 | + */ | ||
| 235 | + public function getPlotOrder() | ||
| 236 | + { | ||
| 237 | + return $this->plotOrder; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + /** | ||
| 241 | + * Get Plot Labels | ||
| 242 | + * | ||
| 243 | + * @return array of PHPExcel_Chart_DataSeriesValues | ||
| 244 | + */ | ||
| 245 | + public function getPlotLabels() | ||
| 246 | + { | ||
| 247 | + return $this->plotLabel; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * Get Plot Label by Index | ||
| 252 | + * | ||
| 253 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 254 | + */ | ||
| 255 | + public function getPlotLabelByIndex($index) | ||
| 256 | + { | ||
| 257 | + $keys = array_keys($this->plotLabel); | ||
| 258 | + if (in_array($index, $keys)) { | ||
| 259 | + return $this->plotLabel[$index]; | ||
| 260 | + } elseif (isset($keys[$index])) { | ||
| 261 | + return $this->plotLabel[$keys[$index]]; | ||
| 262 | + } | ||
| 263 | + return false; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + /** | ||
| 267 | + * Get Plot Categories | ||
| 268 | + * | ||
| 269 | + * @return array of PHPExcel_Chart_DataSeriesValues | ||
| 270 | + */ | ||
| 271 | + public function getPlotCategories() | ||
| 272 | + { | ||
| 273 | + return $this->plotCategory; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + /** | ||
| 277 | + * Get Plot Category by Index | ||
| 278 | + * | ||
| 279 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 280 | + */ | ||
| 281 | + public function getPlotCategoryByIndex($index) | ||
| 282 | + { | ||
| 283 | + $keys = array_keys($this->plotCategory); | ||
| 284 | + if (in_array($index, $keys)) { | ||
| 285 | + return $this->plotCategory[$index]; | ||
| 286 | + } elseif (isset($keys[$index])) { | ||
| 287 | + return $this->plotCategory[$keys[$index]]; | ||
| 288 | + } | ||
| 289 | + return false; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * Get Plot Style | ||
| 294 | + * | ||
| 295 | + * @return string | ||
| 296 | + */ | ||
| 297 | + public function getPlotStyle() | ||
| 298 | + { | ||
| 299 | + return $this->plotStyle; | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + /** | ||
| 303 | + * Set Plot Style | ||
| 304 | + * | ||
| 305 | + * @param string $plotStyle | ||
| 306 | + * @return PHPExcel_Chart_DataSeries | ||
| 307 | + */ | ||
| 308 | + public function setPlotStyle($plotStyle = null) | ||
| 309 | + { | ||
| 310 | + $this->plotStyle = $plotStyle; | ||
| 311 | + return $this; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + /** | ||
| 315 | + * Get Plot Values | ||
| 316 | + * | ||
| 317 | + * @return array of PHPExcel_Chart_DataSeriesValues | ||
| 318 | + */ | ||
| 319 | + public function getPlotValues() | ||
| 320 | + { | ||
| 321 | + return $this->plotValues; | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + /** | ||
| 325 | + * Get Plot Values by Index | ||
| 326 | + * | ||
| 327 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 328 | + */ | ||
| 329 | + public function getPlotValuesByIndex($index) | ||
| 330 | + { | ||
| 331 | + $keys = array_keys($this->plotValues); | ||
| 332 | + if (in_array($index, $keys)) { | ||
| 333 | + return $this->plotValues[$index]; | ||
| 334 | + } elseif (isset($keys[$index])) { | ||
| 335 | + return $this->plotValues[$keys[$index]]; | ||
| 336 | + } | ||
| 337 | + return false; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + /** | ||
| 341 | + * Get Number of Plot Series | ||
| 342 | + * | ||
| 343 | + * @return integer | ||
| 344 | + */ | ||
| 345 | + public function getPlotSeriesCount() | ||
| 346 | + { | ||
| 347 | + return count($this->plotValues); | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + /** | ||
| 351 | + * Get Smooth Line | ||
| 352 | + * | ||
| 353 | + * @return boolean | ||
| 354 | + */ | ||
| 355 | + public function getSmoothLine() | ||
| 356 | + { | ||
| 357 | + return $this->smoothLine; | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + /** | ||
| 361 | + * Set Smooth Line | ||
| 362 | + * | ||
| 363 | + * @param boolean $smoothLine | ||
| 364 | + * @return PHPExcel_Chart_DataSeries | ||
| 365 | + */ | ||
| 366 | + public function setSmoothLine($smoothLine = true) | ||
| 367 | + { | ||
| 368 | + $this->smoothLine = $smoothLine; | ||
| 369 | + return $this; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + public function refresh(PHPExcel_Worksheet $worksheet) | ||
| 373 | + { | ||
| 374 | + foreach ($this->plotValues as $plotValues) { | ||
| 375 | + if ($plotValues !== null) { | ||
| 376 | + $plotValues->refresh($worksheet, true); | ||
| 377 | + } | ||
| 378 | + } | ||
| 379 | + foreach ($this->plotLabel as $plotValues) { | ||
| 380 | + if ($plotValues !== null) { | ||
| 381 | + $plotValues->refresh($worksheet, true); | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + foreach ($this->plotCategory as $plotValues) { | ||
| 385 | + if ($plotValues !== null) { | ||
| 386 | + $plotValues->refresh($worksheet, false); | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + } | ||
| 390 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Chart_DataSeriesValues | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Chart | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Chart_DataSeriesValues | ||
| 29 | +{ | ||
| 30 | + | ||
| 31 | + const DATASERIES_TYPE_STRING = 'String'; | ||
| 32 | + const DATASERIES_TYPE_NUMBER = 'Number'; | ||
| 33 | + | ||
| 34 | + private static $dataTypeValues = array( | ||
| 35 | + self::DATASERIES_TYPE_STRING, | ||
| 36 | + self::DATASERIES_TYPE_NUMBER, | ||
| 37 | + ); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Series Data Type | ||
| 41 | + * | ||
| 42 | + * @var string | ||
| 43 | + */ | ||
| 44 | + private $dataType; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Series Data Source | ||
| 48 | + * | ||
| 49 | + * @var string | ||
| 50 | + */ | ||
| 51 | + private $dataSource; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Format Code | ||
| 55 | + * | ||
| 56 | + * @var string | ||
| 57 | + */ | ||
| 58 | + private $formatCode; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * Series Point Marker | ||
| 62 | + * | ||
| 63 | + * @var string | ||
| 64 | + */ | ||
| 65 | + private $pointMarker; | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * Point Count (The number of datapoints in the dataseries) | ||
| 69 | + * | ||
| 70 | + * @var integer | ||
| 71 | + */ | ||
| 72 | + private $pointCount = 0; | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * Data Values | ||
| 76 | + * | ||
| 77 | + * @var array of mixed | ||
| 78 | + */ | ||
| 79 | + private $dataValues = array(); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * Create a new PHPExcel_Chart_DataSeriesValues object | ||
| 83 | + */ | ||
| 84 | + public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) | ||
| 85 | + { | ||
| 86 | + $this->setDataType($dataType); | ||
| 87 | + $this->dataSource = $dataSource; | ||
| 88 | + $this->formatCode = $formatCode; | ||
| 89 | + $this->pointCount = $pointCount; | ||
| 90 | + $this->dataValues = $dataValues; | ||
| 91 | + $this->pointMarker = $marker; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Get Series Data Type | ||
| 96 | + * | ||
| 97 | + * @return string | ||
| 98 | + */ | ||
| 99 | + public function getDataType() | ||
| 100 | + { | ||
| 101 | + return $this->dataType; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * Set Series Data Type | ||
| 106 | + * | ||
| 107 | + * @param string $dataType Datatype of this data series | ||
| 108 | + * Typical values are: | ||
| 109 | + * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING | ||
| 110 | + * Normally used for axis point values | ||
| 111 | + * PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER | ||
| 112 | + * Normally used for chart data values | ||
| 113 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 114 | + */ | ||
| 115 | + public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) | ||
| 116 | + { | ||
| 117 | + if (!in_array($dataType, self::$dataTypeValues)) { | ||
| 118 | + throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); | ||
| 119 | + } | ||
| 120 | + $this->dataType = $dataType; | ||
| 121 | + | ||
| 122 | + return $this; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * Get Series Data Source (formula) | ||
| 127 | + * | ||
| 128 | + * @return string | ||
| 129 | + */ | ||
| 130 | + public function getDataSource() | ||
| 131 | + { | ||
| 132 | + return $this->dataSource; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * Set Series Data Source (formula) | ||
| 137 | + * | ||
| 138 | + * @param string $dataSource | ||
| 139 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 140 | + */ | ||
| 141 | + public function setDataSource($dataSource = null, $refreshDataValues = true) | ||
| 142 | + { | ||
| 143 | + $this->dataSource = $dataSource; | ||
| 144 | + | ||
| 145 | + if ($refreshDataValues) { | ||
| 146 | + // TO DO | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + return $this; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + /** | ||
| 153 | + * Get Point Marker | ||
| 154 | + * | ||
| 155 | + * @return string | ||
| 156 | + */ | ||
| 157 | + public function getPointMarker() | ||
| 158 | + { | ||
| 159 | + return $this->pointMarker; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * Set Point Marker | ||
| 164 | + * | ||
| 165 | + * @param string $marker | ||
| 166 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 167 | + */ | ||
| 168 | + public function setPointMarker($marker = null) | ||
| 169 | + { | ||
| 170 | + $this->pointMarker = $marker; | ||
| 171 | + | ||
| 172 | + return $this; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * Get Series Format Code | ||
| 177 | + * | ||
| 178 | + * @return string | ||
| 179 | + */ | ||
| 180 | + public function getFormatCode() | ||
| 181 | + { | ||
| 182 | + return $this->formatCode; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * Set Series Format Code | ||
| 187 | + * | ||
| 188 | + * @param string $formatCode | ||
| 189 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 190 | + */ | ||
| 191 | + public function setFormatCode($formatCode = null) | ||
| 192 | + { | ||
| 193 | + $this->formatCode = $formatCode; | ||
| 194 | + | ||
| 195 | + return $this; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + /** | ||
| 199 | + * Get Series Point Count | ||
| 200 | + * | ||
| 201 | + * @return integer | ||
| 202 | + */ | ||
| 203 | + public function getPointCount() | ||
| 204 | + { | ||
| 205 | + return $this->pointCount; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * Identify if the Data Series is a multi-level or a simple series | ||
| 210 | + * | ||
| 211 | + * @return boolean | ||
| 212 | + */ | ||
| 213 | + public function isMultiLevelSeries() | ||
| 214 | + { | ||
| 215 | + if (count($this->dataValues) > 0) { | ||
| 216 | + return is_array($this->dataValues[0]); | ||
| 217 | + } | ||
| 218 | + return null; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * Return the level count of a multi-level Data Series | ||
| 223 | + * | ||
| 224 | + * @return boolean | ||
| 225 | + */ | ||
| 226 | + public function multiLevelCount() | ||
| 227 | + { | ||
| 228 | + $levelCount = 0; | ||
| 229 | + foreach ($this->dataValues as $dataValueSet) { | ||
| 230 | + $levelCount = max($levelCount, count($dataValueSet)); | ||
| 231 | + } | ||
| 232 | + return $levelCount; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * Get Series Data Values | ||
| 237 | + * | ||
| 238 | + * @return array of mixed | ||
| 239 | + */ | ||
| 240 | + public function getDataValues() | ||
| 241 | + { | ||
| 242 | + return $this->dataValues; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + /** | ||
| 246 | + * Get the first Series Data value | ||
| 247 | + * | ||
| 248 | + * @return mixed | ||
| 249 | + */ | ||
| 250 | + public function getDataValue() | ||
| 251 | + { | ||
| 252 | + $count = count($this->dataValues); | ||
| 253 | + if ($count == 0) { | ||
| 254 | + return null; | ||
| 255 | + } elseif ($count == 1) { | ||
| 256 | + return $this->dataValues[0]; | ||
| 257 | + } | ||
| 258 | + return $this->dataValues; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * Set Series Data Values | ||
| 263 | + * | ||
| 264 | + * @param array $dataValues | ||
| 265 | + * @param boolean $refreshDataSource | ||
| 266 | + * TRUE - refresh the value of dataSource based on the values of $dataValues | ||
| 267 | + * FALSE - don't change the value of dataSource | ||
| 268 | + * @return PHPExcel_Chart_DataSeriesValues | ||
| 269 | + */ | ||
| 270 | + public function setDataValues($dataValues = array(), $refreshDataSource = true) | ||
| 271 | + { | ||
| 272 | + $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); | ||
| 273 | + $this->pointCount = count($dataValues); | ||
| 274 | + | ||
| 275 | + if ($refreshDataSource) { | ||
| 276 | + // TO DO | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + return $this; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + private function stripNulls($var) | ||
| 283 | + { | ||
| 284 | + return $var !== null; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true) | ||
| 288 | + { | ||
| 289 | + if ($this->dataSource !== null) { | ||
| 290 | + $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); | ||
| 291 | + $newDataValues = PHPExcel_Calculation::unwrapResult( | ||
| 292 | + $calcEngine->_calculateFormulaValue( | ||
| 293 | + '='.$this->dataSource, | ||
| 294 | + null, | ||
| 295 | + $worksheet->getCell('A1') | ||
| 296 | + ) | ||
| 297 | + ); | ||
| 298 | + if ($flatten) { | ||
| 299 | + $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); | ||
| 300 | + foreach ($this->dataValues as &$dataValue) { | ||
| 301 | + if ((!empty($dataValue)) && ($dataValue[0] == '#')) { | ||
| 302 | + $dataValue = 0.0; | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + unset($dataValue); | ||
| 306 | + } else { | ||
| 307 | + $cellRange = explode('!', $this->dataSource); | ||
| 308 | + if (count($cellRange) > 1) { | ||
| 309 | + list(, $cellRange) = $cellRange; | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange)); | ||
| 313 | + if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { | ||
| 314 | + $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); | ||
| 315 | + } else { | ||
| 316 | + $newArray = array_values(array_shift($newDataValues)); | ||
| 317 | + foreach ($newArray as $i => $newDataSet) { | ||
| 318 | + $newArray[$i] = array($newDataSet); | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + foreach ($newDataValues as $newDataSet) { | ||
| 322 | + $i = 0; | ||
| 323 | + foreach ($newDataSet as $newDataVal) { | ||
| 324 | + array_unshift($newArray[$i++], $newDataVal); | ||
| 325 | + } | ||
| 326 | + } | ||
| 327 | + $this->dataValues = $newArray; | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + $this->pointCount = count($this->dataValues); | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | +} |
PHPExcel_Croe/PHPExcel/Chart/Exception.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * PHPExcel_Chart_Exception | ||
| 5 | + * | ||
| 6 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 7 | + * | ||
| 8 | + * This library is free software; you can redistribute it and/or | ||
| 9 | + * modify it under the terms of the GNU Lesser General Public | ||
| 10 | + * License as published by the Free Software Foundation; either | ||
| 11 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | + * | ||
| 13 | + * This library is distributed in the hope that it will be useful, | ||
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | + * Lesser General Public License for more details. | ||
| 17 | + * | ||
| 18 | + * You should have received a copy of the GNU Lesser General Public | ||
| 19 | + * License along with this library; if not, write to the Free Software | ||
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | + * | ||
| 22 | + * @category PHPExcel | ||
| 23 | + * @package PHPExcel_Chart | ||
| 24 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 25 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 26 | + * @version ##VERSION##, ##DATE## | ||
| 27 | + */ | ||
| 28 | +class PHPExcel_Chart_Exception extends PHPExcel_Exception | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * Error handler callback | ||
| 32 | + * | ||
| 33 | + * @param mixed $code | ||
| 34 | + * @param mixed $string | ||
| 35 | + * @param mixed $file | ||
| 36 | + * @param mixed $line | ||
| 37 | + * @param mixed $context | ||
| 38 | + */ | ||
| 39 | + public static function errorHandlerCallback($code, $string, $file, $line, $context) | ||
| 40 | + { | ||
| 41 | + $e = new self($string, $code); | ||
| 42 | + $e->line = $line; | ||
| 43 | + $e->file = $file; | ||
| 44 | + throw $e; | ||
| 45 | + } | ||
| 46 | +} |
PHPExcel_Croe/PHPExcel/Chart/GridLines.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/Layout.php
0 → 100755
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * PHPExcel | ||
| 4 | + * | ||
| 5 | + * Copyright (c) 2006 - 2015 PHPExcel | ||
| 6 | + * | ||
| 7 | + * This library is free software; you can redistribute it and/or | ||
| 8 | + * modify it under the terms of the GNU Lesser General Public | ||
| 9 | + * License as published by the Free Software Foundation; either | ||
| 10 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | + * | ||
| 12 | + * This library is distributed in the hope that it will be useful, | ||
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | + * Lesser General Public License for more details. | ||
| 16 | + * | ||
| 17 | + * You should have received a copy of the GNU Lesser General Public | ||
| 18 | + * License along with this library; if not, write to the Free Software | ||
| 19 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * @category PHPExcel | ||
| 22 | + * @package PHPExcel_Chart | ||
| 23 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 24 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | ||
| 25 | + * @version ##VERSION##, ##DATE## | ||
| 26 | + */ | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * PHPExcel_Chart_Layout | ||
| 31 | + * | ||
| 32 | + * @category PHPExcel | ||
| 33 | + * @package PHPExcel_Chart | ||
| 34 | + * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | ||
| 35 | + */ | ||
| 36 | +class PHPExcel_Chart_Layout | ||
| 37 | +{ | ||
| 38 | + /** | ||
| 39 | + * layoutTarget | ||
| 40 | + * | ||
| 41 | + * @var string | ||
| 42 | + */ | ||
| 43 | + private $layoutTarget; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * X Mode | ||
| 47 | + * | ||
| 48 | + * @var string | ||
| 49 | + */ | ||
| 50 | + private $xMode; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Y Mode | ||
| 54 | + * | ||
| 55 | + * @var string | ||
| 56 | + */ | ||
| 57 | + private $yMode; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * X-Position | ||
| 61 | + * | ||
| 62 | + * @var float | ||
| 63 | + */ | ||
| 64 | + private $xPos; | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Y-Position | ||
| 68 | + * | ||
| 69 | + * @var float | ||
| 70 | + */ | ||
| 71 | + private $yPos; | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * width | ||
| 75 | + * | ||
| 76 | + * @var float | ||
| 77 | + */ | ||
| 78 | + private $width; | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * height | ||
| 82 | + * | ||
| 83 | + * @var float | ||
| 84 | + */ | ||
| 85 | + private $height; | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * show legend key | ||
| 89 | + * Specifies that legend keys should be shown in data labels | ||
| 90 | + * | ||
| 91 | + * @var boolean | ||
| 92 | + */ | ||
| 93 | + private $showLegendKey; | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * show value | ||
| 97 | + * Specifies that the value should be shown in a data label. | ||
| 98 | + * | ||
| 99 | + * @var boolean | ||
| 100 | + */ | ||
| 101 | + private $showVal; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * show category name | ||
| 105 | + * Specifies that the category name should be shown in the data label. | ||
| 106 | + * | ||
| 107 | + * @var boolean | ||
| 108 | + */ | ||
| 109 | + private $showCatName; | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * show data series name | ||
| 113 | + * Specifies that the series name should be shown in the data label. | ||
| 114 | + * | ||
| 115 | + * @var boolean | ||
| 116 | + */ | ||
| 117 | + private $showSerName; | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * show percentage | ||
| 121 | + * Specifies that the percentage should be shown in the data label. | ||
| 122 | + * | ||
| 123 | + * @var boolean | ||
| 124 | + */ | ||
| 125 | + private $showPercent; | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * show bubble size | ||
| 129 | + * | ||
| 130 | + * @var boolean | ||
| 131 | + */ | ||
| 132 | + private $showBubbleSize; | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * show leader lines | ||
| 136 | + * Specifies that leader lines should be shown for the data label. | ||
| 137 | + * | ||
| 138 | + * @var boolean | ||
| 139 | + */ | ||
| 140 | + private $showLeaderLines; | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * Create a new PHPExcel_Chart_Layout | ||
| 145 | + */ | ||
| 146 | + public function __construct($layout = array()) | ||
| 147 | + { | ||
| 148 | + if (isset($layout['layoutTarget'])) { | ||
| 149 | + $this->layoutTarget = $layout['layoutTarget']; | ||
| 150 | + } | ||
| 151 | + if (isset($layout['xMode'])) { | ||
| 152 | + $this->xMode = $layout['xMode']; | ||
| 153 | + } | ||
| 154 | + if (isset($layout['yMode'])) { | ||
| 155 | + $this->yMode = $layout['yMode']; | ||
| 156 | + } | ||
| 157 | + if (isset($layout['x'])) { | ||
| 158 | + $this->xPos = (float) $layout['x']; | ||
| 159 | + } | ||
| 160 | + if (isset($layout['y'])) { | ||
| 161 | + $this->yPos = (float) $layout['y']; | ||
| 162 | + } | ||
| 163 | + if (isset($layout['w'])) { | ||
| 164 | + $this->width = (float) $layout['w']; | ||
| 165 | + } | ||
| 166 | + if (isset($layout['h'])) { | ||
| 167 | + $this->height = (float) $layout['h']; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * Get Layout Target | ||
| 173 | + * | ||
| 174 | + * @return string | ||
| 175 | + */ | ||
| 176 | + public function getLayoutTarget() | ||
| 177 | + { | ||
| 178 | + return $this->layoutTarget; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * Set Layout Target | ||
| 183 | + * | ||
| 184 | + * @param Layout Target $value | ||
| 185 | + * @return PHPExcel_Chart_Layout | ||
| 186 | + */ | ||
| 187 | + public function setLayoutTarget($value) | ||
| 188 | + { | ||
| 189 | + $this->layoutTarget = $value; | ||
| 190 | + return $this; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * Get X-Mode | ||
| 195 | + * | ||
| 196 | + * @return string | ||
| 197 | + */ | ||
| 198 | + public function getXMode() | ||
| 199 | + { | ||
| 200 | + return $this->xMode; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * Set X-Mode | ||
| 205 | + * | ||
| 206 | + * @param X-Mode $value | ||
| 207 | + * @return PHPExcel_Chart_Layout | ||
| 208 | + */ | ||
| 209 | + public function setXMode($value) | ||
| 210 | + { | ||
| 211 | + $this->xMode = $value; | ||
| 212 | + return $this; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + /** | ||
| 216 | + * Get Y-Mode | ||
| 217 | + * | ||
| 218 | + * @return string | ||
| 219 | + */ | ||
| 220 | + public function getYMode() | ||
| 221 | + { | ||
| 222 | + return $this->yMode; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * Set Y-Mode | ||
| 227 | + * | ||
| 228 | + * @param Y-Mode $value | ||
| 229 | + * @return PHPExcel_Chart_Layout | ||
| 230 | + */ | ||
| 231 | + public function setYMode($value) | ||
| 232 | + { | ||
| 233 | + $this->yMode = $value; | ||
| 234 | + return $this; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + /** | ||
| 238 | + * Get X-Position | ||
| 239 | + * | ||
| 240 | + * @return number | ||
| 241 | + */ | ||
| 242 | + public function getXPosition() | ||
| 243 | + { | ||
| 244 | + return $this->xPos; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + /** | ||
| 248 | + * Set X-Position | ||
| 249 | + * | ||
| 250 | + * @param X-Position $value | ||
| 251 | + * @return PHPExcel_Chart_Layout | ||
| 252 | + */ | ||
| 253 | + public function setXPosition($value) | ||
| 254 | + { | ||
| 255 | + $this->xPos = $value; | ||
| 256 | + return $this; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + /** | ||
| 260 | + * Get Y-Position | ||
| 261 | + * | ||
| 262 | + * @return number | ||
| 263 | + */ | ||
| 264 | + public function getYPosition() | ||
| 265 | + { | ||
| 266 | + return $this->yPos; | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + /** | ||
| 270 | + * Set Y-Position | ||
| 271 | + * | ||
| 272 | + * @param Y-Position $value | ||
| 273 | + * @return PHPExcel_Chart_Layout | ||
| 274 | + */ | ||
| 275 | + public function setYPosition($value) | ||
| 276 | + { | ||
| 277 | + $this->yPos = $value; | ||
| 278 | + return $this; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + /** | ||
| 282 | + * Get Width | ||
| 283 | + * | ||
| 284 | + * @return number | ||
| 285 | + */ | ||
| 286 | + public function getWidth() | ||
| 287 | + { | ||
| 288 | + return $this->width; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + /** | ||
| 292 | + * Set Width | ||
| 293 | + * | ||
| 294 | + * @param Width $value | ||
| 295 | + * @return PHPExcel_Chart_Layout | ||
| 296 | + */ | ||
| 297 | + public function setWidth($value) | ||
| 298 | + { | ||
| 299 | + $this->width = $value; | ||
| 300 | + return $this; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + /** | ||
| 304 | + * Get Height | ||
| 305 | + * | ||
| 306 | + * @return number | ||
| 307 | + */ | ||
| 308 | + public function getHeight() | ||
| 309 | + { | ||
| 310 | + return $this->height; | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + /** | ||
| 314 | + * Set Height | ||
| 315 | + * | ||
| 316 | + * @param Height $value | ||
| 317 | + * @return PHPExcel_Chart_Layout | ||
| 318 | + */ | ||
| 319 | + public function setHeight($value) | ||
| 320 | + { | ||
| 321 | + $this->height = $value; | ||
| 322 | + return $this; | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + | ||
| 326 | + /** | ||
| 327 | + * Get show legend key | ||
| 328 | + * | ||
| 329 | + * @return boolean | ||
| 330 | + */ | ||
| 331 | + public function getShowLegendKey() | ||
| 332 | + { | ||
| 333 | + return $this->showLegendKey; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + /** | ||
| 337 | + * Set show legend key | ||
| 338 | + * Specifies that legend keys should be shown in data labels. | ||
| 339 | + * | ||
| 340 | + * @param boolean $value Show legend key | ||
| 341 | + * @return PHPExcel_Chart_Layout | ||
| 342 | + */ | ||
| 343 | + public function setShowLegendKey($value) | ||
| 344 | + { | ||
| 345 | + $this->showLegendKey = $value; | ||
| 346 | + return $this; | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * Get show value | ||
| 351 | + * | ||
| 352 | + * @return boolean | ||
| 353 | + */ | ||
| 354 | + public function getShowVal() | ||
| 355 | + { | ||
| 356 | + return $this->showVal; | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + /** | ||
| 360 | + * Set show val | ||
| 361 | + * Specifies that the value should be shown in data labels. | ||
| 362 | + * | ||
| 363 | + * @param boolean $value Show val | ||
| 364 | + * @return PHPExcel_Chart_Layout | ||
| 365 | + */ | ||
| 366 | + public function setShowVal($value) | ||
| 367 | + { | ||
| 368 | + $this->showVal = $value; | ||
| 369 | + return $this; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + /** | ||
| 373 | + * Get show category name | ||
| 374 | + * | ||
| 375 | + * @return boolean | ||
| 376 | + */ | ||
| 377 | + public function getShowCatName() | ||
| 378 | + { | ||
| 379 | + return $this->showCatName; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + /** | ||
| 383 | + * Set show cat name | ||
| 384 | + * Specifies that the category name should be shown in data labels. | ||
| 385 | + * | ||
| 386 | + * @param boolean $value Show cat name | ||
| 387 | + * @return PHPExcel_Chart_Layout | ||
| 388 | + */ | ||
| 389 | + public function setShowCatName($value) | ||
| 390 | + { | ||
| 391 | + $this->showCatName = $value; | ||
| 392 | + return $this; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + /** | ||
| 396 | + * Get show data series name | ||
| 397 | + * | ||
| 398 | + * @return boolean | ||
| 399 | + */ | ||
| 400 | + public function getShowSerName() | ||
| 401 | + { | ||
| 402 | + return $this->showSerName; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * Set show ser name | ||
| 407 | + * Specifies that the series name should be shown in data labels. | ||
| 408 | + * | ||
| 409 | + * @param boolean $value Show series name | ||
| 410 | + * @return PHPExcel_Chart_Layout | ||
| 411 | + */ | ||
| 412 | + public function setShowSerName($value) | ||
| 413 | + { | ||
| 414 | + $this->showSerName = $value; | ||
| 415 | + return $this; | ||
| 416 | + } | ||
| 417 | + | ||
| 418 | + /** | ||
| 419 | + * Get show percentage | ||
| 420 | + * | ||
| 421 | + * @return boolean | ||
| 422 | + */ | ||
| 423 | + public function getShowPercent() | ||
| 424 | + { | ||
| 425 | + return $this->showPercent; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + /** | ||
| 429 | + * Set show percentage | ||
| 430 | + * Specifies that the percentage should be shown in data labels. | ||
| 431 | + * | ||
| 432 | + * @param boolean $value Show percentage | ||
| 433 | + * @return PHPExcel_Chart_Layout | ||
| 434 | + */ | ||
| 435 | + public function setShowPercent($value) | ||
| 436 | + { | ||
| 437 | + $this->showPercent = $value; | ||
| 438 | + return $this; | ||
| 439 | + } | ||
| 440 | + | ||
| 441 | + /** | ||
| 442 | + * Get show bubble size | ||
| 443 | + * | ||
| 444 | + * @return boolean | ||
| 445 | + */ | ||
| 446 | + public function getShowBubbleSize() | ||
| 447 | + { | ||
| 448 | + return $this->showBubbleSize; | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + /** | ||
| 452 | + * Set show bubble size | ||
| 453 | + * Specifies that the bubble size should be shown in data labels. | ||
| 454 | + * | ||
| 455 | + * @param boolean $value Show bubble size | ||
| 456 | + * @return PHPExcel_Chart_Layout | ||
| 457 | + */ | ||
| 458 | + public function setShowBubbleSize($value) | ||
| 459 | + { | ||
| 460 | + $this->showBubbleSize = $value; | ||
| 461 | + return $this; | ||
| 462 | + } | ||
| 463 | + | ||
| 464 | + /** | ||
| 465 | + * Get show leader lines | ||
| 466 | + * | ||
| 467 | + * @return boolean | ||
| 468 | + */ | ||
| 469 | + public function getShowLeaderLines() | ||
| 470 | + { | ||
| 471 | + return $this->showLeaderLines; | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + /** | ||
| 475 | + * Set show leader lines | ||
| 476 | + * Specifies that leader lines should be shown in data labels. | ||
| 477 | + * | ||
| 478 | + * @param boolean $value Show leader lines | ||
| 479 | + * @return PHPExcel_Chart_Layout | ||
| 480 | + */ | ||
| 481 | + public function setShowLeaderLines($value) | ||
| 482 | + { | ||
| 483 | + $this->showLeaderLines = $value; | ||
| 484 | + return $this; | ||
| 485 | + } | ||
| 486 | +} |
PHPExcel_Croe/PHPExcel/Chart/Legend.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/PlotArea.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/Properties.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Chart/Title.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Comment.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/DocumentSecurity.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Exception.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/HashTable.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Helper/HTML.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/IComparable.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/IOFactory.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/NamedRange.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Abstract.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/CSV.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Excel2007.php
0 → 100755
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Excel5.php
0 → 100755
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Excel5/MD5.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Excel5/RC4.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Exception.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/Gnumeric.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/HTML.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/IReader.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/OOCalc.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Reader/SYLK.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/ReferenceHelper.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/RichText.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/RichText/Run.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Settings.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/CodePage.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/Date.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/Drawing.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/Escher.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/Excel5.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/File.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/Font.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/OLE.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/OLE/PPS.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/OLERead.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异太大,无法显示。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/String.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/TimeZone.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/XMLWriter.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Shared/ZipArchive.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Alignment.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Border.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Borders.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Color.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Conditional.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Fill.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Font.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Protection.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Style/Supervisor.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Worksheet.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Worksheet/Column.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Worksheet/Drawing.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Worksheet/Row.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/WorksheetIterator.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/Abstract.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/CSV.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/Excel2007.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/Excel5.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异太大,无法显示。
PHPExcel_Croe/PHPExcel/Writer/Excel5/Xf.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/Exception.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/HTML.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/IWriter.php
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/PDF.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/PDF/Core.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/PDF/DomPDF.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/PDF/mPDF.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/Writer/PDF/tcPDF.php
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/bg/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/cs/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/cs/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/da/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/da/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/de/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/de/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/en/uk/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/es/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/es/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/fi/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/fi/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/fr/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/fr/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/hu/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/hu/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/it/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/it/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/nl/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/nl/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/no/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/no/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/pl/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/pl/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/pt/br/config
0 → 100755
此文件的差异被折叠,
点击展开。
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/pt/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/pt/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/ru/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/ru/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/sv/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/sv/functions
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/tr/config
0 → 100755
此文件的差异被折叠,
点击展开。
PHPExcel_Croe/PHPExcel/locale/tr/functions
0 → 100755
此文件的差异被折叠,
点击展开。
Read_Excel.php
0 → 100644
此文件的差异被折叠,
点击展开。
phpexcel.sql
0 → 100644
此文件的差异被折叠,
点击展开。
template.xlsx
0 → 100644
此文件类型无法预览
uploadfile.html
0 → 100644
此文件的差异被折叠,
点击展开。
导入学生信息模板.xlsx
0 → 100644
此文件类型无法预览
-
请 注册 或 登录 后发表评论