浏览代码

laravel excel back

wesley 6 年之前
父节点
当前提交
60d88b79e5
共有 100 个文件被更改,包括 6 次插入52800 次删除
  1. 3 92
      app/Http/Controllers/Admin/Company/InfoController.php
  2. 1 47
      app/Http/Controllers/Admin/User/ThreadsController.php
  3. 2 2
      composer.json
  4. 二进制
      libs/PHPExcel/.DS_Store
  5. 0 1153
      libs/PHPExcel/PHPExcel.php
  6. 0 81
      libs/PHPExcel/PHPExcel/Autoloader.php
  7. 0 290
      libs/PHPExcel/PHPExcel/CachedObjectStorage/APC.php
  8. 0 368
      libs/PHPExcel/PHPExcel/CachedObjectStorage/CacheBase.php
  9. 0 208
      libs/PHPExcel/PHPExcel/CachedObjectStorage/DiscISAM.php
  10. 0 103
      libs/PHPExcel/PHPExcel/CachedObjectStorage/ICache.php
  11. 0 149
      libs/PHPExcel/PHPExcel/CachedObjectStorage/Igbinary.php
  12. 0 308
      libs/PHPExcel/PHPExcel/CachedObjectStorage/Memcache.php
  13. 0 118
      libs/PHPExcel/PHPExcel/CachedObjectStorage/Memory.php
  14. 0 133
      libs/PHPExcel/PHPExcel/CachedObjectStorage/MemoryGZip.php
  15. 0 129
      libs/PHPExcel/PHPExcel/CachedObjectStorage/MemorySerialized.php
  16. 0 200
      libs/PHPExcel/PHPExcel/CachedObjectStorage/PHPTemp.php
  17. 0 307
      libs/PHPExcel/PHPExcel/CachedObjectStorage/SQLite.php
  18. 0 346
      libs/PHPExcel/PHPExcel/CachedObjectStorage/SQLite3.php
  19. 0 289
      libs/PHPExcel/PHPExcel/CachedObjectStorage/Wincache.php
  20. 0 231
      libs/PHPExcel/PHPExcel/CachedObjectStorageFactory.php
  21. 0 94
      libs/PHPExcel/PHPExcel/CalcEngine/CyclicReferenceStack.php
  22. 0 151
      libs/PHPExcel/PHPExcel/CalcEngine/Logger.php
  23. 0 4391
      libs/PHPExcel/PHPExcel/Calculation.php
  24. 0 676
      libs/PHPExcel/PHPExcel/Calculation/Database.php
  25. 0 1553
      libs/PHPExcel/PHPExcel/Calculation/DateTime.php
  26. 0 2650
      libs/PHPExcel/PHPExcel/Calculation/Engineering.php
  27. 0 46
      libs/PHPExcel/PHPExcel/Calculation/Exception.php
  28. 0 45
      libs/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php
  29. 0 2359
      libs/PHPExcel/PHPExcel/Calculation/Financial.php
  30. 0 622
      libs/PHPExcel/PHPExcel/Calculation/FormulaParser.php
  31. 0 176
      libs/PHPExcel/PHPExcel/Calculation/FormulaToken.php
  32. 0 148
      libs/PHPExcel/PHPExcel/Calculation/Function.php
  33. 0 760
      libs/PHPExcel/PHPExcel/Calculation/Functions.php
  34. 0 285
      libs/PHPExcel/PHPExcel/Calculation/Logical.php
  35. 0 879
      libs/PHPExcel/PHPExcel/Calculation/LookupRef.php
  36. 0 1459
      libs/PHPExcel/PHPExcel/Calculation/MathTrig.php
  37. 0 3745
      libs/PHPExcel/PHPExcel/Calculation/Statistical.php
  38. 0 651
      libs/PHPExcel/PHPExcel/Calculation/TextData.php
  39. 0 111
      libs/PHPExcel/PHPExcel/Calculation/Token/Stack.php
  40. 0 351
      libs/PHPExcel/PHPExcel/Calculation/functionlist.txt
  41. 0 1032
      libs/PHPExcel/PHPExcel/Cell.php
  42. 0 187
      libs/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php
  43. 0 115
      libs/PHPExcel/PHPExcel/Cell/DataType.php
  44. 0 492
      libs/PHPExcel/PHPExcel/Cell/DataValidation.php
  45. 0 102
      libs/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php
  46. 0 124
      libs/PHPExcel/PHPExcel/Cell/Hyperlink.php
  47. 0 47
      libs/PHPExcel/PHPExcel/Cell/IValueBinder.php
  48. 0 680
      libs/PHPExcel/PHPExcel/Chart.php
  49. 0 561
      libs/PHPExcel/PHPExcel/Chart/Axis.php
  50. 0 390
      libs/PHPExcel/PHPExcel/Chart/DataSeries.php
  51. 0 333
      libs/PHPExcel/PHPExcel/Chart/DataSeriesValues.php
  52. 0 46
      libs/PHPExcel/PHPExcel/Chart/Exception.php
  53. 0 472
      libs/PHPExcel/PHPExcel/Chart/GridLines.php
  54. 0 486
      libs/PHPExcel/PHPExcel/Chart/Layout.php
  55. 0 170
      libs/PHPExcel/PHPExcel/Chart/Legend.php
  56. 0 126
      libs/PHPExcel/PHPExcel/Chart/PlotArea.php
  57. 0 363
      libs/PHPExcel/PHPExcel/Chart/Properties.php
  58. 0 20
      libs/PHPExcel/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt
  59. 0 883
      libs/PHPExcel/PHPExcel/Chart/Renderer/jpgraph.php
  60. 0 86
      libs/PHPExcel/PHPExcel/Chart/Title.php
  61. 0 338
      libs/PHPExcel/PHPExcel/Comment.php
  62. 0 611
      libs/PHPExcel/PHPExcel/DocumentProperties.php
  63. 0 222
      libs/PHPExcel/PHPExcel/DocumentSecurity.php
  64. 0 54
      libs/PHPExcel/PHPExcel/Exception.php
  65. 0 204
      libs/PHPExcel/PHPExcel/HashTable.php
  66. 0 808
      libs/PHPExcel/PHPExcel/Helper/HTML.php
  67. 0 34
      libs/PHPExcel/PHPExcel/IComparable.php
  68. 0 289
      libs/PHPExcel/PHPExcel/IOFactory.php
  69. 0 249
      libs/PHPExcel/PHPExcel/NamedRange.php
  70. 0 289
      libs/PHPExcel/PHPExcel/Reader/Abstract.php
  71. 0 406
      libs/PHPExcel/PHPExcel/Reader/CSV.php
  72. 0 51
      libs/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php
  73. 0 801
      libs/PHPExcel/PHPExcel/Reader/Excel2003XML.php
  74. 0 2051
      libs/PHPExcel/PHPExcel/Reader/Excel2007.php
  75. 0 520
      libs/PHPExcel/PHPExcel/Reader/Excel2007/Chart.php
  76. 0 127
      libs/PHPExcel/PHPExcel/Reader/Excel2007/Theme.php
  77. 0 7594
      libs/PHPExcel/PHPExcel/Reader/Excel5.php
  78. 0 32
      libs/PHPExcel/PHPExcel/Reader/Excel5/Color.php
  79. 0 77
      libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BIFF5.php
  80. 0 77
      libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BIFF8.php
  81. 0 31
      libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BuiltIn.php
  82. 0 28
      libs/PHPExcel/PHPExcel/Reader/Excel5/ErrorCode.php
  83. 0 669
      libs/PHPExcel/PHPExcel/Reader/Excel5/Escher.php
  84. 0 203
      libs/PHPExcel/PHPExcel/Reader/Excel5/MD5.php
  85. 0 81
      libs/PHPExcel/PHPExcel/Reader/Excel5/RC4.php
  86. 0 36
      libs/PHPExcel/PHPExcel/Reader/Excel5/Style/Border.php
  87. 0 41
      libs/PHPExcel/PHPExcel/Reader/Excel5/Style/FillPattern.php
  88. 0 46
      libs/PHPExcel/PHPExcel/Reader/Exception.php
  89. 0 850
      libs/PHPExcel/PHPExcel/Reader/Gnumeric.php
  90. 0 549
      libs/PHPExcel/PHPExcel/Reader/HTML.php
  91. 0 39
      libs/PHPExcel/PHPExcel/Reader/IReadFilter.php
  92. 0 46
      libs/PHPExcel/PHPExcel/Reader/IReader.php
  93. 0 696
      libs/PHPExcel/PHPExcel/Reader/OOCalc.php
  94. 0 478
      libs/PHPExcel/PHPExcel/Reader/SYLK.php
  95. 0 913
      libs/PHPExcel/PHPExcel/ReferenceHelper.php
  96. 0 191
      libs/PHPExcel/PHPExcel/RichText.php
  97. 0 56
      libs/PHPExcel/PHPExcel/RichText/ITextElement.php
  98. 0 98
      libs/PHPExcel/PHPExcel/RichText/Run.php
  99. 0 105
      libs/PHPExcel/PHPExcel/RichText/TextElement.php
  100. 0 389
      libs/PHPExcel/PHPExcel/Settings.php

+ 3 - 92
app/Http/Controllers/Admin/Company/InfoController.php

xqd xqd
@@ -17,6 +17,7 @@ use App\Models\UserCompanyCollectionModel;
 use Illuminate\Http\Request;
 use App\Repositories\Company\InfoRepository;
 use Maatwebsite\Excel\Facades\Excel;
+use \PhpOffice\PhpSpreadsheet\IOFactory;
 
 class InfoController extends Controller
 {
@@ -72,98 +73,8 @@ class InfoController extends Controller
      */
     public function import(Request $request)
     {
-        $tmp_file = $_FILES['company_info']['name'];
-        $file_types = explode(".", $tmp_file);
-        $file_type = $file_types [count($file_types) - 1];
-        if (strtolower($file_type) == "xls" || strtolower($file_type) == "xlsx") {
-            $file = $request->file('company_info');
-            $path = 'upload/excel_import';
-            $filename = $tmp_file;
-            $file->move($path, $filename);
-            $filePath = $path . '/' . $filename;
-
-            $objRead = new \PHPExcel_Reader_Excel2007();   //建立reader对象
-            if(!$objRead->canRead($filePath)){
-                $objRead = new \PHPExcel_Reader_Excel5();
-                if(!$objRead->canRead($filePath)){
-                    die('No Excel!');
-                }
-
-            }
-
-            $objPHPExcel = $objRead->load($filePath,$encode='utf-8');//获取excel文件
-
-            $sheet = $objPHPExcel->getSheet(0); //激活当前的表
-            $highestRow = $sheet->getHighestRow(); // 取得总行数
-            $highestColumn = $sheet->getHighestColumn(); // 取得总列数
-
-            if($highestColumn == 'C'){
-                $a=0;
-                //将表格里面的数据循环到数组中
-                for($i=2;$i<=$highestRow;$i++)
-                {
-                    if($i % 1000 ==0 ){
-                        ob_flush();
-                        flush();
-                    }
-                    //*为什么$i=2? (因为Excel表格第一行应该是表头)
-                    $data['companyName'] = $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();
-
-                    $res = CompanyInfoModel::create($data);
-                    $company_id = $res->id;
-
-                     CompanyContactsModel::create([
-                        'company_id'=> $company_id,
-                        'linkman'=> $objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue(),
-                        'phone'=> $objPHPExcel->getActiveSheet()->getCell("C".$i)->getValue(),
-                    ]);
-
-                    $a++;
-                }
-
-            }else if($highestColumn == 'L') {
-                $a=0;
-                //将表格里面的数据循环到数组中
-                for($i=2;$i<=$highestRow;$i++)
-                {
-                    //*为什么$i=2? (因为Excel表格第一行应该是姓名,年龄,班级,从第二行开始,才是我们要的数据。)
-                    $isExisted = CompanyInfoModel::where('companyName',$objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue())->first();
-
-                    if($isExisted){
-                        $company_id = $isExisted->id;
-                    }else{
-                        $comp_data[$a]['companyName'] = $objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue();//姓名
-                        $comp_data[$a]['legalPerson'] = $objPHPExcel->getActiveSheet()->getCell("I".$i)->getValue();//姓名
-                        $comp_data[$a]['startDate'] = $objPHPExcel->getActiveSheet()->getCell("J".$i)->getValue();//姓名
-                        $comp_data[$a]['regCapital'] = $objPHPExcel->getActiveSheet()->getCell("K".$i)->getValue();//姓名
-                        $comp_data[$a]['regAddr'] = $objPHPExcel->getActiveSheet()->getCell("L".$i)->getValue();//姓名
-
-                        $res = CompanyInfoModel::create($comp_data);
-                        $company_id = $res->id;
-                    }
-
-                    CompanyContactsModel::create([
-                        'company_id'=> $company_id,
-                        'linkman'=> $objPHPExcel->getActiveSheet()->getCell("C".$i)->getValue(),
-                        'phone'=> $objPHPExcel->getActiveSheet()->getCell("D".$i)->getValue()?$objPHPExcel->getActiveSheet()->getCell("D".$i)->getValue():$objPHPExcel->getActiveSheet()->getCell("E".$i)->getValue(),
-                        'email'=> $objPHPExcel->getActiveSheet()->getCell("F".$i)->getValue(),
-                        'qq'=> $objPHPExcel->getActiveSheet()->getCell("G".$i)->getValue()
-                    ]);
-                    $a++;
-                }
-            }else{
-
-            }
-            return $this->showMessage('导入成功');
-        }else{
-            return $this->showWarning("请上传正确的Excel文件");
-
-        }
-
-
-//        Excel::import(new CompanyInfoImport, request()->file('company_info'));
-
-
+        Excel::import(new CompanyInfoImport, request()->file('company_info'));
+        $this->showMessage('操作成功');
     }
 
     /***

+ 1 - 47
app/Http/Controllers/Admin/User/ThreadsController.php

xqd
@@ -183,52 +183,6 @@ class ThreadsController extends Controller
         \Log::info($thread_ids);
         $threads =  UserThreadsModel::whereIn('id',$thread_ids)->get();
 
-        $objPHPExcel = new \PHPExcel();
-
-        $objPHPExcel->setActiveSheetIndex(0);
-        //5.设置表格头(即excel表格的第一行)
-        $objPHPExcel->setActiveSheetIndex(0)
-            ->setCellValue('A1', '联系方式')
-            ->setCellValue('B1', '线索拥有者')
-            ->setCellValue('C1', '企业名字')
-            ->setCellValue('D1', '企业网站')
-            ->setCellValue('E1', '注册资本(万)')
-            ->setCellValue('F1', '最新跟进')
-            ->setCellValue('G1', '领取时间');
-
-        foreach ($threads as $key=> $item){
-            $contact = $item->contact?$item->contact->phone:'暂无联系人信息';
-            $ower_name = $item->ower->real_name;
-            $companyName = $item->company->companyName;
-            $companyWebsite = $item->company->website;
-            $regCapital = $item->company->regCapital;
-            $lastest = $item->latestProgress();
-            $created_at = $item->created_at;
-
-            $objPHPExcel->getActiveSheet()->setCellValue('A'.($key+2),$contact);
-            $objPHPExcel->getActiveSheet()->setCellValue('B'.($key+2),$ower_name);
-            $objPHPExcel->getActiveSheet()->setCellValue('C'.($key+2),$companyName);
-            $objPHPExcel->getActiveSheet()->setCellValue('D'.($key+2),$companyWebsite);
-            $objPHPExcel->getActiveSheet()->setCellValue('E'.($key+2),$regCapital);
-            $objPHPExcel->getActiveSheet()->setCellValue('F'.($key+2),$lastest);
-            $objPHPExcel->getActiveSheet()->setCellValue('G'.($key+2),$created_at);
-        }
-
-        //7.设置保存的Excel表格名称
-        $filename = '我的线索'.date('ymd',time()).'.xls';
-        //8.设置当前激活的sheet表格名称;
-        $objPHPExcel->getActiveSheet()->setTitle('我的线索');
-        //9.设置浏览器窗口下载表格
-        header("Content-Type: application/force-download");
-        header("Content-Type: application/octet-stream");
-        header("Content-Type: application/download");
-        header('Content-Disposition:inline;filename="'.$filename.'"');
-        //生成excel文件
-        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
-        //下载文件在浏览器窗口
-        $objWriter->save('php://output');
-        exit;
-
-        //return Excel::download(new ThreadsExport($threads),'我的线索.xlsx');
+        return Excel::download(new ThreadsExport($threads),'我的线索.xlsx');
     }
 }

+ 2 - 2
composer.json

xqd xqd
@@ -15,6 +15,7 @@
         "laravel/passport": "^4.0",
         "laravel/tinker": "~1.0",
         "maatwebsite/excel": "^3.1",
+        "phpoffice/phpspreadsheet": "^1.5",
         "rap2hpoutre/laravel-log-viewer": "^0.22.1"
     },
     "require-dev": {
@@ -28,8 +29,7 @@
     "autoload": {
         "classmap": [
             "database/seeds",
-            "database/factories",
-            "libs/PHPExcel"
+            "database/factories"
         ],
         "psr-4": {
             "App\\": "app/"

二进制
libs/PHPExcel/.DS_Store


+ 0 - 1153
libs/PHPExcel/PHPExcel.php

xqd
@@ -1,1153 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel
-{
-    /**
-     * Unique ID
-     *
-     * @var string
-     */
-    private $uniqueID;
-
-    /**
-     * Document properties
-     *
-     * @var PHPExcel_DocumentProperties
-     */
-    private $properties;
-
-    /**
-     * Document security
-     *
-     * @var PHPExcel_DocumentSecurity
-     */
-    private $security;
-
-    /**
-     * Collection of Worksheet objects
-     *
-     * @var PHPExcel_Worksheet[]
-     */
-    private $workSheetCollection = array();
-
-    /**
-     * Calculation Engine
-     *
-     * @var PHPExcel_Calculation
-     */
-    private $calculationEngine;
-
-    /**
-     * Active sheet index
-     *
-     * @var integer
-     */
-    private $activeSheetIndex = 0;
-
-    /**
-     * Named ranges
-     *
-     * @var PHPExcel_NamedRange[]
-     */
-    private $namedRanges = array();
-
-    /**
-     * CellXf supervisor
-     *
-     * @var PHPExcel_Style
-     */
-    private $cellXfSupervisor;
-
-    /**
-     * CellXf collection
-     *
-     * @var PHPExcel_Style[]
-     */
-    private $cellXfCollection = array();
-
-    /**
-     * CellStyleXf collection
-     *
-     * @var PHPExcel_Style[]
-     */
-    private $cellStyleXfCollection = array();
-
-    /**
-    * hasMacros : this workbook have macros ?
-    *
-    * @var bool
-    */
-    private $hasMacros = false;
-
-    /**
-    * macrosCode : all macros code (the vbaProject.bin file, this include form, code,  etc.), null if no macro
-    *
-    * @var binary
-    */
-    private $macrosCode;
-    /**
-    * macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, null if not signed
-    *
-    * @var binary
-    */
-    private $macrosCertificate;
-
-    /**
-    * ribbonXMLData : null if workbook is'nt Excel 2007 or not contain a customized UI
-    *
-    * @var null|string
-    */
-    private $ribbonXMLData;
-
-    /**
-    * ribbonBinObjects : null if workbook is'nt Excel 2007 or not contain embedded objects (picture(s)) for Ribbon Elements
-    * ignored if $ribbonXMLData is null
-    *
-    * @var null|array
-    */
-    private $ribbonBinObjects;
-
-    /**
-    * The workbook has macros ?
-    *
-    * @return boolean true if workbook has macros, false if not
-    */
-    public function hasMacros()
-    {
-        return $this->hasMacros;
-    }
-
-    /**
-    * Define if a workbook has macros
-    *
-    * @param boolean $hasMacros true|false
-    */
-    public function setHasMacros($hasMacros = false)
-    {
-        $this->hasMacros = (bool) $hasMacros;
-    }
-
-    /**
-    * Set the macros code
-    *
-    * @param string $MacrosCode string|null
-    */
-    public function setMacrosCode($MacrosCode = null)
-    {
-        $this->macrosCode=$MacrosCode;
-        $this->setHasMacros(!is_null($MacrosCode));
-    }
-
-    /**
-    * Return the macros code
-    *
-    * @return string|null
-    */
-    public function getMacrosCode()
-    {
-        return $this->macrosCode;
-    }
-
-    /**
-    * Set the macros certificate
-    *
-    * @param string|null $Certificate
-    */
-    public function setMacrosCertificate($Certificate = null)
-    {
-        $this->macrosCertificate=$Certificate;
-    }
-
-    /**
-    * Is the project signed ?
-    *
-    * @return boolean true|false
-    */
-    public function hasMacrosCertificate()
-    {
-        return !is_null($this->macrosCertificate);
-    }
-
-    /**
-    * Return the macros certificate
-    *
-    * @return string|null
-    */
-    public function getMacrosCertificate()
-    {
-        return $this->macrosCertificate;
-    }
-
-    /**
-    * Remove all macros, certificate from spreadsheet
-    *
-    */
-    public function discardMacros()
-    {
-        $this->hasMacros=false;
-        $this->macrosCode=null;
-        $this->macrosCertificate=null;
-    }
-
-    /**
-    * set ribbon XML data
-    *
-    */
-    public function setRibbonXMLData($Target = null, $XMLData = null)
-    {
-        if (!is_null($Target) && !is_null($XMLData)) {
-            $this->ribbonXMLData = array('target' => $Target, 'data' => $XMLData);
-        } else {
-            $this->ribbonXMLData = null;
-        }
-    }
-
-    /**
-    * retrieve ribbon XML Data
-    *
-    * return string|null|array
-    */
-    public function getRibbonXMLData($What = 'all') //we need some constants here...
-    {
-        $ReturnData = null;
-        $What = strtolower($What);
-        switch ($What){
-            case 'all':
-                $ReturnData = $this->ribbonXMLData;
-                break;
-            case 'target':
-            case 'data':
-                if (is_array($this->ribbonXMLData) && array_key_exists($What, $this->ribbonXMLData)) {
-                    $ReturnData = $this->ribbonXMLData[$What];
-                }
-                break;
-        }
-
-        return $ReturnData;
-    }
-
-    /**
-    * store binaries ribbon objects (pictures)
-    *
-    */
-    public function setRibbonBinObjects($BinObjectsNames = null, $BinObjectsData = null)
-    {
-        if (!is_null($BinObjectsNames) && !is_null($BinObjectsData)) {
-            $this->ribbonBinObjects = array('names' => $BinObjectsNames, 'data' => $BinObjectsData);
-        } else {
-            $this->ribbonBinObjects = null;
-        }
-    }
-    /**
-    * return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function)
-    *
-    */
-    private function getExtensionOnly($ThePath)
-    {
-        return pathinfo($ThePath, PATHINFO_EXTENSION);
-    }
-
-    /**
-    * retrieve Binaries Ribbon Objects
-    *
-    */
-    public function getRibbonBinObjects($What = 'all')
-    {
-        $ReturnData = null;
-        $What = strtolower($What);
-        switch($What) {
-            case 'all':
-                return $this->ribbonBinObjects;
-                break;
-            case 'names':
-            case 'data':
-                if (is_array($this->ribbonBinObjects) && array_key_exists($What, $this->ribbonBinObjects)) {
-                    $ReturnData=$this->ribbonBinObjects[$What];
-                }
-                break;
-            case 'types':
-                if (is_array($this->ribbonBinObjects) &&
-                    array_key_exists('data', $this->ribbonBinObjects) && is_array($this->ribbonBinObjects['data'])) {
-                    $tmpTypes=array_keys($this->ribbonBinObjects['data']);
-                    $ReturnData = array_unique(array_map(array($this, 'getExtensionOnly'), $tmpTypes));
-                } else {
-                    $ReturnData=array(); // the caller want an array... not null if empty
-                }
-                break;
-        }
-        return $ReturnData;
-    }
-
-    /**
-    * This workbook have a custom UI ?
-    *
-    * @return boolean true|false
-    */
-    public function hasRibbon()
-    {
-        return !is_null($this->ribbonXMLData);
-    }
-
-    /**
-    * This workbook have additionnal object for the ribbon ?
-    *
-    * @return boolean true|false
-    */
-    public function hasRibbonBinObjects()
-    {
-        return !is_null($this->ribbonBinObjects);
-    }
-
-    /**
-     * Check if a sheet with a specified code name already exists
-     *
-     * @param string $pSheetCodeName  Name of the worksheet to check
-     * @return boolean
-     */
-    public function sheetCodeNameExists($pSheetCodeName)
-    {
-        return ($this->getSheetByCodeName($pSheetCodeName) !== null);
-    }
-
-    /**
-     * Get sheet by code name. Warning : sheet don't have always a code name !
-     *
-     * @param string $pName Sheet name
-     * @return PHPExcel_Worksheet
-     */
-    public function getSheetByCodeName($pName = '')
-    {
-        $worksheetCount = count($this->workSheetCollection);
-        for ($i = 0; $i < $worksheetCount; ++$i) {
-            if ($this->workSheetCollection[$i]->getCodeName() == $pName) {
-                return $this->workSheetCollection[$i];
-            }
-        }
-
-        return null;
-    }
-
-     /**
-     * Create a new PHPExcel with one Worksheet
-     */
-    public function __construct()
-    {
-        $this->uniqueID = uniqid();
-        $this->calculationEngine = new PHPExcel_Calculation($this);
-
-        // Initialise worksheet collection and add one worksheet
-        $this->workSheetCollection = array();
-        $this->workSheetCollection[] = new PHPExcel_Worksheet($this);
-        $this->activeSheetIndex = 0;
-
-        // Create document properties
-        $this->properties = new PHPExcel_DocumentProperties();
-
-        // Create document security
-        $this->security = new PHPExcel_DocumentSecurity();
-
-        // Set named ranges
-        $this->namedRanges = array();
-
-        // Create the cellXf supervisor
-        $this->cellXfSupervisor = new PHPExcel_Style(true);
-        $this->cellXfSupervisor->bindParent($this);
-
-        // Create the default style
-        $this->addCellXf(new PHPExcel_Style);
-        $this->addCellStyleXf(new PHPExcel_Style);
-    }
-
-    /**
-     * Code to execute when this worksheet is unset()
-     *
-     */
-    public function __destruct()
-    {
-        $this->calculationEngine = null;
-        $this->disconnectWorksheets();
-    }
-
-    /**
-     * Disconnect all worksheets from this PHPExcel workbook object,
-     *    typically so that the PHPExcel object can be unset
-     *
-     */
-    public function disconnectWorksheets()
-    {
-        $worksheet = null;
-        foreach ($this->workSheetCollection as $k => &$worksheet) {
-            $worksheet->disconnectCells();
-            $this->workSheetCollection[$k] = null;
-        }
-        unset($worksheet);
-        $this->workSheetCollection = array();
-    }
-
-    /**
-     * Return the calculation engine for this worksheet
-     *
-     * @return PHPExcel_Calculation
-     */
-    public function getCalculationEngine()
-    {
-        return $this->calculationEngine;
-    }    //    function getCellCacheController()
-
-    /**
-     * Get properties
-     *
-     * @return PHPExcel_DocumentProperties
-     */
-    public function getProperties()
-    {
-        return $this->properties;
-    }
-
-    /**
-     * Set properties
-     *
-     * @param PHPExcel_DocumentProperties    $pValue
-     */
-    public function setProperties(PHPExcel_DocumentProperties $pValue)
-    {
-        $this->properties = $pValue;
-    }
-
-    /**
-     * Get security
-     *
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function getSecurity()
-    {
-        return $this->security;
-    }
-
-    /**
-     * Set security
-     *
-     * @param PHPExcel_DocumentSecurity    $pValue
-     */
-    public function setSecurity(PHPExcel_DocumentSecurity $pValue)
-    {
-        $this->security = $pValue;
-    }
-
-    /**
-     * Get active sheet
-     *
-     * @return PHPExcel_Worksheet
-     *
-     * @throws PHPExcel_Exception
-     */
-    public function getActiveSheet()
-    {
-        return $this->getSheet($this->activeSheetIndex);
-    }
-
-    /**
-     * Create sheet and add it to this workbook
-     *
-     * @param  int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
-     * @return PHPExcel_Worksheet
-     * @throws PHPExcel_Exception
-     */
-    public function createSheet($iSheetIndex = null)
-    {
-        $newSheet = new PHPExcel_Worksheet($this);
-        $this->addSheet($newSheet, $iSheetIndex);
-        return $newSheet;
-    }
-
-    /**
-     * Check if a sheet with a specified name already exists
-     *
-     * @param  string $pSheetName  Name of the worksheet to check
-     * @return boolean
-     */
-    public function sheetNameExists($pSheetName)
-    {
-        return ($this->getSheetByName($pSheetName) !== null);
-    }
-
-    /**
-     * Add sheet
-     *
-     * @param  PHPExcel_Worksheet $pSheet
-     * @param  int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
-     * @return PHPExcel_Worksheet
-     * @throws PHPExcel_Exception
-     */
-    public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
-    {
-        if ($this->sheetNameExists($pSheet->getTitle())) {
-            throw new PHPExcel_Exception(
-                "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
-            );
-        }
-
-        if ($iSheetIndex === null) {
-            if ($this->activeSheetIndex < 0) {
-                $this->activeSheetIndex = 0;
-            }
-            $this->workSheetCollection[] = $pSheet;
-        } else {
-            // Insert the sheet at the requested index
-            array_splice(
-                $this->workSheetCollection,
-                $iSheetIndex,
-                0,
-                array($pSheet)
-            );
-
-            // Adjust active sheet index if necessary
-            if ($this->activeSheetIndex >= $iSheetIndex) {
-                ++$this->activeSheetIndex;
-            }
-        }
-
-        if ($pSheet->getParent() === null) {
-            $pSheet->rebindParent($this);
-        }
-
-        return $pSheet;
-    }
-
-    /**
-     * Remove sheet by index
-     *
-     * @param  int $pIndex Active sheet index
-     * @throws PHPExcel_Exception
-     */
-    public function removeSheetByIndex($pIndex = 0)
-    {
-
-        $numSheets = count($this->workSheetCollection);
-        if ($pIndex > $numSheets - 1) {
-            throw new PHPExcel_Exception(
-                "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
-            );
-        } else {
-            array_splice($this->workSheetCollection, $pIndex, 1);
-        }
-        // Adjust active sheet index if necessary
-        if (($this->activeSheetIndex >= $pIndex) &&
-            ($pIndex > count($this->workSheetCollection) - 1)) {
-            --$this->activeSheetIndex;
-        }
-
-    }
-
-    /**
-     * Get sheet by index
-     *
-     * @param  int $pIndex Sheet index
-     * @return PHPExcel_Worksheet
-     * @throws PHPExcel_Exception
-     */
-    public function getSheet($pIndex = 0)
-    {
-        if (!isset($this->workSheetCollection[$pIndex])) {
-            $numSheets = $this->getSheetCount();
-            throw new PHPExcel_Exception(
-                "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}."
-            );
-        }
-
-        return $this->workSheetCollection[$pIndex];
-    }
-
-    /**
-     * Get all sheets
-     *
-     * @return PHPExcel_Worksheet[]
-     */
-    public function getAllSheets()
-    {
-        return $this->workSheetCollection;
-    }
-
-    /**
-     * Get sheet by name
-     *
-     * @param  string $pName Sheet name
-     * @return PHPExcel_Worksheet
-     */
-    public function getSheetByName($pName = '')
-    {
-        $worksheetCount = count($this->workSheetCollection);
-        for ($i = 0; $i < $worksheetCount; ++$i) {
-            if ($this->workSheetCollection[$i]->getTitle() === $pName) {
-                return $this->workSheetCollection[$i];
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Get index for sheet
-     *
-     * @param  PHPExcel_Worksheet $pSheet
-     * @return int Sheet index
-     * @throws PHPExcel_Exception
-     */
-    public function getIndex(PHPExcel_Worksheet $pSheet)
-    {
-        foreach ($this->workSheetCollection as $key => $value) {
-            if ($value->getHashCode() == $pSheet->getHashCode()) {
-                return $key;
-            }
-        }
-
-        throw new PHPExcel_Exception("Sheet does not exist.");
-    }
-
-    /**
-     * Set index for sheet by sheet name.
-     *
-     * @param  string $sheetName Sheet name to modify index for
-     * @param  int $newIndex New index for the sheet
-     * @return int New sheet index
-     * @throws PHPExcel_Exception
-     */
-    public function setIndexByName($sheetName, $newIndex)
-    {
-        $oldIndex = $this->getIndex($this->getSheetByName($sheetName));
-        $pSheet = array_splice(
-            $this->workSheetCollection,
-            $oldIndex,
-            1
-        );
-        array_splice(
-            $this->workSheetCollection,
-            $newIndex,
-            0,
-            $pSheet
-        );
-        return $newIndex;
-    }
-
-    /**
-     * Get sheet count
-     *
-     * @return int
-     */
-    public function getSheetCount()
-    {
-        return count($this->workSheetCollection);
-    }
-
-    /**
-     * Get active sheet index
-     *
-     * @return int Active sheet index
-     */
-    public function getActiveSheetIndex()
-    {
-        return $this->activeSheetIndex;
-    }
-
-    /**
-     * Set active sheet index
-     *
-     * @param  int $pIndex Active sheet index
-     * @throws PHPExcel_Exception
-     * @return PHPExcel_Worksheet
-     */
-    public function setActiveSheetIndex($pIndex = 0)
-    {
-        $numSheets = count($this->workSheetCollection);
-
-        if ($pIndex > $numSheets - 1) {
-            throw new PHPExcel_Exception(
-                "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
-            );
-        } else {
-            $this->activeSheetIndex = $pIndex;
-        }
-        return $this->getActiveSheet();
-    }
-
-    /**
-     * Set active sheet index by name
-     *
-     * @param  string $pValue Sheet title
-     * @return PHPExcel_Worksheet
-     * @throws PHPExcel_Exception
-     */
-    public function setActiveSheetIndexByName($pValue = '')
-    {
-        if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
-            $this->setActiveSheetIndex($this->getIndex($worksheet));
-            return $worksheet;
-        }
-
-        throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue);
-    }
-
-    /**
-     * Get sheet names
-     *
-     * @return string[]
-     */
-    public function getSheetNames()
-    {
-        $returnValue = array();
-        $worksheetCount = $this->getSheetCount();
-        for ($i = 0; $i < $worksheetCount; ++$i) {
-            $returnValue[] = $this->getSheet($i)->getTitle();
-        }
-
-        return $returnValue;
-    }
-
-    /**
-     * Add external sheet
-     *
-     * @param  PHPExcel_Worksheet $pSheet External sheet to add
-     * @param  int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
-     * @throws PHPExcel_Exception
-     * @return PHPExcel_Worksheet
-     */
-    public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
-    {
-        if ($this->sheetNameExists($pSheet->getTitle())) {
-            throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
-        }
-
-        // count how many cellXfs there are in this workbook currently, we will need this below
-        $countCellXfs = count($this->cellXfCollection);
-
-        // copy all the shared cellXfs from the external workbook and append them to the current
-        foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
-            $this->addCellXf(clone $cellXf);
-        }
-
-        // move sheet to this workbook
-        $pSheet->rebindParent($this);
-
-        // update the cellXfs
-        foreach ($pSheet->getCellCollection(false) as $cellID) {
-            $cell = $pSheet->getCell($cellID);
-            $cell->setXfIndex($cell->getXfIndex() + $countCellXfs);
-        }
-
-        return $this->addSheet($pSheet, $iSheetIndex);
-    }
-
-    /**
-     * Get named ranges
-     *
-     * @return PHPExcel_NamedRange[]
-     */
-    public function getNamedRanges()
-    {
-        return $this->namedRanges;
-    }
-
-    /**
-     * Add named range
-     *
-     * @param  PHPExcel_NamedRange $namedRange
-     * @return boolean
-     */
-    public function addNamedRange(PHPExcel_NamedRange $namedRange)
-    {
-        if ($namedRange->getScope() == null) {
-            // global scope
-            $this->namedRanges[$namedRange->getName()] = $namedRange;
-        } else {
-            // local scope
-            $this->namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange;
-        }
-        return true;
-    }
-
-    /**
-     * Get named range
-     *
-     * @param  string $namedRange
-     * @param  PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
-     * @return PHPExcel_NamedRange|null
-     */
-    public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null)
-    {
-        $returnValue = null;
-
-        if ($namedRange != '' && ($namedRange !== null)) {
-            // first look for global defined name
-            if (isset($this->namedRanges[$namedRange])) {
-                $returnValue = $this->namedRanges[$namedRange];
-            }
-
-            // then look for local defined name (has priority over global defined name if both names exist)
-            if (($pSheet !== null) && isset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
-                $returnValue = $this->namedRanges[$pSheet->getTitle() . '!' . $namedRange];
-            }
-        }
-
-        return $returnValue;
-    }
-
-    /**
-     * Remove named range
-     *
-     * @param  string  $namedRange
-     * @param  PHPExcel_Worksheet|null  $pSheet  Scope: use null for global scope.
-     * @return PHPExcel
-     */
-    public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null)
-    {
-        if ($pSheet === null) {
-            if (isset($this->namedRanges[$namedRange])) {
-                unset($this->namedRanges[$namedRange]);
-            }
-        } else {
-            if (isset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
-                unset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange]);
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Get worksheet iterator
-     *
-     * @return PHPExcel_WorksheetIterator
-     */
-    public function getWorksheetIterator()
-    {
-        return new PHPExcel_WorksheetIterator($this);
-    }
-
-    /**
-     * Copy workbook (!= clone!)
-     *
-     * @return PHPExcel
-     */
-    public function copy()
-    {
-        $copied = clone $this;
-
-        $worksheetCount = count($this->workSheetCollection);
-        for ($i = 0; $i < $worksheetCount; ++$i) {
-            $this->workSheetCollection[$i] = $this->workSheetCollection[$i]->copy();
-            $this->workSheetCollection[$i]->rebindParent($this);
-        }
-
-        return $copied;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        foreach ($this as $key => $val) {
-            if (is_object($val) || (is_array($val))) {
-                $this->{$key} = unserialize(serialize($val));
-            }
-        }
-    }
-
-    /**
-     * Get the workbook collection of cellXfs
-     *
-     * @return PHPExcel_Style[]
-     */
-    public function getCellXfCollection()
-    {
-        return $this->cellXfCollection;
-    }
-
-    /**
-     * Get cellXf by index
-     *
-     * @param  int $pIndex
-     * @return PHPExcel_Style
-     */
-    public function getCellXfByIndex($pIndex = 0)
-    {
-        return $this->cellXfCollection[$pIndex];
-    }
-
-    /**
-     * Get cellXf by hash code
-     *
-     * @param  string $pValue
-     * @return PHPExcel_Style|boolean False if no match found
-     */
-    public function getCellXfByHashCode($pValue = '')
-    {
-        foreach ($this->cellXfCollection as $cellXf) {
-            if ($cellXf->getHashCode() == $pValue) {
-                return $cellXf;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Check if style exists in style collection
-     *
-     * @param  PHPExcel_Style $pCellStyle
-     * @return boolean
-     */
-    public function cellXfExists($pCellStyle = null)
-    {
-        return in_array($pCellStyle, $this->cellXfCollection, true);
-    }
-
-    /**
-     * Get default style
-     *
-     * @return PHPExcel_Style
-     * @throws PHPExcel_Exception
-     */
-    public function getDefaultStyle()
-    {
-        if (isset($this->cellXfCollection[0])) {
-            return $this->cellXfCollection[0];
-        }
-        throw new PHPExcel_Exception('No default style found for this workbook');
-    }
-
-    /**
-     * Add a cellXf to the workbook
-     *
-     * @param PHPExcel_Style $style
-     */
-    public function addCellXf(PHPExcel_Style $style)
-    {
-        $this->cellXfCollection[] = $style;
-        $style->setIndex(count($this->cellXfCollection) - 1);
-    }
-
-    /**
-     * Remove cellXf by index. It is ensured that all cells get their xf index updated.
-     *
-     * @param integer $pIndex Index to cellXf
-     * @throws PHPExcel_Exception
-     */
-    public function removeCellXfByIndex($pIndex = 0)
-    {
-        if ($pIndex > count($this->cellXfCollection) - 1) {
-            throw new PHPExcel_Exception("CellXf index is out of bounds.");
-        } else {
-            // first remove the cellXf
-            array_splice($this->cellXfCollection, $pIndex, 1);
-
-            // then update cellXf indexes for cells
-            foreach ($this->workSheetCollection as $worksheet) {
-                foreach ($worksheet->getCellCollection(false) as $cellID) {
-                    $cell = $worksheet->getCell($cellID);
-                    $xfIndex = $cell->getXfIndex();
-                    if ($xfIndex > $pIndex) {
-                        // decrease xf index by 1
-                        $cell->setXfIndex($xfIndex - 1);
-                    } elseif ($xfIndex == $pIndex) {
-                        // set to default xf index 0
-                        $cell->setXfIndex(0);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Get the cellXf supervisor
-     *
-     * @return PHPExcel_Style
-     */
-    public function getCellXfSupervisor()
-    {
-        return $this->cellXfSupervisor;
-    }
-
-    /**
-     * Get the workbook collection of cellStyleXfs
-     *
-     * @return PHPExcel_Style[]
-     */
-    public function getCellStyleXfCollection()
-    {
-        return $this->cellStyleXfCollection;
-    }
-
-    /**
-     * Get cellStyleXf by index
-     *
-     * @param integer $pIndex Index to cellXf
-     * @return PHPExcel_Style
-     */
-    public function getCellStyleXfByIndex($pIndex = 0)
-    {
-        return $this->cellStyleXfCollection[$pIndex];
-    }
-
-    /**
-     * Get cellStyleXf by hash code
-     *
-     * @param  string $pValue
-     * @return PHPExcel_Style|boolean False if no match found
-     */
-    public function getCellStyleXfByHashCode($pValue = '')
-    {
-        foreach ($this->cellStyleXfCollection as $cellStyleXf) {
-            if ($cellStyleXf->getHashCode() == $pValue) {
-                return $cellStyleXf;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Add a cellStyleXf to the workbook
-     *
-     * @param PHPExcel_Style $pStyle
-     */
-    public function addCellStyleXf(PHPExcel_Style $pStyle)
-    {
-        $this->cellStyleXfCollection[] = $pStyle;
-        $pStyle->setIndex(count($this->cellStyleXfCollection) - 1);
-    }
-
-    /**
-     * Remove cellStyleXf by index
-     *
-     * @param integer $pIndex Index to cellXf
-     * @throws PHPExcel_Exception
-     */
-    public function removeCellStyleXfByIndex($pIndex = 0)
-    {
-        if ($pIndex > count($this->cellStyleXfCollection) - 1) {
-            throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
-        } else {
-            array_splice($this->cellStyleXfCollection, $pIndex, 1);
-        }
-    }
-
-    /**
-     * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells
-     * and columns in the workbook
-     */
-    public function garbageCollect()
-    {
-        // how many references are there to each cellXf ?
-        $countReferencesCellXf = array();
-        foreach ($this->cellXfCollection as $index => $cellXf) {
-            $countReferencesCellXf[$index] = 0;
-        }
-
-        foreach ($this->getWorksheetIterator() as $sheet) {
-            // from cells
-            foreach ($sheet->getCellCollection(false) as $cellID) {
-                $cell = $sheet->getCell($cellID);
-                ++$countReferencesCellXf[$cell->getXfIndex()];
-            }
-
-            // from row dimensions
-            foreach ($sheet->getRowDimensions() as $rowDimension) {
-                if ($rowDimension->getXfIndex() !== null) {
-                    ++$countReferencesCellXf[$rowDimension->getXfIndex()];
-                }
-            }
-
-            // from column dimensions
-            foreach ($sheet->getColumnDimensions() as $columnDimension) {
-                ++$countReferencesCellXf[$columnDimension->getXfIndex()];
-            }
-        }
-
-        // remove cellXfs without references and create mapping so we can update xfIndex
-        // for all cells and columns
-        $countNeededCellXfs = 0;
-        $map = array();
-        foreach ($this->cellXfCollection as $index => $cellXf) {
-            if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
-                ++$countNeededCellXfs;
-            } else {
-                unset($this->cellXfCollection[$index]);
-            }
-            $map[$index] = $countNeededCellXfs - 1;
-        }
-        $this->cellXfCollection = array_values($this->cellXfCollection);
-
-        // update the index for all cellXfs
-        foreach ($this->cellXfCollection as $i => $cellXf) {
-            $cellXf->setIndex($i);
-        }
-
-        // make sure there is always at least one cellXf (there should be)
-        if (empty($this->cellXfCollection)) {
-            $this->cellXfCollection[] = new PHPExcel_Style();
-        }
-
-        // update the xfIndex for all cells, row dimensions, column dimensions
-        foreach ($this->getWorksheetIterator() as $sheet) {
-            // for all cells
-            foreach ($sheet->getCellCollection(false) as $cellID) {
-                $cell = $sheet->getCell($cellID);
-                $cell->setXfIndex($map[$cell->getXfIndex()]);
-            }
-
-            // for all row dimensions
-            foreach ($sheet->getRowDimensions() as $rowDimension) {
-                if ($rowDimension->getXfIndex() !== null) {
-                    $rowDimension->setXfIndex($map[$rowDimension->getXfIndex()]);
-                }
-            }
-
-            // for all column dimensions
-            foreach ($sheet->getColumnDimensions() as $columnDimension) {
-                $columnDimension->setXfIndex($map[$columnDimension->getXfIndex()]);
-            }
-
-            // also do garbage collection for all the sheets
-            $sheet->garbageCollect();
-        }
-    }
-
-    /**
-     * Return the unique ID value assigned to this spreadsheet workbook
-     *
-     * @return string
-     */
-    public function getID()
-    {
-        return $this->uniqueID;
-    }
-}

+ 0 - 81
libs/PHPExcel/PHPExcel/Autoloader.php

xqd
@@ -1,81 +0,0 @@
-<?php
-
-PHPExcel_Autoloader::register();
-//    As we always try to run the autoloader before anything else, we can use it to do a few
-//        simple checks and initialisations
-//PHPExcel_Shared_ZipStreamWrapper::register();
-// check mbstring.func_overload
-if (ini_get('mbstring.func_overload') & 2) {
-    throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
-}
-PHPExcel_Shared_String::buildCharacterSets();
-
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Autoloader
-{
-    /**
-     * Register the Autoloader with SPL
-     *
-     */
-    public static function register()
-    {
-        if (function_exists('__autoload')) {
-            // Register any existing autoloader function with SPL, so we don't get any clashes
-            spl_autoload_register('__autoload');
-        }
-        // Register ourselves with SPL
-        if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
-            return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
-        } else {
-            return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
-        }
-    }
-
-    /**
-     * Autoload a class identified by name
-     *
-     * @param    string    $pClassName        Name of the object to load
-     */
-    public static function load($pClassName)
-    {
-        if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
-            // Either already loaded, or not a PHPExcel class request
-            return false;
-        }
-
-        $pClassFilePath = PHPEXCEL_ROOT .
-            str_replace('_', DIRECTORY_SEPARATOR, $pClassName) .
-            '.php';
-
-        if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
-            // Can't load
-            return false;
-        }
-
-        require($pClassFilePath);
-    }
-}

+ 0 - 290
libs/PHPExcel/PHPExcel/CachedObjectStorage/APC.php

xqd
@@ -1,290 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_APC
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Prefix used to uniquely identify cache data for this worksheet
-     *
-     * @access    private
-     * @var string
-     */
-    private $cachePrefix = null;
-
-    /**
-     * Cache timeout
-     *
-     * @access    private
-     * @var integer
-     */
-    private $cacheTime = 600;
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @access  private
-     * @return  void
-     * @throws  PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            if (!apc_store(
-                $this->cachePrefix . $this->currentObjectID . '.cache',
-                serialize($this->currentObject),
-                $this->cacheTime
-            )) {
-                $this->__destruct();
-                throw new PHPExcel_Exception('Failed to store cell ' . $this->currentObjectID . ' in APC');
-            }
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @access  public
-     * @param   string         $pCoord  Coordinate address of the cell to update
-     * @param   PHPExcel_Cell  $cell    Cell to update
-     * @return  PHPExcel_Cell
-     * @throws  PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-        $this->cellCache[$pCoord] = true;
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
-     *
-     * @access  public
-     * @param   string  $pCoord  Coordinate address of the cell to check
-     * @throws  PHPExcel_Exception
-     * @return  boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        //    Check if the requested entry is the current object, or exists in the cache
-        if (parent::isDataSet($pCoord)) {
-            if ($this->currentObjectID == $pCoord) {
-                return true;
-            }
-            //    Check if the requested entry still exists in apc
-            $success = apc_fetch($this->cachePrefix.$pCoord.'.cache');
-            if ($success === false) {
-                //    Entry no longer exists in APC, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
-            }
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @access  public
-     * @param   string         $pCoord  Coordinate of the cell
-     * @throws  PHPExcel_Exception
-     * @return  PHPExcel_Cell  Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (parent::isDataSet($pCoord)) {
-            $obj = apc_fetch($this->cachePrefix . $pCoord . '.cache');
-            if ($obj === false) {
-                //    Entry no longer exists in APC, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
-            }
-        } else {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = unserialize($obj);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @access  public
-     * @param   string  $pCoord  Coordinate address of the cell to delete
-     * @throws  PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        //    Delete the entry from APC
-        apc_delete($this->cachePrefix.$pCoord.'.cache');
-
-        //    Delete the entry from our cell address array
-        parent::deleteCacheData($pCoord);
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @access  public
-     * @param   PHPExcel_Worksheet  $parent  The new worksheet
-     * @throws  PHPExcel_Exception
-     * @return  void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-        //    Get a new id for the new file name
-        $baseUnique = $this->getUniqueID();
-        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            if ($cellID != $this->currentObjectID) {
-                $obj = apc_fetch($this->cachePrefix . $cellID . '.cache');
-                if ($obj === false) {
-                    //    Entry no longer exists in APC, so clear it from the cache array
-                    parent::deleteCacheData($cellID);
-                    throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC');
-                }
-                if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC');
-                }
-            }
-        }
-        $this->cachePrefix = $newCachePrefix;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return  void
-     */
-    public function unsetWorksheetCells()
-    {
-        if ($this->currentObject !== null) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-
-        //    Flush the APC cache
-        $this->__destruct();
-
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param  PHPExcel_Worksheet  $parent     The worksheet for this cell collection
-     * @param  array of mixed      $arguments  Additional initialisation arguments
-     */
-    public function __construct(PHPExcel_Worksheet $parent, $arguments)
-    {
-        $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
-
-        if ($this->cachePrefix === null) {
-            $baseUnique = $this->getUniqueID();
-            $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
-            $this->cacheTime = $cacheTime;
-
-            parent::__construct($parent);
-        }
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            apc_delete($this->cachePrefix . $cellID . '.cache');
-        }
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return  boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!function_exists('apc_store')) {
-            return false;
-        }
-        if (apc_sma_info() === false) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 368
libs/PHPExcel/PHPExcel/CachedObjectStorage/CacheBase.php

xqd
@@ -1,368 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_CacheBase
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-abstract class PHPExcel_CachedObjectStorage_CacheBase
-{
-    /**
-     * Parent worksheet
-     *
-     * @var PHPExcel_Worksheet
-     */
-    protected $parent;
-
-    /**
-     * The currently active Cell
-     *
-     * @var PHPExcel_Cell
-     */
-    protected $currentObject = null;
-
-    /**
-     * Coordinate address of the currently active Cell
-     *
-     * @var string
-     */
-    protected $currentObjectID = null;
-
-    /**
-     * Flag indicating whether the currently active Cell requires saving
-     *
-     * @var boolean
-     */
-    protected $currentCellIsDirty = true;
-
-    /**
-     * An array of cells or cell pointers for the worksheet cells held in this cache,
-     *        and indexed by their coordinate address within the worksheet
-     *
-     * @var array of mixed
-     */
-    protected $cellCache = array();
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     */
-    public function __construct(PHPExcel_Worksheet $parent)
-    {
-        //    Set our parent worksheet.
-        //    This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
-        //        they are woken from a serialized state
-        $this->parent = $parent;
-    }
-
-    /**
-     * Return the parent worksheet for this cell collection
-     *
-     * @return    PHPExcel_Worksheet
-     */
-    public function getParent()
-    {
-        return $this->parent;
-    }
-
-    /**
-     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return true;
-        }
-        //    Check if the requested entry exists in the cache
-        return isset($this->cellCache[$pCoord]);
-    }
-
-    /**
-     * Move a cell object from one address to another
-     *
-     * @param    string        $fromAddress    Current address of the cell to move
-     * @param    string        $toAddress        Destination address of the cell to move
-     * @return    boolean
-     */
-    public function moveCell($fromAddress, $toAddress)
-    {
-        if ($fromAddress === $this->currentObjectID) {
-            $this->currentObjectID = $toAddress;
-        }
-        $this->currentCellIsDirty = true;
-        if (isset($this->cellCache[$fromAddress])) {
-            $this->cellCache[$toAddress] = &$this->cellCache[$fromAddress];
-            unset($this->cellCache[$fromAddress]);
-        }
-
-        return true;
-    }
-
-    /**
-     * Add or Update a cell in cache
-     *
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function updateCacheData(PHPExcel_Cell $cell)
-    {
-        return $this->addCacheData($cell->getCoordinate(), $cell);
-    }
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID && !is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObjectID = $this->currentObject = null;
-        }
-
-        if (is_object($this->cellCache[$pCoord])) {
-            $this->cellCache[$pCoord]->detach();
-            unset($this->cellCache[$pCoord]);
-        }
-        $this->currentCellIsDirty = false;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return    string[]
-     */
-    public function getCellList()
-    {
-        return array_keys($this->cellCache);
-    }
-
-    /**
-     * Sort the list of all cell addresses currently held in cache by row and column
-     *
-     * @return    string[]
-     */
-    public function getSortedCellList()
-    {
-        $sortKeys = array();
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $column, $row);
-            $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord;
-        }
-        ksort($sortKeys);
-
-        return array_values($sortKeys);
-    }
-
-    /**
-     * Get highest worksheet column and highest row that have cell records
-     *
-     * @return array Highest column name and highest row number
-     */
-    public function getHighestRowAndColumn()
-    {
-        // Lookup highest column and highest row
-        $col = array('A' => '1A');
-        $row = array(1);
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $c, $r);
-            $row[$r] = $r;
-            $col[$c] = strlen($c).$c;
-        }
-        if (!empty($row)) {
-            // Determine highest column and row
-            $highestRow = max($row);
-            $highestColumn = substr(max($col), 1);
-        }
-
-        return array(
-            'row'    => $highestRow,
-            'column' => $highestColumn
-        );
-    }
-
-    /**
-     * Return the cell address of the currently active cell object
-     *
-     * @return    string
-     */
-    public function getCurrentAddress()
-    {
-        return $this->currentObjectID;
-    }
-
-    /**
-     * Return the column address of the currently active cell object
-     *
-     * @return    string
-     */
-    public function getCurrentColumn()
-    {
-        sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
-        return $column;
-    }
-
-    /**
-     * Return the row address of the currently active cell object
-     *
-     * @return    integer
-     */
-    public function getCurrentRow()
-    {
-        sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
-        return (integer) $row;
-    }
-
-    /**
-     * Get highest worksheet column
-     *
-     * @param   string     $row        Return the highest column for the specified row,
-     *                                     or the highest column of any row if no row number is passed
-     * @return  string     Highest column name
-     */
-    public function getHighestColumn($row = null)
-    {
-        if ($row == null) {
-            $colRow = $this->getHighestRowAndColumn();
-            return $colRow['column'];
-        }
-
-        $columnList = array(1);
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $c, $r);
-            if ($r != $row) {
-                continue;
-            }
-            $columnList[] = PHPExcel_Cell::columnIndexFromString($c);
-        }
-        return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
-    }
-
-    /**
-     * Get highest worksheet row
-     *
-     * @param   string     $column     Return the highest row for the specified column,
-     *                                     or the highest row of any column if no column letter is passed
-     * @return  int        Highest row number
-     */
-    public function getHighestRow($column = null)
-    {
-        if ($column == null) {
-            $colRow = $this->getHighestRowAndColumn();
-            return $colRow['row'];
-        }
-
-        $rowList = array(0);
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $c, $r);
-            if ($c != $column) {
-                continue;
-            }
-            $rowList[] = $r;
-        }
-
-        return max($rowList);
-    }
-
-    /**
-     * Generate a unique ID for cache referencing
-     *
-     * @return string Unique Reference
-     */
-    protected function getUniqueID()
-    {
-        if (function_exists('posix_getpid')) {
-            $baseUnique = posix_getpid();
-        } else {
-            $baseUnique = mt_rand();
-        }
-        return uniqid($baseUnique, true);
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        $this->currentCellIsDirty;
-        $this->storeData();
-
-        $this->parent = $parent;
-        if (($this->currentObject !== null) && (is_object($this->currentObject))) {
-            $this->currentObject->attach($this);
-        }
-    }    //    function copyCellCollection()
-
-    /**
-     * Remove a row, deleting all cells in that row
-     *
-     * @param string    $row    Row number to remove
-     * @return void
-     */
-    public function removeRow($row)
-    {
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $c, $r);
-            if ($r == $row) {
-                $this->deleteCacheData($coord);
-            }
-        }
-    }
-
-    /**
-     * Remove a column, deleting all cells in that column
-     *
-     * @param string    $column    Column ID to remove
-     * @return void
-     */
-    public function removeColumn($column)
-    {
-        foreach ($this->getCellList() as $coord) {
-            sscanf($coord, '%[A-Z]%d', $c, $r);
-            if ($c == $column) {
-                $this->deleteCacheData($coord);
-            }
-        }
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        return true;
-    }
-}

+ 0 - 208
libs/PHPExcel/PHPExcel/CachedObjectStorage/DiscISAM.php

xqd
@@ -1,208 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_DiscISAM
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Name of the file for this cache
-     *
-     * @var string
-     */
-    private $fileName = null;
-
-    /**
-     * File handle for this cache file
-     *
-     * @var resource
-     */
-    private $fileHandle = null;
-
-    /**
-     * Directory/Folder where the cache file is located
-     *
-     * @var string
-     */
-    private $cacheDirectory = null;
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            fseek($this->fileHandle, 0, SEEK_END);
-
-            $this->cellCache[$this->currentObjectID] = array(
-                'ptr' => ftell($this->fileHandle),
-                'sz'  => fwrite($this->fileHandle, serialize($this->currentObject))
-            );
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
-        $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-        //    Get a new id for the new file name
-        $baseUnique = $this->getUniqueID();
-        $newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
-        //    Copy the existing cell cache file
-        copy($this->fileName, $newFileName);
-        $this->fileName = $newFileName;
-        //    Open the copied cell cache file
-        $this->fileHandle = fopen($this->fileName, 'a+');
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-
-        //    Close down the temporary cache file
-        $this->__destruct();
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     * @param    array of mixed        $arguments    Additional initialisation arguments
-     */
-    public function __construct(PHPExcel_Worksheet $parent, $arguments)
-    {
-        $this->cacheDirectory    = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
-                                    ? $arguments['dir']
-                                    : PHPExcel_Shared_File::sys_get_temp_dir();
-
-        parent::__construct($parent);
-        if (is_null($this->fileHandle)) {
-            $baseUnique = $this->getUniqueID();
-            $this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
-            $this->fileHandle = fopen($this->fileName, 'a+');
-        }
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        if (!is_null($this->fileHandle)) {
-            fclose($this->fileHandle);
-            unlink($this->fileName);
-        }
-        $this->fileHandle = null;
-    }
-}

+ 0 - 103
libs/PHPExcel/PHPExcel/CachedObjectStorage/ICache.php

xqd
@@ -1,103 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_ICache
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-interface PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell);
-
-    /**
-     * Add or Update a cell in cache
-     *
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function updateCacheData(PHPExcel_Cell $cell);
-
-    /**
-     * Fetch a cell from cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to retrieve
-     * @return PHPExcel_Cell     Cell that was found, or null if not found
-     * @throws    PHPExcel_Exception
-     */
-    public function getCacheData($pCoord);
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord);
-
-    /**
-     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     */
-    public function isDataSet($pCoord);
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return    string[]
-     */
-    public function getCellList();
-
-    /**
-     * Get the list of all cell addresses currently held in cache sorted by column and row
-     *
-     * @return    string[]
-     */
-    public function getSortedCellList();
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent);
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable();
-}

+ 0 - 149
libs/PHPExcel/PHPExcel/CachedObjectStorage/Igbinary.php

xqd
@@ -1,149 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_Igbinary
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject);
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }    //    function _storeData()
-
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }    //    function addCacheData()
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }    //    function getCacheData()
-
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }    //    function unsetWorksheetCells()
-
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!function_exists('igbinary_serialize')) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 308
libs/PHPExcel/PHPExcel/CachedObjectStorage/Memcache.php

xqd
@@ -1,308 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_Memcache
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Prefix used to uniquely identify cache data for this worksheet
-     *
-     * @var string
-     */
-    private $cachePrefix = null;
-
-    /**
-     * Cache timeout
-     *
-     * @var integer
-     */
-    private $cacheTime = 600;
-
-    /**
-     * Memcache interface
-     *
-     * @var resource
-     */
-    private $memcache = null;
-
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $obj = serialize($this->currentObject);
-            if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
-                if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception("Failed to store cell {$this->currentObjectID} in MemCache");
-                }
-            }
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }    //    function _storeData()
-
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-        $this->cellCache[$pCoord] = true;
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }    //    function addCacheData()
-
-
-    /**
-     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     * @return    boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        //    Check if the requested entry is the current object, or exists in the cache
-        if (parent::isDataSet($pCoord)) {
-            if ($this->currentObjectID == $pCoord) {
-                return true;
-            }
-            //    Check if the requested entry still exists in Memcache
-            $success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache');
-            if ($success === false) {
-                //    Entry no longer exists in Memcache, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
-            }
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (parent::isDataSet($pCoord)) {
-            $obj = $this->memcache->get($this->cachePrefix . $pCoord . '.cache');
-            if ($obj === false) {
-                //    Entry no longer exists in Memcache, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception("Cell entry {$pCoord} no longer exists in MemCache");
-            }
-        } else {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = unserialize($obj);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        //    Delete the entry from Memcache
-        $this->memcache->delete($this->cachePrefix . $pCoord . '.cache');
-
-        //    Delete the entry from our cell address array
-        parent::deleteCacheData($pCoord);
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-        //    Get a new id for the new file name
-        $baseUnique = $this->getUniqueID();
-        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            if ($cellID != $this->currentObjectID) {
-                $obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache');
-                if ($obj === false) {
-                    //    Entry no longer exists in Memcache, so clear it from the cache array
-                    parent::deleteCacheData($cellID);
-                    throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache");
-                }
-                if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache");
-                }
-            }
-        }
-        $this->cachePrefix = $newCachePrefix;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-
-        //    Flush the Memcache cache
-        $this->__destruct();
-
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     * @param    array of mixed        $arguments    Additional initialisation arguments
-     */
-    public function __construct(PHPExcel_Worksheet $parent, $arguments)
-    {
-        $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
-        $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
-        $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
-
-        if (is_null($this->cachePrefix)) {
-            $baseUnique = $this->getUniqueID();
-            $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
-
-            //    Set a new Memcache object and connect to the Memcache server
-            $this->memcache = new Memcache();
-            if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
-                throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
-            }
-            $this->cacheTime = $cacheTime;
-
-            parent::__construct($parent);
-        }
-    }
-
-    /**
-     * Memcache error handler
-     *
-     * @param    string    $host        Memcache server
-     * @param    integer    $port        Memcache port
-     * @throws    PHPExcel_Exception
-     */
-    public function failureCallback($host, $port)
-    {
-        throw new PHPExcel_Exception("memcache {$host}:{$port} failed");
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            $this->memcache->delete($this->cachePrefix.$cellID . '.cache');
-        }
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!function_exists('memcache_add')) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 118
libs/PHPExcel/PHPExcel/CachedObjectStorage/Memory.php

xqd
@@ -1,118 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_Memory
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Dummy method callable from CacheBase, but unused by Memory cache
-     *
-     * @return    void
-     */
-    protected function storeData()
-    {
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        $this->cellCache[$pCoord] = $cell;
-
-        //    Set current entry to the new/updated entry
-        $this->currentObjectID = $pCoord;
-
-        return $cell;
-    }
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            $this->currentObjectID = null;
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-
-        //    Return requested entry
-        return $this->cellCache[$pCoord];
-    }
-
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-
-        $newCollection = array();
-        foreach ($this->cellCache as $k => &$cell) {
-            $newCollection[$k] = clone $cell;
-            $newCollection[$k]->attach($this);
-        }
-
-        $this->cellCache = $newCollection;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     */
-    public function unsetWorksheetCells()
-    {
-        // Because cells are all stored as intact objects in memory, we need to detach each one from the parent
-        foreach ($this->cellCache as $k => &$cell) {
-            $cell->detach();
-            $this->cellCache[$k] = null;
-        }
-        unset($cell);
-
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-}

+ 0 - 133
libs/PHPExcel/PHPExcel/CachedObjectStorage/MemoryGZip.php

xqd
@@ -1,133 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_MemoryGZip
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $this->cellCache[$this->currentObjectID] = gzdeflate(serialize($this->currentObject));
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = unserialize(gzinflate($this->cellCache[$pCoord]));
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-}

+ 0 - 129
libs/PHPExcel/PHPExcel/CachedObjectStorage/MemorySerialized.php

xqd
@@ -1,129 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_MemorySerialized
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $this->cellCache[$this->currentObjectID] = serialize($this->currentObject);
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = unserialize($this->cellCache[$pCoord]);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-}

+ 0 - 200
libs/PHPExcel/PHPExcel/CachedObjectStorage/PHPTemp.php

xqd
@@ -1,200 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_PHPTemp
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Name of the file for this cache
-     *
-     * @var string
-     */
-    private $fileHandle = null;
-
-    /**
-     * Memory limit to use before reverting to file cache
-     *
-     * @var integer
-     */
-    private $memoryCacheSize = null;
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            fseek($this->fileHandle, 0, SEEK_END);
-
-            $this->cellCache[$this->currentObjectID] = array(
-                'ptr' => ftell($this->fileHandle),
-                'sz'  => fwrite($this->fileHandle, serialize($this->currentObject))
-            );
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        if (!isset($this->cellCache[$pCoord])) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
-        $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-        //    Open a new stream for the cell cache data
-        $newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
-        //    Copy the existing cell cache data to the new stream
-        fseek($this->fileHandle, 0);
-        while (!feof($this->fileHandle)) {
-            fwrite($newFileHandle, fread($this->fileHandle, 1024));
-        }
-        $this->fileHandle = $newFileHandle;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-
-        //    Close down the php://temp file
-        $this->__destruct();
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     * @param    array of mixed        $arguments    Additional initialisation arguments
-     */
-    public function __construct(PHPExcel_Worksheet $parent, $arguments)
-    {
-        $this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
-
-        parent::__construct($parent);
-        if (is_null($this->fileHandle)) {
-            $this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
-        }
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        if (!is_null($this->fileHandle)) {
-            fclose($this->fileHandle);
-        }
-        $this->fileHandle = null;
-    }
-}

+ 0 - 307
libs/PHPExcel/PHPExcel/CachedObjectStorage/SQLite.php

xqd
@@ -1,307 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_SQLite
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Database table name
-     *
-     * @var string
-     */
-    private $TableName = null;
-
-    /**
-     * Database handle
-     *
-     * @var resource
-     */
-    private $DBHandle = null;
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            if (!$this->DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES('".$this->currentObjectID."','".sqlite_escape_string(serialize($this->currentObject))."')")) {
-                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-            }
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        $query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
-        $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
-        if ($cellResultSet === false) {
-            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-        } elseif ($cellResultSet->numRows() == 0) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-
-        $cellResult = $cellResultSet->fetchSingle();
-        $this->currentObject = unserialize($cellResult);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     * Is a value set for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return true;
-        }
-
-        //    Check if the requested entry exists in the cache
-        $query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
-        $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
-        if ($cellResultSet === false) {
-            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-        } elseif ($cellResultSet->numRows() == 0) {
-            //    Return null if requested entry doesn't exist in cache
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            $this->currentObject->detach();
-            $this->currentObjectID = $this->currentObject = null;
-        }
-
-        //    Check if the requested entry exists in the cache
-        $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
-        if (!$this->DBHandle->queryExec($query)) {
-            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-        }
-
-        $this->currentCellIsDirty = false;
-    }
-
-    /**
-     * Move a cell object from one address to another
-     *
-     * @param    string        $fromAddress    Current address of the cell to move
-     * @param    string        $toAddress        Destination address of the cell to move
-     * @return    boolean
-     */
-    public function moveCell($fromAddress, $toAddress)
-    {
-        if ($fromAddress === $this->currentObjectID) {
-            $this->currentObjectID = $toAddress;
-        }
-
-        $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'";
-        $result = $this->DBHandle->exec($query);
-        if ($result === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        $query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
-        $result = $this->DBHandle->exec($query);
-        if ($result === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        return true;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return    string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        $query = "SELECT id FROM kvp_".$this->TableName;
-        $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
-        if ($cellIdsResult === false) {
-            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-        }
-
-        $cellKeys = array();
-        foreach ($cellIdsResult as $row) {
-            $cellKeys[] = $row['id'];
-        }
-
-        return $cellKeys;
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        $this->currentCellIsDirty;
-        $this->storeData();
-
-        //    Get a new id for the new table name
-        $tableName = str_replace('.', '_', $this->getUniqueID());
-        if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
-            AS SELECT * FROM kvp_'.$this->TableName)
-        ) {
-            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-        }
-
-        //    Copy the existing cell cache file
-        $this->TableName = $tableName;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-
-        //    Close down the temporary cache file
-        $this->__destruct();
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     */
-    public function __construct(PHPExcel_Worksheet $parent)
-    {
-        parent::__construct($parent);
-        if (is_null($this->DBHandle)) {
-            $this->TableName = str_replace('.', '_', $this->getUniqueID());
-            $_DBName = ':memory:';
-
-            $this->DBHandle = new SQLiteDatabase($_DBName);
-            if ($this->DBHandle === false) {
-                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-            }
-            if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
-                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
-            }
-        }
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        if (!is_null($this->DBHandle)) {
-            $this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName);
-        }
-        $this->DBHandle = null;
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!function_exists('sqlite_open')) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 346
libs/PHPExcel/PHPExcel/CachedObjectStorage/SQLite3.php

xqd
@@ -1,346 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_SQLite3
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Database table name
-     *
-     * @var string
-     */
-    private $TableName = null;
-
-    /**
-     * Database handle
-     *
-     * @var resource
-     */
-    private $DBHandle = null;
-
-    /**
-     * Prepared statement for a SQLite3 select query
-     *
-     * @var SQLite3Stmt
-     */
-    private $selectQuery;
-
-    /**
-     * Prepared statement for a SQLite3 insert query
-     *
-     * @var SQLite3Stmt
-     */
-    private $insertQuery;
-
-    /**
-     * Prepared statement for a SQLite3 update query
-     *
-     * @var SQLite3Stmt
-     */
-    private $updateQuery;
-
-    /**
-     * Prepared statement for a SQLite3 delete query
-     *
-     * @var SQLite3Stmt
-     */
-    private $deleteQuery;
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $this->insertQuery->bindValue('id', $this->currentObjectID, SQLITE3_TEXT);
-            $this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
-            $result = $this->insertQuery->execute();
-            if ($result === false) {
-                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-            }
-            $this->currentCellIsDirty = false;
-        }
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param     string             $pCoord        Coordinate of the cell
-     * @throws     PHPExcel_Exception
-     * @return     PHPExcel_Cell     Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
-        $cellResult = $this->selectQuery->execute();
-        if ($cellResult === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-        $cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
-        if ($cellData === false) {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-
-        $this->currentObject = unserialize($cellData['value']);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-    /**
-     *    Is a value set for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return true;
-        }
-
-        //    Check if the requested entry exists in the cache
-        $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
-        $cellResult = $this->selectQuery->execute();
-        if ($cellResult === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-        $cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
-
-        return ($cellData === false) ? false : true;
-    }
-
-    /**
-     *    Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            $this->currentObject->detach();
-            $this->currentObjectID = $this->currentObject = null;
-        }
-
-        //    Check if the requested entry exists in the cache
-        $this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
-        $result = $this->deleteQuery->execute();
-        if ($result === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        $this->currentCellIsDirty = false;
-    }
-
-    /**
-     * Move a cell object from one address to another
-     *
-     * @param    string        $fromAddress    Current address of the cell to move
-     * @param    string        $toAddress        Destination address of the cell to move
-     * @return    boolean
-     */
-    public function moveCell($fromAddress, $toAddress)
-    {
-        if ($fromAddress === $this->currentObjectID) {
-            $this->currentObjectID = $toAddress;
-        }
-
-        $this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
-        $result = $this->deleteQuery->execute();
-        if ($result === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        $this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
-        $this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
-        $result = $this->updateQuery->execute();
-        if ($result === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        return true;
-    }
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return    string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        $query = "SELECT id FROM kvp_".$this->TableName;
-        $cellIdsResult = $this->DBHandle->query($query);
-        if ($cellIdsResult === false) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        $cellKeys = array();
-        while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
-            $cellKeys[] = $row['id'];
-        }
-
-        return $cellKeys;
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        $this->currentCellIsDirty;
-        $this->storeData();
-
-        //    Get a new id for the new table name
-        $tableName = str_replace('.', '_', $this->getUniqueID());
-        if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
-            AS SELECT * FROM kvp_'.$this->TableName)
-        ) {
-            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-        }
-
-        //    Copy the existing cell cache file
-        $this->TableName = $tableName;
-    }
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-
-        //    Close down the temporary cache file
-        $this->__destruct();
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     */
-    public function __construct(PHPExcel_Worksheet $parent)
-    {
-        parent::__construct($parent);
-        if (is_null($this->DBHandle)) {
-            $this->TableName = str_replace('.', '_', $this->getUniqueID());
-            $_DBName = ':memory:';
-
-            $this->DBHandle = new SQLite3($_DBName);
-            if ($this->DBHandle === false) {
-                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-            }
-            if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
-                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
-            }
-        }
-
-        $this->selectQuery = $this->DBHandle->prepare("SELECT value FROM kvp_".$this->TableName." WHERE id = :id");
-        $this->insertQuery = $this->DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES(:id,:data)");
-        $this->updateQuery = $this->DBHandle->prepare("UPDATE kvp_".$this->TableName." SET id=:toId WHERE id=:fromId");
-        $this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_".$this->TableName." WHERE id = :id");
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        if (!is_null($this->DBHandle)) {
-            $this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName);
-            $this->DBHandle->close();
-        }
-        $this->DBHandle = null;
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!class_exists('SQLite3', false)) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 289
libs/PHPExcel/PHPExcel/CachedObjectStorage/Wincache.php

xqd
@@ -1,289 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorage_Wincache
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
-{
-    /**
-     * Prefix used to uniquely identify cache data for this worksheet
-     *
-     * @var string
-     */
-    private $cachePrefix = null;
-
-    /**
-     * Cache timeout
-     *
-     * @var integer
-     */
-    private $cacheTime = 600;
-
-
-    /**
-     * Store cell data in cache for the current cell object if it's "dirty",
-     *     and the 'nullify' the current cell object
-     *
-     * @return    void
-     * @throws    PHPExcel_Exception
-     */
-    protected function storeData()
-    {
-        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
-            $this->currentObject->detach();
-
-            $obj = serialize($this->currentObject);
-            if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
-                if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
-                }
-            } else {
-                if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
-                }
-            }
-            $this->currentCellIsDirty = false;
-        }
-
-        $this->currentObjectID = $this->currentObject = null;
-    }
-
-    /**
-     * Add or Update a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to update
-     * @param    PHPExcel_Cell    $cell        Cell to update
-     * @return    PHPExcel_Cell
-     * @throws    PHPExcel_Exception
-     */
-    public function addCacheData($pCoord, PHPExcel_Cell $cell)
-    {
-        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
-            $this->storeData();
-        }
-        $this->cellCache[$pCoord] = true;
-
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = $cell;
-        $this->currentCellIsDirty = true;
-
-        return $cell;
-    }
-
-    /**
-     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
-     *
-     * @param    string        $pCoord        Coordinate address of the cell to check
-     * @return    boolean
-     */
-    public function isDataSet($pCoord)
-    {
-        //    Check if the requested entry is the current object, or exists in the cache
-        if (parent::isDataSet($pCoord)) {
-            if ($this->currentObjectID == $pCoord) {
-                return true;
-            }
-            //    Check if the requested entry still exists in cache
-            $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache');
-            if ($success === false) {
-                //    Entry no longer exists in Wincache, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
-            }
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Get cell at a specific coordinate
-     *
-     * @param    string            $pCoord        Coordinate of the cell
-     * @throws    PHPExcel_Exception
-     * @return    PHPExcel_Cell    Cell that was found, or null if not found
-     */
-    public function getCacheData($pCoord)
-    {
-        if ($pCoord === $this->currentObjectID) {
-            return $this->currentObject;
-        }
-        $this->storeData();
-
-        //    Check if the entry that has been requested actually exists
-        $obj = null;
-        if (parent::isDataSet($pCoord)) {
-            $success = false;
-            $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success);
-            if ($success === false) {
-                //    Entry no longer exists in WinCache, so clear it from the cache array
-                parent::deleteCacheData($pCoord);
-                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
-            }
-        } else {
-            //    Return null if requested entry doesn't exist in cache
-            return null;
-        }
-
-        //    Set current entry to the requested entry
-        $this->currentObjectID = $pCoord;
-        $this->currentObject = unserialize($obj);
-        //    Re-attach this as the cell's parent
-        $this->currentObject->attach($this);
-
-        //    Return requested entry
-        return $this->currentObject;
-    }
-
-
-    /**
-     * Get a list of all cell addresses currently held in cache
-     *
-     * @return  string[]
-     */
-    public function getCellList()
-    {
-        if ($this->currentObjectID !== null) {
-            $this->storeData();
-        }
-
-        return parent::getCellList();
-    }
-
-    /**
-     * Delete a cell in cache identified by coordinate address
-     *
-     * @param    string            $pCoord        Coordinate address of the cell to delete
-     * @throws    PHPExcel_Exception
-     */
-    public function deleteCacheData($pCoord)
-    {
-        //    Delete the entry from Wincache
-        wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache');
-
-        //    Delete the entry from our cell address array
-        parent::deleteCacheData($pCoord);
-    }
-
-    /**
-     * Clone the cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The new worksheet
-     * @return    void
-     */
-    public function copyCellCollection(PHPExcel_Worksheet $parent)
-    {
-        parent::copyCellCollection($parent);
-        //    Get a new id for the new file name
-        $baseUnique = $this->getUniqueID();
-        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            if ($cellID != $this->currentObjectID) {
-                $success = false;
-                $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success);
-                if ($success === false) {
-                    //    Entry no longer exists in WinCache, so clear it from the cache array
-                    parent::deleteCacheData($cellID);
-                    throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
-                }
-                if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) {
-                    $this->__destruct();
-                    throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
-                }
-            }
-        }
-        $this->cachePrefix = $newCachePrefix;
-    }
-
-
-    /**
-     * Clear the cell collection and disconnect from our parent
-     *
-     * @return    void
-     */
-    public function unsetWorksheetCells()
-    {
-        if (!is_null($this->currentObject)) {
-            $this->currentObject->detach();
-            $this->currentObject = $this->currentObjectID = null;
-        }
-
-        //    Flush the WinCache cache
-        $this->__destruct();
-
-        $this->cellCache = array();
-
-        //    detach ourself from the worksheet, so that it can then delete this object successfully
-        $this->parent = null;
-    }
-
-    /**
-     * Initialise this new cell collection
-     *
-     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
-     * @param    array of mixed        $arguments    Additional initialisation arguments
-     */
-    public function __construct(PHPExcel_Worksheet $parent, $arguments)
-    {
-        $cacheTime    = (isset($arguments['cacheTime']))    ? $arguments['cacheTime']    : 600;
-
-        if (is_null($this->cachePrefix)) {
-            $baseUnique = $this->getUniqueID();
-            $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.';
-            $this->cacheTime = $cacheTime;
-
-            parent::__construct($parent);
-        }
-    }
-
-    /**
-     * Destroy this cell collection
-     */
-    public function __destruct()
-    {
-        $cacheList = $this->getCellList();
-        foreach ($cacheList as $cellID) {
-            wincache_ucache_delete($this->cachePrefix.$cellID.'.cache');
-        }
-    }
-
-    /**
-     * Identify whether the caching method is currently available
-     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
-     *
-     * @return    boolean
-     */
-    public static function cacheMethodIsAvailable()
-    {
-        if (!function_exists('wincache_ucache_add')) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 231
libs/PHPExcel/PHPExcel/CachedObjectStorageFactory.php

xqd
@@ -1,231 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CachedObjectStorageFactory
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_CachedObjectStorage
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CachedObjectStorageFactory
-{
-    const cache_in_memory               = 'Memory';
-    const cache_in_memory_gzip          = 'MemoryGZip';
-    const cache_in_memory_serialized    = 'MemorySerialized';
-    const cache_igbinary                = 'Igbinary';
-    const cache_to_discISAM             = 'DiscISAM';
-    const cache_to_apc                  = 'APC';
-    const cache_to_memcache             = 'Memcache';
-    const cache_to_phpTemp              = 'PHPTemp';
-    const cache_to_wincache             = 'Wincache';
-    const cache_to_sqlite               = 'SQLite';
-    const cache_to_sqlite3              = 'SQLite3';
-
-    /**
-     * Name of the method used for cell cacheing
-     *
-     * @var string
-     */
-    private static $cacheStorageMethod = null;
-
-    /**
-     * Name of the class used for cell cacheing
-     *
-     * @var string
-     */
-    private static $cacheStorageClass = null;
-
-    /**
-     * List of all possible cache storage methods
-     *
-     * @var string[]
-     */
-    private static $storageMethods = array(
-        self::cache_in_memory,
-        self::cache_in_memory_gzip,
-        self::cache_in_memory_serialized,
-        self::cache_igbinary,
-        self::cache_to_phpTemp,
-        self::cache_to_discISAM,
-        self::cache_to_apc,
-        self::cache_to_memcache,
-        self::cache_to_wincache,
-        self::cache_to_sqlite,
-        self::cache_to_sqlite3,
-    );
-
-    /**
-     * Default arguments for each cache storage method
-     *
-     * @var array of mixed array
-     */
-    private static $storageMethodDefaultParameters = array(
-        self::cache_in_memory               => array(
-                                                    ),
-        self::cache_in_memory_gzip          => array(
-                                                    ),
-        self::cache_in_memory_serialized    => array(
-                                                    ),
-        self::cache_igbinary                => array(
-                                                    ),
-        self::cache_to_phpTemp              => array( 'memoryCacheSize' => '1MB'
-                                                    ),
-        self::cache_to_discISAM             => array( 'dir'             => null
-                                                    ),
-        self::cache_to_apc                  => array( 'cacheTime'       => 600
-                                                    ),
-        self::cache_to_memcache             => array( 'memcacheServer'  => 'localhost',
-                                                      'memcachePort'    => 11211,
-                                                      'cacheTime'       => 600
-                                                    ),
-        self::cache_to_wincache             => array( 'cacheTime'       => 600
-                                                    ),
-        self::cache_to_sqlite               => array(
-                                                    ),
-        self::cache_to_sqlite3              => array(
-                                                    ),
-    );
-
-    /**
-     * Arguments for the active cache storage method
-     *
-     * @var array of mixed array
-     */
-    private static $storageMethodParameters = array();
-
-    /**
-     * Return the current cache storage method
-     *
-     * @return string|null
-     **/
-    public static function getCacheStorageMethod()
-    {
-        return self::$cacheStorageMethod;
-    }
-
-    /**
-     * Return the current cache storage class
-     *
-     * @return PHPExcel_CachedObjectStorage_ICache|null
-     **/
-    public static function getCacheStorageClass()
-    {
-        return self::$cacheStorageClass;
-    }
-
-    /**
-     * Return the list of all possible cache storage methods
-     *
-     * @return string[]
-     **/
-    public static function getAllCacheStorageMethods()
-    {
-        return self::$storageMethods;
-    }
-
-    /**
-     * Return the list of all available cache storage methods
-     *
-     * @return string[]
-     **/
-    public static function getCacheStorageMethods()
-    {
-        $activeMethods = array();
-        foreach (self::$storageMethods as $storageMethod) {
-            $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
-            if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
-                $activeMethods[] = $storageMethod;
-            }
-        }
-        return $activeMethods;
-    }
-
-    /**
-     * Identify the cache storage method to use
-     *
-     * @param    string            $method        Name of the method to use for cell cacheing
-     * @param    array of mixed    $arguments    Additional arguments to pass to the cell caching class
-     *                                        when instantiating
-     * @return boolean
-     **/
-    public static function initialize($method = self::cache_in_memory, $arguments = array())
-    {
-        if (!in_array($method, self::$storageMethods)) {
-            return false;
-        }
-
-        $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
-        if (!call_user_func(array( $cacheStorageClass,
-                                   'cacheMethodIsAvailable'))) {
-            return false;
-        }
-
-        self::$storageMethodParameters[$method] = self::$storageMethodDefaultParameters[$method];
-        foreach ($arguments as $k => $v) {
-            if (array_key_exists($k, self::$storageMethodParameters[$method])) {
-                self::$storageMethodParameters[$method][$k] = $v;
-            }
-        }
-
-        if (self::$cacheStorageMethod === null) {
-            self::$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
-            self::$cacheStorageMethod = $method;
-        }
-        return true;
-    }
-
-    /**
-     * Initialise the cache storage
-     *
-     * @param    PHPExcel_Worksheet     $parent        Enable cell caching for this worksheet
-     * @return    PHPExcel_CachedObjectStorage_ICache
-     **/
-    public static function getInstance(PHPExcel_Worksheet $parent)
-    {
-        $cacheMethodIsAvailable = true;
-        if (self::$cacheStorageMethod === null) {
-            $cacheMethodIsAvailable = self::initialize();
-        }
-
-        if ($cacheMethodIsAvailable) {
-            $instance = new self::$cacheStorageClass(
-                $parent,
-                self::$storageMethodParameters[self::$cacheStorageMethod]
-            );
-            if ($instance !== null) {
-                return $instance;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Clear the cache storage
-     *
-     **/
-    public static function finalize()
-    {
-        self::$cacheStorageMethod = null;
-        self::$cacheStorageClass = null;
-        self::$storageMethodParameters = array();
-    }
-}

+ 0 - 94
libs/PHPExcel/PHPExcel/CalcEngine/CyclicReferenceStack.php

xqd
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CalcEngine_CyclicReferenceStack
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CalcEngine_CyclicReferenceStack
-{
-    /**
-     *  The call stack for calculated cells
-     *
-     *  @var mixed[]
-     */
-    private $stack = array();
-
-    /**
-     * Return the number of entries on the stack
-     *
-     * @return  integer
-     */
-    public function count()
-    {
-        return count($this->stack);
-    }
-
-    /**
-     * Push a new entry onto the stack
-     *
-     * @param  mixed  $value
-     */
-    public function push($value)
-    {
-        $this->stack[$value] = $value;
-    }
-
-    /**
-     * Pop the last entry from the stack
-     *
-     * @return  mixed
-     */
-    public function pop()
-    {
-        return array_pop($this->stack);
-    }
-
-    /**
-     * Test to see if a specified entry exists on the stack
-     *
-     * @param  mixed  $value  The value to test
-     */
-    public function onStack($value)
-    {
-        return isset($this->stack[$value]);
-    }
-
-    /**
-     * Clear the stack
-     */
-    public function clear()
-    {
-        $this->stack = array();
-    }
-
-    /**
-     * Return an array of all entries on the stack
-     *
-     * @return  mixed[]
-     */
-    public function showStack()
-    {
-        return $this->stack;
-    }
-}

+ 0 - 151
libs/PHPExcel/PHPExcel/CalcEngine/Logger.php

xqd
@@ -1,151 +0,0 @@
-<?php
-
-/**
- * PHPExcel_CalcEngine_Logger
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_CalcEngine_Logger
-{
-    /**
-     * Flag to determine whether a debug log should be generated by the calculation engine
-     *        If true, then a debug log will be generated
-     *        If false, then a debug log will not be generated
-     *
-     * @var boolean
-     */
-    private $writeDebugLog = false;
-
-    /**
-     * Flag to determine whether a debug log should be echoed by the calculation engine
-     *        If true, then a debug log will be echoed
-     *        If false, then a debug log will not be echoed
-     * A debug log can only be echoed if it is generated
-     *
-     * @var boolean
-     */
-    private $echoDebugLog = false;
-
-    /**
-     * The debug log generated by the calculation engine
-     *
-     * @var string[]
-     */
-    private $debugLog = array();
-
-    /**
-     * The calculation engine cell reference stack
-     *
-     * @var PHPExcel_CalcEngine_CyclicReferenceStack
-     */
-    private $cellStack;
-
-    /**
-     * Instantiate a Calculation engine logger
-     *
-     * @param  PHPExcel_CalcEngine_CyclicReferenceStack $stack
-     */
-    public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack)
-    {
-        $this->cellStack = $stack;
-    }
-
-    /**
-     * Enable/Disable Calculation engine logging
-     *
-     * @param  boolean $pValue
-     */
-    public function setWriteDebugLog($pValue = false)
-    {
-        $this->writeDebugLog = $pValue;
-    }
-
-    /**
-     * Return whether calculation engine logging is enabled or disabled
-     *
-     * @return  boolean
-     */
-    public function getWriteDebugLog()
-    {
-        return $this->writeDebugLog;
-    }
-
-    /**
-     * Enable/Disable echoing of debug log information
-     *
-     * @param  boolean $pValue
-     */
-    public function setEchoDebugLog($pValue = false)
-    {
-        $this->echoDebugLog = $pValue;
-    }
-
-    /**
-     * Return whether echoing of debug log information is enabled or disabled
-     *
-     * @return  boolean
-     */
-    public function getEchoDebugLog()
-    {
-        return $this->echoDebugLog;
-    }
-
-    /**
-     * Write an entry to the calculation engine debug log
-     */
-    public function writeDebugLog()
-    {
-        //    Only write the debug log if logging is enabled
-        if ($this->writeDebugLog) {
-            $message = implode(func_get_args());
-            $cellReference = implode(' -> ', $this->cellStack->showStack());
-            if ($this->echoDebugLog) {
-                echo $cellReference,
-                    ($this->cellStack->count() > 0 ? ' => ' : ''),
-                    $message,
-                    PHP_EOL;
-            }
-            $this->debugLog[] = $cellReference .
-                ($this->cellStack->count() > 0 ? ' => ' : '') .
-                $message;
-        }
-    }
-
-    /**
-     * Clear the calculation engine debug log
-     */
-    public function clearLog()
-    {
-        $this->debugLog = array();
-    }
-
-    /**
-     * Return the calculation engine debug log
-     *
-     * @return  string[]
-     */
-    public function getLog()
-    {
-        return $this->debugLog;
-    }
-}

+ 0 - 4391
libs/PHPExcel/PHPExcel/Calculation.php

xqd
@@ -1,4391 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-if (!defined('CALCULATION_REGEXP_CELLREF')) {
-    //    Test for support of \P (multibyte options) in PCRE
-    if (defined('PREG_BAD_UTF8_ERROR')) {
-        //    Cell reference (cell or range of cells, with or without a sheet reference)
-        define('CALCULATION_REGEXP_CELLREF', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
-        //    Named Range of cells
-        define('CALCULATION_REGEXP_NAMEDRANGE', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)');
-    } else {
-        //    Cell reference (cell or range of cells, with or without a sheet reference)
-        define('CALCULATION_REGEXP_CELLREF', '(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)');
-        //    Named Range of cells
-        define('CALCULATION_REGEXP_NAMEDRANGE', '(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)');
-    }
-}
-
-/**
- * PHPExcel_Calculation (Multiton)
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation
-{
-    /** Constants                */
-    /** Regular Expressions        */
-    //    Numeric operand
-    const CALCULATION_REGEXP_NUMBER        = '[-+]?\d*\.?\d+(e[-+]?\d+)?';
-    //    String operand
-    const CALCULATION_REGEXP_STRING        = '"(?:[^"]|"")*"';
-    //    Opening bracket
-    const CALCULATION_REGEXP_OPENBRACE    = '\(';
-    //    Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it)
-    const CALCULATION_REGEXP_FUNCTION    = '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
-    //    Cell reference (cell or range of cells, with or without a sheet reference)
-    const CALCULATION_REGEXP_CELLREF    = CALCULATION_REGEXP_CELLREF;
-    //    Named Range of cells
-    const CALCULATION_REGEXP_NAMEDRANGE    = CALCULATION_REGEXP_NAMEDRANGE;
-    //    Error
-    const CALCULATION_REGEXP_ERROR        = '\#[A-Z][A-Z0_\/]*[!\?]?';
-
-
-    /** constants */
-    const RETURN_ARRAY_AS_ERROR = 'error';
-    const RETURN_ARRAY_AS_VALUE = 'value';
-    const RETURN_ARRAY_AS_ARRAY = 'array';
-
-    private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE;
-
-
-    /**
-     * Instance of this class
-     *
-     * @access    private
-     * @var PHPExcel_Calculation
-     */
-    private static $instance;
-
-
-    /**
-     * Instance of the workbook this Calculation Engine is using
-     *
-     * @access    private
-     * @var PHPExcel
-     */
-    private $workbook;
-
-    /**
-     * List of instances of the calculation engine that we've instantiated for individual workbooks
-     *
-     * @access    private
-     * @var PHPExcel_Calculation[]
-     */
-    private static $workbookSets;
-
-    /**
-     * Calculation cache
-     *
-     * @access    private
-     * @var array
-     */
-    private $calculationCache = array ();
-
-
-    /**
-     * Calculation cache enabled
-     *
-     * @access    private
-     * @var boolean
-     */
-    private $calculationCacheEnabled = true;
-
-
-    /**
-     * List of operators that can be used within formulae
-     * The true/false value indicates whether it is a binary operator or a unary operator
-     *
-     * @access    private
-     * @var array
-     */
-    private static $operators = array(
-        '+' => true,    '-' => true,    '*' => true,    '/' => true,
-        '^' => true,    '&' => true,    '%' => false,    '~' => false,
-        '>' => true,    '<' => true,    '=' => true,    '>=' => true,
-        '<=' => true,    '<>' => true,    '|' => true,    ':' => true
-    );
-
-    /**
-     * List of binary operators (those that expect two operands)
-     *
-     * @access    private
-     * @var array
-     */
-    private static $binaryOperators = array(
-        '+' => true,    '-' => true,    '*' => true,    '/' => true,
-        '^' => true,    '&' => true,    '>' => true,    '<' => true,
-        '=' => true,    '>=' => true,    '<=' => true,    '<>' => true,
-        '|' => true,    ':' => true
-    );
-
-    /**
-     * The debug log generated by the calculation engine
-     *
-     * @access    private
-     * @var PHPExcel_CalcEngine_Logger
-     *
-     */
-    private $debugLog;
-
-    /**
-     * Flag to determine how formula errors should be handled
-     *        If true, then a user error will be triggered
-     *        If false, then an exception will be thrown
-     *
-     * @access    public
-     * @var boolean
-     *
-     */
-    public $suppressFormulaErrors = false;
-
-    /**
-     * Error message for any error that was raised/thrown by the calculation engine
-     *
-     * @access    public
-     * @var string
-     *
-     */
-    public $formulaError = null;
-
-    /**
-     * An array of the nested cell references accessed by the calculation engine, used for the debug log
-     *
-     * @access    private
-     * @var array of string
-     *
-     */
-    private $cyclicReferenceStack;
-
-    private $cellStack = array();
-
-    /**
-     * Current iteration counter for cyclic formulae
-     * If the value is 0 (or less) then cyclic formulae will throw an exception,
-     *    otherwise they will iterate to the limit defined here before returning a result
-     *
-     * @var integer
-     *
-     */
-    private $cyclicFormulaCounter = 1;
-
-    private $cyclicFormulaCell = '';
-
-    /**
-     * Number of iterations for cyclic formulae
-     *
-     * @var integer
-     *
-     */
-    public $cyclicFormulaCount = 1;
-
-    /**
-     * Epsilon Precision used for comparisons in calculations
-     *
-     * @var float
-     *
-     */
-    private $delta    = 0.1e-12;
-
-
-    /**
-     * The current locale setting
-     *
-     * @var string
-     *
-     */
-    private static $localeLanguage = 'en_us';                    //    US English    (default locale)
-
-    /**
-     * List of available locale settings
-     * Note that this is read for the locale subdirectory only when requested
-     *
-     * @var string[]
-     *
-     */
-    private static $validLocaleLanguages = array(
-        'en'        //    English        (default language)
-    );
-
-    /**
-     * Locale-specific argument separator for function arguments
-     *
-     * @var string
-     *
-     */
-    private static $localeArgumentSeparator = ',';
-    private static $localeFunctions = array();
-
-    /**
-     * Locale-specific translations for Excel constants (True, False and Null)
-     *
-     * @var string[]
-     *
-     */
-    public static $localeBoolean = array(
-        'TRUE'  => 'TRUE',
-        'FALSE' => 'FALSE',
-        'NULL'  => 'NULL'
-    );
-
-    /**
-     * Excel constant string translations to their PHP equivalents
-     * Constant conversion from text name/value to actual (datatyped) value
-     *
-     * @var string[]
-     *
-     */
-    private static $excelConstants = array(
-        'TRUE'  => true,
-        'FALSE' => false,
-        'NULL'  => null
-    );
-
-     //    PHPExcel functions
-    private static $PHPExcelFunctions = array(
-        'ABS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'abs',
-            'argumentCount' => '1'
-        ),
-        'ACCRINT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT',
-            'argumentCount' => '4-7'
-        ),
-        'ACCRINTM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINTM',
-            'argumentCount' => '3-5'
-        ),
-        'ACOS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'acos',
-            'argumentCount' => '1'
-        ),
-        'ACOSH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'acosh',
-            'argumentCount' => '1'
-        ),
-        'ADDRESS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::CELL_ADDRESS',
-            'argumentCount' => '2-5'
-        ),
-        'AMORDEGRC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::AMORDEGRC',
-            'argumentCount' => '6,7'
-        ),
-        'AMORLINC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::AMORLINC',
-            'argumentCount' => '6,7'
-        ),
-        'AND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_AND',
-            'argumentCount' => '1+'
-        ),
-        'AREAS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'ASC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'ASIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'asin',
-            'argumentCount' => '1'
-        ),
-        'ASINH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'asinh',
-            'argumentCount' => '1'
-        ),
-        'ATAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'atan',
-            'argumentCount' => '1'
-        ),
-        'ATAN2' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::ATAN2',
-            'argumentCount' => '2'
-        ),
-        'ATANH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'atanh',
-            'argumentCount' => '1'
-        ),
-        'AVEDEV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::AVEDEV',
-            'argumentCount' => '1+'
-        ),
-        'AVERAGE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGE',
-            'argumentCount' => '1+'
-        ),
-        'AVERAGEA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEA',
-            'argumentCount' => '1+'
-        ),
-        'AVERAGEIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEIF',
-            'argumentCount' => '2,3'
-        ),
-        'AVERAGEIFS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '3+'
-        ),
-        'BAHTTEXT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'BESSELI' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELI',
-            'argumentCount' => '2'
-        ),
-        'BESSELJ' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELJ',
-            'argumentCount' => '2'
-        ),
-        'BESSELK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELK',
-            'argumentCount' => '2'
-        ),
-        'BESSELY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELY',
-            'argumentCount' => '2'
-        ),
-        'BETADIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::BETADIST',
-            'argumentCount' => '3-5'
-        ),
-        'BETAINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::BETAINV',
-            'argumentCount' => '3-5'
-        ),
-        'BIN2DEC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BINTODEC',
-            'argumentCount' => '1'
-        ),
-        'BIN2HEX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOHEX',
-            'argumentCount' => '1,2'
-        ),
-        'BIN2OCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOOCT',
-            'argumentCount' => '1,2'
-        ),
-        'BINOMDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::BINOMDIST',
-            'argumentCount' => '4'
-        ),
-        'CEILING' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::CEILING',
-            'argumentCount' => '2'
-        ),
-        'CELL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1,2'
-        ),
-        'CHAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::CHARACTER',
-            'argumentCount' => '1'
-        ),
-        'CHIDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CHIDIST',
-            'argumentCount' => '2'
-        ),
-        'CHIINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CHIINV',
-            'argumentCount' => '2'
-        ),
-        'CHITEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'CHOOSE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::CHOOSE',
-            'argumentCount' => '2+'
-        ),
-        'CLEAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::TRIMNONPRINTABLE',
-            'argumentCount' => '1'
-        ),
-        'CODE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::ASCIICODE',
-            'argumentCount' => '1'
-        ),
-        'COLUMN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMN',
-            'argumentCount' => '-1',
-            'passByReference' => array(true)
-        ),
-        'COLUMNS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMNS',
-            'argumentCount' => '1'
-        ),
-        'COMBIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::COMBIN',
-            'argumentCount' => '2'
-        ),
-        'COMPLEX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::COMPLEX',
-            'argumentCount' => '2,3'
-        ),
-        'CONCATENATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::CONCATENATE',
-            'argumentCount' => '1+'
-        ),
-        'CONFIDENCE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CONFIDENCE',
-            'argumentCount' => '3'
-        ),
-        'CONVERT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::CONVERTUOM',
-            'argumentCount' => '3'
-        ),
-        'CORREL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL',
-            'argumentCount' => '2'
-        ),
-        'COS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'cos',
-            'argumentCount' => '1'
-        ),
-        'COSH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'cosh',
-            'argumentCount' => '1'
-        ),
-        'COUNT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::COUNT',
-            'argumentCount' => '1+'
-        ),
-        'COUNTA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTA',
-            'argumentCount' => '1+'
-        ),
-        'COUNTBLANK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTBLANK',
-            'argumentCount' => '1'
-        ),
-        'COUNTIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTIF',
-            'argumentCount' => '2'
-        ),
-        'COUNTIFS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'COUPDAYBS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYBS',
-            'argumentCount' => '3,4'
-        ),
-        'COUPDAYS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYS',
-            'argumentCount' => '3,4'
-        ),
-        'COUPDAYSNC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYSNC',
-            'argumentCount' => '3,4'
-        ),
-        'COUPNCD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPNCD',
-            'argumentCount' => '3,4'
-        ),
-        'COUPNUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPNUM',
-            'argumentCount' => '3,4'
-        ),
-        'COUPPCD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::COUPPCD',
-            'argumentCount' => '3,4'
-        ),
-        'COVAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::COVAR',
-            'argumentCount' => '2'
-        ),
-        'CRITBINOM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CRITBINOM',
-            'argumentCount' => '3'
-        ),
-        'CUBEKPIMEMBER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBEMEMBER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBEMEMBERPROPERTY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBERANKEDMEMBER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBESET' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBESETCOUNT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUBEVALUE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '?'
-        ),
-        'CUMIPMT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::CUMIPMT',
-            'argumentCount' => '6'
-        ),
-        'CUMPRINC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::CUMPRINC',
-            'argumentCount' => '6'
-        ),
-        'DATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DATE',
-            'argumentCount' => '3'
-        ),
-        'DATEDIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DATEDIF',
-            'argumentCount' => '2,3'
-        ),
-        'DATEVALUE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DATEVALUE',
-            'argumentCount' => '1'
-        ),
-        'DAVERAGE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DAVERAGE',
-            'argumentCount' => '3'
-        ),
-        'DAY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFMONTH',
-            'argumentCount' => '1'
-        ),
-        'DAYS360' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DAYS360',
-            'argumentCount' => '2,3'
-        ),
-        'DB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::DB',
-            'argumentCount' => '4,5'
-        ),
-        'DCOUNT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DCOUNT',
-            'argumentCount' => '3'
-        ),
-        'DCOUNTA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DCOUNTA',
-            'argumentCount' => '3'
-        ),
-        'DDB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::DDB',
-            'argumentCount' => '4,5'
-        ),
-        'DEC2BIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOBIN',
-            'argumentCount' => '1,2'
-        ),
-        'DEC2HEX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOHEX',
-            'argumentCount' => '1,2'
-        ),
-        'DEC2OCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOOCT',
-            'argumentCount' => '1,2'
-        ),
-        'DEGREES' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'rad2deg',
-            'argumentCount' => '1'
-        ),
-        'DELTA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::DELTA',
-            'argumentCount' => '1,2'
-        ),
-        'DEVSQ' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::DEVSQ',
-            'argumentCount' => '1+'
-        ),
-        'DGET' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DGET',
-            'argumentCount' => '3'
-        ),
-        'DISC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::DISC',
-            'argumentCount' => '4,5'
-        ),
-        'DMAX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DMAX',
-            'argumentCount' => '3'
-        ),
-        'DMIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DMIN',
-            'argumentCount' => '3'
-        ),
-        'DOLLAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::DOLLAR',
-            'argumentCount' => '1,2'
-        ),
-        'DOLLARDE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARDE',
-            'argumentCount' => '2'
-        ),
-        'DOLLARFR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARFR',
-            'argumentCount' => '2'
-        ),
-        'DPRODUCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DPRODUCT',
-            'argumentCount' => '3'
-        ),
-        'DSTDEV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DSTDEV',
-            'argumentCount' => '3'
-        ),
-        'DSTDEVP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DSTDEVP',
-            'argumentCount' => '3'
-        ),
-        'DSUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DSUM',
-            'argumentCount' => '3'
-        ),
-        'DURATION' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '5,6'
-        ),
-        'DVAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DVAR',
-            'argumentCount' => '3'
-        ),
-        'DVARP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
-            'functionCall' => 'PHPExcel_Calculation_Database::DVARP',
-            'argumentCount' => '3'
-        ),
-        'EDATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::EDATE',
-            'argumentCount' => '2'
-        ),
-        'EFFECT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::EFFECT',
-            'argumentCount' => '2'
-        ),
-        'EOMONTH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::EOMONTH',
-            'argumentCount' => '2'
-        ),
-        'ERF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::ERF',
-            'argumentCount' => '1,2'
-        ),
-        'ERFC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::ERFC',
-            'argumentCount' => '1'
-        ),
-        'ERROR.TYPE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::ERROR_TYPE',
-            'argumentCount' => '1'
-        ),
-        'EVEN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::EVEN',
-            'argumentCount' => '1'
-        ),
-        'EXACT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'EXP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'exp',
-            'argumentCount' => '1'
-        ),
-        'EXPONDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::EXPONDIST',
-            'argumentCount' => '3'
-        ),
-        'FACT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::FACT',
-            'argumentCount' => '1'
-        ),
-        'FACTDOUBLE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::FACTDOUBLE',
-            'argumentCount' => '1'
-        ),
-        'FALSE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::FALSE',
-            'argumentCount' => '0'
-        ),
-        'FDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '3'
-        ),
-        'FIND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
-            'argumentCount' => '2,3'
-        ),
-        'FINDB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
-            'argumentCount' => '2,3'
-        ),
-        'FINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '3'
-        ),
-        'FISHER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::FISHER',
-            'argumentCount' => '1'
-        ),
-        'FISHERINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::FISHERINV',
-            'argumentCount' => '1'
-        ),
-        'FIXED' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::FIXEDFORMAT',
-            'argumentCount' => '1-3'
-        ),
-        'FLOOR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::FLOOR',
-            'argumentCount' => '2'
-        ),
-        'FORECAST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::FORECAST',
-            'argumentCount' => '3'
-        ),
-        'FREQUENCY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'FTEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'FV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::FV',
-            'argumentCount' => '3-5'
-        ),
-        'FVSCHEDULE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::FVSCHEDULE',
-            'argumentCount' => '2'
-        ),
-        'GAMMADIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMADIST',
-            'argumentCount' => '4'
-        ),
-        'GAMMAINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMAINV',
-            'argumentCount' => '3'
-        ),
-        'GAMMALN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMALN',
-            'argumentCount' => '1'
-        ),
-        'GCD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::GCD',
-            'argumentCount' => '1+'
-        ),
-        'GEOMEAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::GEOMEAN',
-            'argumentCount' => '1+'
-        ),
-        'GESTEP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::GESTEP',
-            'argumentCount' => '1,2'
-        ),
-        'GETPIVOTDATA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2+'
-        ),
-        'GROWTH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::GROWTH',
-            'argumentCount' => '1-4'
-        ),
-        'HARMEAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::HARMEAN',
-            'argumentCount' => '1+'
-        ),
-        'HEX2BIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOBIN',
-            'argumentCount' => '1,2'
-        ),
-        'HEX2DEC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTODEC',
-            'argumentCount' => '1'
-        ),
-        'HEX2OCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOOCT',
-            'argumentCount' => '1,2'
-        ),
-        'HLOOKUP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::HLOOKUP',
-            'argumentCount' => '3,4'
-        ),
-        'HOUR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::HOUROFDAY',
-            'argumentCount' => '1'
-        ),
-        'HYPERLINK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::HYPERLINK',
-            'argumentCount' => '1,2',
-            'passCellReference' => true
-        ),
-        'HYPGEOMDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::HYPGEOMDIST',
-            'argumentCount' => '4'
-        ),
-        'IF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::STATEMENT_IF',
-            'argumentCount' => '1-3'
-        ),
-        'IFERROR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::IFERROR',
-            'argumentCount' => '2'
-        ),
-        'IMABS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMABS',
-            'argumentCount' => '1'
-        ),
-        'IMAGINARY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMAGINARY',
-            'argumentCount' => '1'
-        ),
-        'IMARGUMENT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMARGUMENT',
-            'argumentCount' => '1'
-        ),
-        'IMCONJUGATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMCONJUGATE',
-            'argumentCount' => '1'
-        ),
-        'IMCOS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMCOS',
-            'argumentCount' => '1'
-        ),
-        'IMDIV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMDIV',
-            'argumentCount' => '2'
-        ),
-        'IMEXP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMEXP',
-            'argumentCount' => '1'
-        ),
-        'IMLN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMLN',
-            'argumentCount' => '1'
-        ),
-        'IMLOG10' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG10',
-            'argumentCount' => '1'
-        ),
-        'IMLOG2' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG2',
-            'argumentCount' => '1'
-        ),
-        'IMPOWER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMPOWER',
-            'argumentCount' => '2'
-        ),
-        'IMPRODUCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMPRODUCT',
-            'argumentCount' => '1+'
-        ),
-        'IMREAL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMREAL',
-            'argumentCount' => '1'
-        ),
-        'IMSIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMSIN',
-            'argumentCount' => '1'
-        ),
-        'IMSQRT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMSQRT',
-            'argumentCount' => '1'
-        ),
-        'IMSUB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUB',
-            'argumentCount' => '2'
-        ),
-        'IMSUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUM',
-            'argumentCount' => '1+'
-        ),
-        'INDEX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::INDEX',
-            'argumentCount' => '1-4'
-        ),
-        'INDIRECT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::INDIRECT',
-            'argumentCount' => '1,2',
-            'passCellReference' => true
-        ),
-        'INFO' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'INT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::INT',
-            'argumentCount' => '1'
-        ),
-        'INTERCEPT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::INTERCEPT',
-            'argumentCount' => '2'
-        ),
-        'INTRATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::INTRATE',
-            'argumentCount' => '4,5'
-        ),
-        'IPMT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::IPMT',
-            'argumentCount' => '4-6'
-        ),
-        'IRR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::IRR',
-            'argumentCount' => '1,2'
-        ),
-        'ISBLANK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_BLANK',
-            'argumentCount' => '1'
-        ),
-        'ISERR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERR',
-            'argumentCount' => '1'
-        ),
-        'ISERROR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERROR',
-            'argumentCount' => '1'
-        ),
-        'ISEVEN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_EVEN',
-            'argumentCount' => '1'
-        ),
-        'ISLOGICAL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_LOGICAL',
-            'argumentCount' => '1'
-        ),
-        'ISNA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_NA',
-            'argumentCount' => '1'
-        ),
-        'ISNONTEXT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_NONTEXT',
-            'argumentCount' => '1'
-        ),
-        'ISNUMBER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_NUMBER',
-            'argumentCount' => '1'
-        ),
-        'ISODD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_ODD',
-            'argumentCount' => '1'
-        ),
-        'ISPMT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::ISPMT',
-            'argumentCount' => '4'
-        ),
-        'ISREF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'ISTEXT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::IS_TEXT',
-            'argumentCount' => '1'
-        ),
-        'JIS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'KURT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::KURT',
-            'argumentCount' => '1+'
-        ),
-        'LARGE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::LARGE',
-            'argumentCount' => '2'
-        ),
-        'LCM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::LCM',
-            'argumentCount' => '1+'
-        ),
-        'LEFT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::LEFT',
-            'argumentCount' => '1,2'
-        ),
-        'LEFTB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::LEFT',
-            'argumentCount' => '1,2'
-        ),
-        'LEN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH',
-            'argumentCount' => '1'
-        ),
-        'LENB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH',
-            'argumentCount' => '1'
-        ),
-        'LINEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::LINEST',
-            'argumentCount' => '1-4'
-        ),
-        'LN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'log',
-            'argumentCount' => '1'
-        ),
-        'LOG' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::LOG_BASE',
-            'argumentCount' => '1,2'
-        ),
-        'LOG10' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'log10',
-            'argumentCount' => '1'
-        ),
-        'LOGEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::LOGEST',
-            'argumentCount' => '1-4'
-        ),
-        'LOGINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::LOGINV',
-            'argumentCount' => '3'
-        ),
-        'LOGNORMDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::LOGNORMDIST',
-            'argumentCount' => '3'
-        ),
-        'LOOKUP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::LOOKUP',
-            'argumentCount' => '2,3'
-        ),
-        'LOWER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::LOWERCASE',
-            'argumentCount' => '1'
-        ),
-        'MATCH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::MATCH',
-            'argumentCount' => '2,3'
-        ),
-        'MAX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MAX',
-            'argumentCount' => '1+'
-        ),
-        'MAXA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MAXA',
-            'argumentCount' => '1+'
-        ),
-        'MAXIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MAXIF',
-            'argumentCount' => '2+'
-        ),
-        'MDETERM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MDETERM',
-            'argumentCount' => '1'
-        ),
-        'MDURATION' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '5,6'
-        ),
-        'MEDIAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MEDIAN',
-            'argumentCount' => '1+'
-        ),
-        'MEDIANIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2+'
-        ),
-        'MID' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::MID',
-            'argumentCount' => '3'
-        ),
-        'MIDB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::MID',
-            'argumentCount' => '3'
-        ),
-        'MIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MIN',
-            'argumentCount' => '1+'
-        ),
-        'MINA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MINA',
-            'argumentCount' => '1+'
-        ),
-        'MINIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MINIF',
-            'argumentCount' => '2+'
-        ),
-        'MINUTE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::MINUTEOFHOUR',
-            'argumentCount' => '1'
-        ),
-        'MINVERSE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MINVERSE',
-            'argumentCount' => '1'
-        ),
-        'MIRR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::MIRR',
-            'argumentCount' => '3'
-        ),
-        'MMULT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MMULT',
-            'argumentCount' => '2'
-        ),
-        'MOD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MOD',
-            'argumentCount' => '2'
-        ),
-        'MODE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::MODE',
-            'argumentCount' => '1+'
-        ),
-        'MONTH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::MONTHOFYEAR',
-            'argumentCount' => '1'
-        ),
-        'MROUND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MROUND',
-            'argumentCount' => '2'
-        ),
-        'MULTINOMIAL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::MULTINOMIAL',
-            'argumentCount' => '1+'
-        ),
-        'N' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::N',
-            'argumentCount' => '1'
-        ),
-        'NA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::NA',
-            'argumentCount' => '0'
-        ),
-        'NEGBINOMDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::NEGBINOMDIST',
-            'argumentCount' => '3'
-        ),
-        'NETWORKDAYS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::NETWORKDAYS',
-            'argumentCount' => '2+'
-        ),
-        'NOMINAL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::NOMINAL',
-            'argumentCount' => '2'
-        ),
-        'NORMDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::NORMDIST',
-            'argumentCount' => '4'
-        ),
-        'NORMINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::NORMINV',
-            'argumentCount' => '3'
-        ),
-        'NORMSDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSDIST',
-            'argumentCount' => '1'
-        ),
-        'NORMSINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSINV',
-            'argumentCount' => '1'
-        ),
-        'NOT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::NOT',
-            'argumentCount' => '1'
-        ),
-        'NOW' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DATETIMENOW',
-            'argumentCount' => '0'
-        ),
-        'NPER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::NPER',
-            'argumentCount' => '3-5'
-        ),
-        'NPV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::NPV',
-            'argumentCount' => '2+'
-        ),
-        'OCT2BIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOBIN',
-            'argumentCount' => '1,2'
-        ),
-        'OCT2DEC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTODEC',
-            'argumentCount' => '1'
-        ),
-        'OCT2HEX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
-            'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOHEX',
-            'argumentCount' => '1,2'
-        ),
-        'ODD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::ODD',
-            'argumentCount' => '1'
-        ),
-        'ODDFPRICE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '8,9'
-        ),
-        'ODDFYIELD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '8,9'
-        ),
-        'ODDLPRICE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '7,8'
-        ),
-        'ODDLYIELD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '7,8'
-        ),
-        'OFFSET' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::OFFSET',
-            'argumentCount' => '3-5',
-            'passCellReference' => true,
-            'passByReference' => array(true)
-        ),
-        'OR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_OR',
-            'argumentCount' => '1+'
-        ),
-        'PEARSON' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL',
-            'argumentCount' => '2'
-        ),
-        'PERCENTILE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTILE',
-            'argumentCount' => '2'
-        ),
-        'PERCENTRANK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTRANK',
-            'argumentCount' => '2,3'
-        ),
-        'PERMUT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::PERMUT',
-            'argumentCount' => '2'
-        ),
-        'PHONETIC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1'
-        ),
-        'PI' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'pi',
-            'argumentCount' => '0'
-        ),
-        'PMT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PMT',
-            'argumentCount' => '3-5'
-        ),
-        'POISSON' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::POISSON',
-            'argumentCount' => '3'
-        ),
-        'POWER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::POWER',
-            'argumentCount' => '2'
-        ),
-        'PPMT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PPMT',
-            'argumentCount' => '4-6'
-        ),
-        'PRICE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PRICE',
-            'argumentCount' => '6,7'
-        ),
-        'PRICEDISC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PRICEDISC',
-            'argumentCount' => '4,5'
-        ),
-        'PRICEMAT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PRICEMAT',
-            'argumentCount' => '5,6'
-        ),
-        'PROB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '3,4'
-        ),
-        'PRODUCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::PRODUCT',
-            'argumentCount' => '1+'
-        ),
-        'PROPER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::PROPERCASE',
-            'argumentCount' => '1'
-        ),
-        'PV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::PV',
-            'argumentCount' => '3-5'
-        ),
-        'QUARTILE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::QUARTILE',
-            'argumentCount' => '2'
-        ),
-        'QUOTIENT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::QUOTIENT',
-            'argumentCount' => '2'
-        ),
-        'RADIANS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'deg2rad',
-            'argumentCount' => '1'
-        ),
-        'RAND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND',
-            'argumentCount' => '0'
-        ),
-        'RANDBETWEEN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND',
-            'argumentCount' => '2'
-        ),
-        'RANK' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::RANK',
-            'argumentCount' => '2,3'
-        ),
-        'RATE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::RATE',
-            'argumentCount' => '3-6'
-        ),
-        'RECEIVED' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::RECEIVED',
-            'argumentCount' => '4-5'
-        ),
-        'REPLACE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE',
-            'argumentCount' => '4'
-        ),
-        'REPLACEB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE',
-            'argumentCount' => '4'
-        ),
-        'REPT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'str_repeat',
-            'argumentCount' => '2'
-        ),
-        'RIGHT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT',
-            'argumentCount' => '1,2'
-        ),
-        'RIGHTB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT',
-            'argumentCount' => '1,2'
-        ),
-        'ROMAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::ROMAN',
-            'argumentCount' => '1,2'
-        ),
-        'ROUND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'round',
-            'argumentCount' => '2'
-        ),
-        'ROUNDDOWN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDDOWN',
-            'argumentCount' => '2'
-        ),
-        'ROUNDUP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDUP',
-            'argumentCount' => '2'
-        ),
-        'ROW' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::ROW',
-            'argumentCount' => '-1',
-            'passByReference' => array(true)
-        ),
-        'ROWS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::ROWS',
-            'argumentCount' => '1'
-        ),
-        'RSQ' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::RSQ',
-            'argumentCount' => '2'
-        ),
-        'RTD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '1+'
-        ),
-        'SEARCH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
-            'argumentCount' => '2,3'
-        ),
-        'SEARCHB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
-            'argumentCount' => '2,3'
-        ),
-        'SECOND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::SECONDOFMINUTE',
-            'argumentCount' => '1'
-        ),
-        'SERIESSUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SERIESSUM',
-            'argumentCount' => '4'
-        ),
-        'SIGN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SIGN',
-            'argumentCount' => '1'
-        ),
-        'SIN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'sin',
-            'argumentCount' => '1'
-        ),
-        'SINH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'sinh',
-            'argumentCount' => '1'
-        ),
-        'SKEW' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::SKEW',
-            'argumentCount' => '1+'
-        ),
-        'SLN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::SLN',
-            'argumentCount' => '3'
-        ),
-        'SLOPE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::SLOPE',
-            'argumentCount' => '2'
-        ),
-        'SMALL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::SMALL',
-            'argumentCount' => '2'
-        ),
-        'SQRT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'sqrt',
-            'argumentCount' => '1'
-        ),
-        'SQRTPI' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SQRTPI',
-            'argumentCount' => '1'
-        ),
-        'STANDARDIZE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STANDARDIZE',
-            'argumentCount' => '3'
-        ),
-        'STDEV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STDEV',
-            'argumentCount' => '1+'
-        ),
-        'STDEVA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVA',
-            'argumentCount' => '1+'
-        ),
-        'STDEVP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVP',
-            'argumentCount' => '1+'
-        ),
-        'STDEVPA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVPA',
-            'argumentCount' => '1+'
-        ),
-        'STEYX' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::STEYX',
-            'argumentCount' => '2'
-        ),
-        'SUBSTITUTE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::SUBSTITUTE',
-            'argumentCount' => '3,4'
-        ),
-        'SUBTOTAL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUBTOTAL',
-            'argumentCount' => '2+'
-        ),
-        'SUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUM',
-            'argumentCount' => '1+'
-        ),
-        'SUMIF' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMIF',
-            'argumentCount' => '2,3'
-        ),
-        'SUMIFS' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMIFS',
-            'argumentCount' => '3+'
-        ),
-        'SUMPRODUCT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMPRODUCT',
-            'argumentCount' => '1+'
-        ),
-        'SUMSQ' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMSQ',
-            'argumentCount' => '1+'
-        ),
-        'SUMX2MY2' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2MY2',
-            'argumentCount' => '2'
-        ),
-        'SUMX2PY2' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2PY2',
-            'argumentCount' => '2'
-        ),
-        'SUMXMY2' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMXMY2',
-            'argumentCount' => '2'
-        ),
-        'SYD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::SYD',
-            'argumentCount' => '4'
-        ),
-        'T' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::RETURNSTRING',
-            'argumentCount' => '1'
-        ),
-        'TAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'tan',
-            'argumentCount' => '1'
-        ),
-        'TANH' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'tanh',
-            'argumentCount' => '1'
-        ),
-        'TBILLEQ' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::TBILLEQ',
-            'argumentCount' => '3'
-        ),
-        'TBILLPRICE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::TBILLPRICE',
-            'argumentCount' => '3'
-        ),
-        'TBILLYIELD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::TBILLYIELD',
-            'argumentCount' => '3'
-        ),
-        'TDIST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::TDIST',
-            'argumentCount' => '3'
-        ),
-        'TEXT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::TEXTFORMAT',
-            'argumentCount' => '2'
-        ),
-        'TIME' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::TIME',
-            'argumentCount' => '3'
-        ),
-        'TIMEVALUE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::TIMEVALUE',
-            'argumentCount' => '1'
-        ),
-        'TINV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::TINV',
-            'argumentCount' => '2'
-        ),
-        'TODAY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DATENOW',
-            'argumentCount' => '0'
-        ),
-        'TRANSPOSE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::TRANSPOSE',
-            'argumentCount' => '1'
-        ),
-        'TREND' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::TREND',
-            'argumentCount' => '1-4'
-        ),
-        'TRIM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::TRIMSPACES',
-            'argumentCount' => '1'
-        ),
-        'TRIMMEAN' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::TRIMMEAN',
-            'argumentCount' => '2'
-        ),
-        'TRUE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
-            'functionCall' => 'PHPExcel_Calculation_Logical::TRUE',
-            'argumentCount' => '0'
-        ),
-        'TRUNC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
-            'functionCall' => 'PHPExcel_Calculation_MathTrig::TRUNC',
-            'argumentCount' => '1,2'
-        ),
-        'TTEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '4'
-        ),
-        'TYPE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::TYPE',
-            'argumentCount' => '1'
-        ),
-        'UPPER' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::UPPERCASE',
-            'argumentCount' => '1'
-        ),
-        'USDOLLAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '2'
-        ),
-        'VALUE' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
-            'functionCall' => 'PHPExcel_Calculation_TextData::VALUE',
-            'argumentCount' => '1'
-        ),
-        'VAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::VARFunc',
-            'argumentCount' => '1+'
-        ),
-        'VARA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::VARA',
-            'argumentCount' => '1+'
-        ),
-        'VARP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::VARP',
-            'argumentCount' => '1+'
-        ),
-        'VARPA' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::VARPA',
-            'argumentCount' => '1+'
-        ),
-        'VDB' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '5-7'
-        ),
-        'VERSION' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
-            'functionCall' => 'PHPExcel_Calculation_Functions::VERSION',
-            'argumentCount' => '0'
-        ),
-        'VLOOKUP' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
-            'functionCall' => 'PHPExcel_Calculation_LookupRef::VLOOKUP',
-            'argumentCount' => '3,4'
-        ),
-        'WEEKDAY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFWEEK',
-            'argumentCount' => '1,2'
-        ),
-        'WEEKNUM' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::WEEKOFYEAR',
-            'argumentCount' => '1,2'
-        ),
-        'WEIBULL' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::WEIBULL',
-            'argumentCount' => '4'
-        ),
-        'WORKDAY' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::WORKDAY',
-            'argumentCount' => '2+'
-        ),
-        'XIRR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::XIRR',
-            'argumentCount' => '2,3'
-        ),
-        'XNPV' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::XNPV',
-            'argumentCount' => '3'
-        ),
-        'YEAR' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::YEAR',
-            'argumentCount' => '1'
-        ),
-        'YEARFRAC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
-            'functionCall' => 'PHPExcel_Calculation_DateTime::YEARFRAC',
-            'argumentCount' => '2,3'
-        ),
-        'YIELD' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
-            'argumentCount' => '6,7'
-        ),
-        'YIELDDISC' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::YIELDDISC',
-            'argumentCount' => '4,5'
-        ),
-        'YIELDMAT' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
-            'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT',
-            'argumentCount' => '5,6'
-        ),
-        'ZTEST' => array(
-            'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
-            'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST',
-            'argumentCount' => '2-3'
-        )
-    );
-
-    //    Internal functions used for special control purposes
-    private static $controlFunctions = array(
-        'MKMATRIX' => array(
-            'argumentCount' => '*',
-            'functionCall' => 'self::mkMatrix'
-        )
-    );
-
-
-    public function __construct(PHPExcel $workbook = null)
-    {
-        $this->delta = 1 * pow(10, 0 - ini_get('precision'));
-
-        $this->workbook = $workbook;
-        $this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
-        $this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
-    }
-
-
-    private static function loadLocales()
-    {
-        $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
-        foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
-            $filename = substr($filename, strlen($localeFileDirectory)+1);
-            if ($filename != 'en') {
-                self::$validLocaleLanguages[] = $filename;
-            }
-        }
-    }
-
-    /**
-     * Get an instance of this class
-     *
-     * @access    public
-     * @param   PHPExcel $workbook  Injected workbook for working with a PHPExcel object,
-     *                                    or NULL to create a standalone claculation engine
-     * @return PHPExcel_Calculation
-     */
-    public static function getInstance(PHPExcel $workbook = null)
-    {
-        if ($workbook !== null) {
-            $instance = $workbook->getCalculationEngine();
-            if (isset($instance)) {
-                return $instance;  
-            }
-        }
-
-        if (!isset(self::$instance) || (self::$instance === null)) {
-            self::$instance = new PHPExcel_Calculation();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * Unset an instance of this class
-     *
-     * @access    public
-     */
-    public function __destruct()
-    {
-        $this->workbook = null;
-    }
-
-    /**
-     * Flush the calculation cache for any existing instance of this class
-     *        but only if a PHPExcel_Calculation instance exists
-     *
-     * @access    public
-     * @return null
-     */
-    public function flushInstance()
-    {
-        $this->clearCalculationCache();
-    }
-
-
-    /**
-     * Get the debuglog for this claculation engine instance
-     *
-     * @access    public
-     * @return PHPExcel_CalcEngine_Logger
-     */
-    public function getDebugLog()
-    {
-        return $this->_debugLog;
-    }
-
-    /**
-     * __clone implementation. Cloning should not be allowed in a Singleton!
-     *
-     * @access    public
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    final public function __clone()
-    {
-        throw new PHPExcel_Calculation_Exception('Cloning the calculation engine is not allowed!');
-    }
-
-
-    /**
-     * Return the locale-specific translation of TRUE
-     *
-     * @access    public
-     * @return     string        locale-specific translation of TRUE
-     */
-    public static function getTRUE()
-    {
-        return self::$localeBoolean['TRUE'];
-    }
-
-    /**
-     * Return the locale-specific translation of FALSE
-     *
-     * @access    public
-     * @return     string        locale-specific translation of FALSE
-     */
-    public static function getFALSE()
-    {
-        return self::$localeBoolean['FALSE'];
-    }
-
-    /**
-     * Set the Array Return Type (Array or Value of first element in the array)
-     *
-     * @access    public
-     * @param     string    $returnType            Array return type
-     * @return     boolean                    Success or failure
-     */
-    public static function setArrayReturnType($returnType)
-    {
-        if (($returnType == self::RETURN_ARRAY_AS_VALUE) ||
-            ($returnType == self::RETURN_ARRAY_AS_ERROR) ||
-            ($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
-            self::$returnArrayAsType = $returnType;
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Return the Array Return Type (Array or Value of first element in the array)
-     *
-     * @access    public
-     * @return     string        $returnType            Array return type
-     */
-    public static function getArrayReturnType()
-    {
-        return self::$returnArrayAsType;
-    }
-
-
-    /**
-     * Is calculation caching enabled?
-     *
-     * @access    public
-     * @return boolean
-     */
-    public function getCalculationCacheEnabled()
-    {
-        return $this->calculationCacheEnabled;
-    }
-
-    /**
-     * Enable/disable calculation cache
-     *
-     * @access    public
-     * @param boolean $pValue
-     */
-    public function setCalculationCacheEnabled($pValue = true)
-    {
-        $this->calculationCacheEnabled = $pValue;
-        $this->clearCalculationCache();
-    }
-
-
-    /**
-     * Enable calculation cache
-     */
-    public function enableCalculationCache()
-    {
-        $this->setCalculationCacheEnabled(true);
-    }
-
-
-    /**
-     * Disable calculation cache
-     */
-    public function disableCalculationCache()
-    {
-        $this->setCalculationCacheEnabled(false);
-    }
-
-
-    /**
-     * Clear calculation cache
-     */
-    public function clearCalculationCache()
-    {
-        $this->calculationCache = array();
-    }
-
-    /**
-     * Clear calculation cache for a specified worksheet
-     *
-     * @param string $worksheetName
-     */
-    public function clearCalculationCacheForWorksheet($worksheetName)
-    {
-        if (isset($this->calculationCache[$worksheetName])) {
-            unset($this->calculationCache[$worksheetName]);
-        }
-    }
-
-    /**
-     * Rename calculation cache for a specified worksheet
-     *
-     * @param string $fromWorksheetName
-     * @param string $toWorksheetName
-     */
-    public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
-    {
-        if (isset($this->calculationCache[$fromWorksheetName])) {
-            $this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
-            unset($this->calculationCache[$fromWorksheetName]);
-        }
-    }
-
-
-    /**
-     * Get the currently defined locale code
-     *
-     * @return string
-     */
-    public function getLocale()
-    {
-        return self::$localeLanguage;
-    }
-
-
-    /**
-     * Set the locale code
-     *
-     * @param string $locale  The locale to use for formula translation
-     * @return boolean
-     */
-    public function setLocale($locale = 'en_us')
-    {
-        //    Identify our locale and language
-        $language = $locale = strtolower($locale);
-        if (strpos($locale, '_') !== false) {
-            list($language) = explode('_', $locale);
-        }
-
-        if (count(self::$validLocaleLanguages) == 1) {
-            self::loadLocales();
-        }
-        //    Test whether we have any language data for this language (any locale)
-        if (in_array($language, self::$validLocaleLanguages)) {
-            //    initialise language/locale settings
-            self::$localeFunctions = array();
-            self::$localeArgumentSeparator = ',';
-            self::$localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
-            //    Default is English, if user isn't requesting english, then read the necessary data from the locale files
-            if ($locale != 'en_us') {
-                //    Search for a file with a list of function names for locale
-                $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions';
-                if (!file_exists($functionNamesFile)) {
-                    //    If there isn't a locale specific function file, look for a language specific function file
-                    $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
-                    if (!file_exists($functionNamesFile)) {
-                        return false;
-                    }
-                }
-                //    Retrieve the list of locale or language specific function names
-                $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
-                foreach ($localeFunctions as $localeFunction) {
-                    list($localeFunction) = explode('##', $localeFunction);    //    Strip out comments
-                    if (strpos($localeFunction, '=') !== false) {
-                        list($fName, $lfName) = explode('=', $localeFunction);
-                        $fName = trim($fName);
-                        $lfName = trim($lfName);
-                        if ((isset(self::$PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
-                            self::$localeFunctions[$fName] = $lfName;
-                        }
-                    }
-                }
-                //    Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
-                if (isset(self::$localeFunctions['TRUE'])) {
-                    self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
-                }
-                if (isset(self::$localeFunctions['FALSE'])) {
-                    self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
-                }
-
-                $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
-                if (!file_exists($configFile)) {
-                    $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
-                }
-                if (file_exists($configFile)) {
-                    $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
-                    foreach ($localeSettings as $localeSetting) {
-                        list($localeSetting) = explode('##', $localeSetting);    //    Strip out comments
-                        if (strpos($localeSetting, '=') !== false) {
-                            list($settingName, $settingValue) = explode('=', $localeSetting);
-                            $settingName = strtoupper(trim($settingName));
-                            switch ($settingName) {
-                                case 'ARGUMENTSEPARATOR':
-                                    self::$localeArgumentSeparator = trim($settingValue);
-                                    break;
-                            }
-                        }
-                    }
-                }
-            }
-
-            self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
-            self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
-            self::$localeLanguage = $locale;
-            return true;
-        }
-        return false;
-    }
-
-
-
-    public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces)
-    {
-        $strlen = mb_strlen($formula);
-        for ($i = 0; $i < $strlen; ++$i) {
-            $chr = mb_substr($formula, $i, 1);
-            switch ($chr) {
-                case '{':
-                    $inBraces = true;
-                    break;
-                case '}':
-                    $inBraces = false;
-                    break;
-                case $fromSeparator:
-                    if (!$inBraces) {
-                        $formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i+1);
-                    }
-            }
-        }
-        return $formula;
-    }
-
-    private static function translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
-    {
-        //    Convert any Excel function names to the required language
-        if (self::$localeLanguage !== 'en_us') {
-            $inBraces = false;
-            //    If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
-            if (strpos($formula, '"') !== false) {
-                //    So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
-                //        the formula
-                $temp = explode('"', $formula);
-                $i = false;
-                foreach ($temp as &$value) {
-                    //    Only count/replace in alternating array entries
-                    if ($i = !$i) {
-                        $value = preg_replace($from, $to, $value);
-                        $value = self::translateSeparator($fromSeparator, $toSeparator, $value, $inBraces);
-                    }
-                }
-                unset($value);
-                //    Then rebuild the formula string
-                $formula = implode('"', $temp);
-            } else {
-                //    If there's no quoted strings, then we do a simple count/replace
-                $formula = preg_replace($from, $to, $formula);
-                $formula = self::translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces);
-            }
-        }
-
-        return $formula;
-    }
-
-    private static $functionReplaceFromExcel = null;
-    private static $functionReplaceToLocale  = null;
-
-    public function _translateFormulaToLocale($formula)
-    {
-        if (self::$functionReplaceFromExcel === null) {
-            self::$functionReplaceFromExcel = array();
-            foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
-                self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
-            }
-            foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
-                self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
-            }
-
-        }
-
-        if (self::$functionReplaceToLocale === null) {
-            self::$functionReplaceToLocale = array();
-            foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
-                self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
-            }
-            foreach (array_values(self::$localeBoolean) as $localeBoolean) {
-                self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
-            }
-        }
-
-        return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
-    }
-
-
-    private static $functionReplaceFromLocale = null;
-    private static $functionReplaceToExcel    = null;
-
-    public function _translateFormulaToEnglish($formula)
-    {
-        if (self::$functionReplaceFromLocale === null) {
-            self::$functionReplaceFromLocale = array();
-            foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
-                self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
-            }
-            foreach (array_values(self::$localeBoolean) as $excelBoolean) {
-                self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
-            }
-        }
-
-        if (self::$functionReplaceToExcel === null) {
-            self::$functionReplaceToExcel = array();
-            foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
-                self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
-            }
-            foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
-                self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
-            }
-        }
-
-        return self::translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$localeArgumentSeparator, ',');
-    }
-
-
-    public static function localeFunc($function)
-    {
-        if (self::$localeLanguage !== 'en_us') {
-            $functionName = trim($function, '(');
-            if (isset(self::$localeFunctions[$functionName])) {
-                $brace = ($functionName != $function);
-                $function = self::$localeFunctions[$functionName];
-                if ($brace) {
-                    $function .= '(';
-                }
-            }
-        }
-        return $function;
-    }
-
-
-
-
-    /**
-     * Wrap string values in quotes
-     *
-     * @param mixed $value
-     * @return mixed
-     */
-    public static function wrapResult($value)
-    {
-        if (is_string($value)) {
-            //    Error values cannot be "wrapped"
-            if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) {
-                //    Return Excel errors "as is"
-                return $value;
-            }
-            //    Return strings wrapped in quotes
-            return '"'.$value.'"';
-        //    Convert numeric errors to NaN error
-        } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return $value;
-    }
-
-
-    /**
-     * Remove quotes used as a wrapper to identify string values
-     *
-     * @param mixed $value
-     * @return mixed
-     */
-    public static function unwrapResult($value)
-    {
-        if (is_string($value)) {
-            if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) {
-                return substr($value, 1, -1);
-            }
-        //    Convert numeric errors to NaN error
-        } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return $value;
-    }
-
-
-
-
-    /**
-     * Calculate cell value (using formula from a cell ID)
-     * Retained for backward compatibility
-     *
-     * @access    public
-     * @param    PHPExcel_Cell    $pCell    Cell to calculate
-     * @return    mixed
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function calculate(PHPExcel_Cell $pCell = null)
-    {
-        try {
-            return $this->calculateCellValue($pCell);
-        } catch (PHPExcel_Exception $e) {
-            throw new PHPExcel_Calculation_Exception($e->getMessage());
-        }
-    }
-
-
-    /**
-     * Calculate the value of a cell formula
-     *
-     * @access    public
-     * @param    PHPExcel_Cell    $pCell        Cell to calculate
-     * @param    Boolean            $resetLog    Flag indicating whether the debug log should be reset or not
-     * @return    mixed
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function calculateCellValue(PHPExcel_Cell $pCell = null, $resetLog = true)
-    {
-        if ($pCell === null) {
-            return null;
-        }
-
-        $returnArrayAsType = self::$returnArrayAsType;
-        if ($resetLog) {
-            //    Initialise the logging settings if requested
-            $this->formulaError = null;
-            $this->_debugLog->clearLog();
-            $this->cyclicReferenceStack->clear();
-            $this->cyclicFormulaCounter = 1;
-
-            self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY;
-        }
-
-        //    Execute the calculation for the cell formula
-        $this->cellStack[] = array(
-            'sheet' => $pCell->getWorksheet()->getTitle(),
-            'cell' => $pCell->getCoordinate(),
-        );
-        try {
-            $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
-            $cellAddress = array_pop($this->cellStack);
-            $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
-        } catch (PHPExcel_Exception $e) {
-            $cellAddress = array_pop($this->cellStack);
-            $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
-            throw new PHPExcel_Calculation_Exception($e->getMessage());
-        }
-
-        if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
-            self::$returnArrayAsType = $returnArrayAsType;
-            $testResult = PHPExcel_Calculation_Functions::flattenArray($result);
-            if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            //    If there's only a single cell in the array, then we allow it
-            if (count($testResult) != 1) {
-                //    If keys are numeric, then it's a matrix result rather than a cell range result, so we permit it
-                $r = array_keys($result);
-                $r = array_shift($r);
-                if (!is_numeric($r)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-                if (is_array($result[$r])) {
-                    $c = array_keys($result[$r]);
-                    $c = array_shift($c);
-                    if (!is_numeric($c)) {
-                        return PHPExcel_Calculation_Functions::VALUE();
-                    }
-                }
-            }
-            $result = array_shift($testResult);
-        }
-        self::$returnArrayAsType = $returnArrayAsType;
-
-
-        if ($result === null) {
-            return 0;
-        } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return $result;
-    }
-
-
-    /**
-     * Validate and parse a formula string
-     *
-     * @param    string        $formula        Formula to parse
-     * @return    array
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function parseFormula($formula)
-    {
-        //    Basic validation that this is indeed a formula
-        //    We return an empty array if not
-        $formula = trim($formula);
-        if ((!isset($formula{0})) || ($formula{0} != '=')) {
-            return array();
-        }
-        $formula = ltrim(substr($formula, 1));
-        if (!isset($formula{0})) {
-            return array();
-        }
-
-        //    Parse the formula and return the token stack
-        return $this->_parseFormula($formula);
-    }
-
-
-    /**
-     * Calculate the value of a formula
-     *
-     * @param    string            $formula    Formula to parse
-     * @param    string            $cellID        Address of the cell to calculate
-     * @param    PHPExcel_Cell    $pCell        Cell to calculate
-     * @return    mixed
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function calculateFormula($formula, $cellID = null, PHPExcel_Cell $pCell = null)
-    {
-        //    Initialise the logging settings
-        $this->formulaError = null;
-        $this->_debugLog->clearLog();
-        $this->cyclicReferenceStack->clear();
-
-        if ($this->workbook !== null && $cellID === null && $pCell === null) {
-            $cellID = 'A1';
-            $pCell = $this->workbook->getActiveSheet()->getCell($cellID);
-        } else {
-            //    Disable calculation cacheing because it only applies to cell calculations, not straight formulae
-            //    But don't actually flush any cache
-            $resetCache = $this->getCalculationCacheEnabled();
-            $this->calculationCacheEnabled = false;
-        }
-
-        //    Execute the calculation
-        try {
-            $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
-        } catch (PHPExcel_Exception $e) {
-            throw new PHPExcel_Calculation_Exception($e->getMessage());
-        }
-
-        if ($this->workbook === null) {
-            //    Reset calculation cacheing to its previous state
-            $this->calculationCacheEnabled = $resetCache;
-        }
-
-        return $result;
-    }
-
-
-    public function getValueFromCache($cellReference, &$cellValue)
-    {
-        // Is calculation cacheing enabled?
-        // Is the value present in calculation cache?
-        $this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
-        if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
-            $this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
-            // Return the cached result
-            $cellValue = $this->calculationCache[$cellReference];
-            return true;
-        }
-        return false;
-    }
-
-    public function saveValueToCache($cellReference, $cellValue)
-    {
-        if ($this->calculationCacheEnabled) {
-            $this->calculationCache[$cellReference] = $cellValue;
-        }
-    }
-
-    /**
-     * Parse a cell formula and calculate its value
-     *
-     * @param    string            $formula    The formula to parse and calculate
-     * @param    string            $cellID        The ID (e.g. A3) of the cell that we are calculating
-     * @param    PHPExcel_Cell    $pCell        Cell to calculate
-     * @return    mixed
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function _calculateFormulaValue($formula, $cellID = null, PHPExcel_Cell $pCell = null)
-    {
-        $cellValue = null;
-
-        //    Basic validation that this is indeed a formula
-        //    We simply return the cell value if not
-        $formula = trim($formula);
-        if ($formula{0} != '=') {
-            return self::wrapResult($formula);
-        }
-        $formula = ltrim(substr($formula, 1));
-        if (!isset($formula{0})) {
-            return self::wrapResult($formula);
-        }
-
-        $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null;
-        $wsTitle = ($pCellParent !== null) ? $pCellParent->getTitle() : "\x00Wrk";
-        $wsCellReference = $wsTitle . '!' . $cellID;
-
-        if (($cellID !== null) && ($this->getValueFromCache($wsCellReference, $cellValue))) {
-            return $cellValue;
-        }
-
-        if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
-            if ($this->cyclicFormulaCount <= 0) {
-                $this->cyclicFormulaCell = '';
-                return $this->raiseFormulaError('Cyclic Reference in Formula');
-            } elseif ($this->cyclicFormulaCell === $wsCellReference) {
-                ++$this->cyclicFormulaCounter;
-                if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
-                    $this->cyclicFormulaCell = '';
-                    return $cellValue;
-                }
-            } elseif ($this->cyclicFormulaCell == '') {
-                if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
-                    return $cellValue;
-                }
-                $this->cyclicFormulaCell = $wsCellReference;
-            }
-        }
-
-        //    Parse the formula onto the token stack and calculate the value
-        $this->cyclicReferenceStack->push($wsCellReference);
-        $cellValue = $this->processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
-        $this->cyclicReferenceStack->pop();
-
-        // Save to calculation cache
-        if ($cellID !== null) {
-            $this->saveValueToCache($wsCellReference, $cellValue);
-        }
-
-        //    Return the calculated value
-        return $cellValue;
-    }
-
-
-    /**
-     * Ensure that paired matrix operands are both matrices and of the same size
-     *
-     * @param    mixed        &$operand1    First matrix operand
-     * @param    mixed        &$operand2    Second matrix operand
-     * @param    integer        $resize        Flag indicating whether the matrices should be resized to match
-     *                                        and (if so), whether the smaller dimension should grow or the
-     *                                        larger should shrink.
-     *                                            0 = no resize
-     *                                            1 = shrink to fit
-     *                                            2 = extend to fit
-     */
-    private static function checkMatrixOperands(&$operand1, &$operand2, $resize = 1)
-    {
-        //    Examine each of the two operands, and turn them into an array if they aren't one already
-        //    Note that this function should only be called if one or both of the operand is already an array
-        if (!is_array($operand1)) {
-            list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand2);
-            $operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
-            $resize = 0;
-        } elseif (!is_array($operand2)) {
-            list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand1);
-            $operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
-            $resize = 0;
-        }
-
-        list($matrix1Rows, $matrix1Columns) = self::getMatrixDimensions($operand1);
-        list($matrix2Rows, $matrix2Columns) = self::getMatrixDimensions($operand2);
-        if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
-            $resize = 1;
-        }
-
-        if ($resize == 2) {
-            //    Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
-            self::resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
-        } elseif ($resize == 1) {
-            //    Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
-            self::resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
-        }
-        return array( $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
-    }
-
-
-    /**
-     * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0
-     *
-     * @param    mixed        &$matrix        matrix operand
-     * @return    array        An array comprising the number of rows, and number of columns
-     */
-    private static function getMatrixDimensions(&$matrix)
-    {
-        $matrixRows = count($matrix);
-        $matrixColumns = 0;
-        foreach ($matrix as $rowKey => $rowValue) {
-            $matrixColumns = max(count($rowValue), $matrixColumns);
-            if (!is_array($rowValue)) {
-                $matrix[$rowKey] = array($rowValue);
-            } else {
-                $matrix[$rowKey] = array_values($rowValue);
-            }
-        }
-        $matrix = array_values($matrix);
-        return array($matrixRows, $matrixColumns);
-    }
-
-
-    /**
-     * Ensure that paired matrix operands are both matrices of the same size
-     *
-     * @param    mixed        &$matrix1        First matrix operand
-     * @param    mixed        &$matrix2        Second matrix operand
-     * @param    integer        $matrix1Rows    Row size of first matrix operand
-     * @param    integer        $matrix1Columns    Column size of first matrix operand
-     * @param    integer        $matrix2Rows    Row size of second matrix operand
-     * @param    integer        $matrix2Columns    Column size of second matrix operand
-     */
-    private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
-    {
-        if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
-            if ($matrix2Rows < $matrix1Rows) {
-                for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) {
-                    unset($matrix1[$i]);
-                }
-            }
-            if ($matrix2Columns < $matrix1Columns) {
-                for ($i = 0; $i < $matrix1Rows; ++$i) {
-                    for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
-                        unset($matrix1[$i][$j]);
-                    }
-                }
-            }
-        }
-
-        if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
-            if ($matrix1Rows < $matrix2Rows) {
-                for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) {
-                    unset($matrix2[$i]);
-                }
-            }
-            if ($matrix1Columns < $matrix2Columns) {
-                for ($i = 0; $i < $matrix2Rows; ++$i) {
-                    for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
-                        unset($matrix2[$i][$j]);
-                    }
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Ensure that paired matrix operands are both matrices of the same size
-     *
-     * @param    mixed        &$matrix1    First matrix operand
-     * @param    mixed        &$matrix2    Second matrix operand
-     * @param    integer        $matrix1Rows    Row size of first matrix operand
-     * @param    integer        $matrix1Columns    Column size of first matrix operand
-     * @param    integer        $matrix2Rows    Row size of second matrix operand
-     * @param    integer        $matrix2Columns    Column size of second matrix operand
-     */
-    private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
-    {
-        if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
-            if ($matrix2Columns < $matrix1Columns) {
-                for ($i = 0; $i < $matrix2Rows; ++$i) {
-                    $x = $matrix2[$i][$matrix2Columns-1];
-                    for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
-                        $matrix2[$i][$j] = $x;
-                    }
-                }
-            }
-            if ($matrix2Rows < $matrix1Rows) {
-                $x = $matrix2[$matrix2Rows-1];
-                for ($i = 0; $i < $matrix1Rows; ++$i) {
-                    $matrix2[$i] = $x;
-                }
-            }
-        }
-
-        if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
-            if ($matrix1Columns < $matrix2Columns) {
-                for ($i = 0; $i < $matrix1Rows; ++$i) {
-                    $x = $matrix1[$i][$matrix1Columns-1];
-                    for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
-                        $matrix1[$i][$j] = $x;
-                    }
-                }
-            }
-            if ($matrix1Rows < $matrix2Rows) {
-                $x = $matrix1[$matrix1Rows-1];
-                for ($i = 0; $i < $matrix2Rows; ++$i) {
-                    $matrix1[$i] = $x;
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Format details of an operand for display in the log (based on operand type)
-     *
-     * @param    mixed        $value    First matrix operand
-     * @return    mixed
-     */
-    private function showValue($value)
-    {
-        if ($this->_debugLog->getWriteDebugLog()) {
-            $testArray = PHPExcel_Calculation_Functions::flattenArray($value);
-            if (count($testArray) == 1) {
-                $value = array_pop($testArray);
-            }
-
-            if (is_array($value)) {
-                $returnMatrix = array();
-                $pad = $rpad = ', ';
-                foreach ($value as $row) {
-                    if (is_array($row)) {
-                        $returnMatrix[] = implode($pad, array_map(array($this, 'showValue'), $row));
-                        $rpad = '; ';
-                    } else {
-                        $returnMatrix[] = $this->showValue($row);
-                    }
-                }
-                return '{ '.implode($rpad, $returnMatrix).' }';
-            } elseif (is_string($value) && (trim($value, '"') == $value)) {
-                return '"'.$value.'"';
-            } elseif (is_bool($value)) {
-                return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
-            }
-        }
-        return PHPExcel_Calculation_Functions::flattenSingleValue($value);
-    }
-
-
-    /**
-     * Format type and details of an operand for display in the log (based on operand type)
-     *
-     * @param    mixed        $value    First matrix operand
-     * @return    mixed
-     */
-    private function showTypeDetails($value)
-    {
-        if ($this->_debugLog->getWriteDebugLog()) {
-            $testArray = PHPExcel_Calculation_Functions::flattenArray($value);
-            if (count($testArray) == 1) {
-                $value = array_pop($testArray);
-            }
-
-            if ($value === null) {
-                return 'a NULL value';
-            } elseif (is_float($value)) {
-                $typeString = 'a floating point number';
-            } elseif (is_int($value)) {
-                $typeString = 'an integer number';
-            } elseif (is_bool($value)) {
-                $typeString = 'a boolean';
-            } elseif (is_array($value)) {
-                $typeString = 'a matrix';
-            } else {
-                if ($value == '') {
-                    return 'an empty string';
-                } elseif ($value{0} == '#') {
-                    return 'a '.$value.' error';
-                } else {
-                    $typeString = 'a string';
-                }
-            }
-            return $typeString.' with a value of '.$this->showValue($value);
-        }
-    }
-
-
-    private function convertMatrixReferences($formula)
-    {
-        static $matrixReplaceFrom = array('{', ';', '}');
-        static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(', '),MKMATRIX(', '))');
-
-        //    Convert any Excel matrix references to the MKMATRIX() function
-        if (strpos($formula, '{') !== false) {
-            //    If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
-            if (strpos($formula, '"') !== false) {
-                //    So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
-                //        the formula
-                $temp = explode('"', $formula);
-                //    Open and Closed counts used for trapping mismatched braces in the formula
-                $openCount = $closeCount = 0;
-                $i = false;
-                foreach ($temp as &$value) {
-                    //    Only count/replace in alternating array entries
-                    if ($i = !$i) {
-                        $openCount += substr_count($value, '{');
-                        $closeCount += substr_count($value, '}');
-                        $value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value);
-                    }
-                }
-                unset($value);
-                //    Then rebuild the formula string
-                $formula = implode('"', $temp);
-            } else {
-                //    If there's no quoted strings, then we do a simple count/replace
-                $openCount = substr_count($formula, '{');
-                $closeCount = substr_count($formula, '}');
-                $formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula);
-            }
-            //    Trap for mismatched braces and trigger an appropriate error
-            if ($openCount < $closeCount) {
-                if ($openCount > 0) {
-                    return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '}'");
-                } else {
-                    return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered");
-                }
-            } elseif ($openCount > $closeCount) {
-                if ($closeCount > 0) {
-                    return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '{'");
-                } else {
-                    return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered");
-                }
-            }
-        }
-
-        return $formula;
-    }
-
-
-    private static function mkMatrix()
-    {
-        return func_get_args();
-    }
-
-
-    //    Binary Operators
-    //    These operators always work on two values
-    //    Array key is the operator, the value indicates whether this is a left or right associative operator
-    private static $operatorAssociativity    = array(
-        '^' => 0,                                                            //    Exponentiation
-        '*' => 0, '/' => 0,                                                 //    Multiplication and Division
-        '+' => 0, '-' => 0,                                                    //    Addition and Subtraction
-        '&' => 0,                                                            //    Concatenation
-        '|' => 0, ':' => 0,                                                    //    Intersect and Range
-        '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0        //    Comparison
-    );
-
-    //    Comparison (Boolean) Operators
-    //    These operators work on two values, but always return a boolean result
-    private static $comparisonOperators    = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true);
-
-    //    Operator Precedence
-    //    This list includes all valid operators, whether binary (including boolean) or unary (such as %)
-    //    Array key is the operator, the value is its precedence
-    private static $operatorPrecedence    = array(
-        ':' => 8,                                                                //    Range
-        '|' => 7,                                                                //    Intersect
-        '~' => 6,                                                                //    Negation
-        '%' => 5,                                                                //    Percentage
-        '^' => 4,                                                                //    Exponentiation
-        '*' => 3, '/' => 3,                                                     //    Multiplication and Division
-        '+' => 2, '-' => 2,                                                        //    Addition and Subtraction
-        '&' => 1,                                                                //    Concatenation
-        '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0            //    Comparison
-    );
-
-    // Convert infix to postfix notation
-    private function _parseFormula($formula, PHPExcel_Cell $pCell = null)
-    {
-        if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
-            return false;
-        }
-
-        //    If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
-        //        so we store the parent worksheet so that we can re-attach it when necessary
-        $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null;
-
-        $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION.
-                               '|'.self::CALCULATION_REGEXP_CELLREF.
-                               '|'.self::CALCULATION_REGEXP_NUMBER.
-                               '|'.self::CALCULATION_REGEXP_STRING.
-                               '|'.self::CALCULATION_REGEXP_OPENBRACE.
-                               '|'.self::CALCULATION_REGEXP_NAMEDRANGE.
-                               '|'.self::CALCULATION_REGEXP_ERROR.
-                             ')/si';
-
-        //    Start with initialisation
-        $index = 0;
-        $stack = new PHPExcel_Calculation_Token_Stack;
-        $output = array();
-        $expectingOperator = false;                    //    We use this test in syntax-checking the expression to determine when a
-                                                    //        - is a negation or + is a positive operator rather than an operation
-        $expectingOperand = false;                    //    We use this test in syntax-checking the expression to determine whether an operand
-                                                    //        should be null in a function call
-        //    The guts of the lexical parser
-        //    Loop through the formula extracting each operator and operand in turn
-        while (true) {
-//echo 'Assessing Expression '.substr($formula, $index), PHP_EOL;
-            $opCharacter = $formula{$index};    //    Get the first character of the value at the current index position
-//echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
-            if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) {
-                $opCharacter .= $formula{++$index};
-//echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
-            }
-
-            //    Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand
-            $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match);
-//echo '$isOperandOrFunction is '.(($isOperandOrFunction) ? 'True' : 'False').PHP_EOL;
-//var_dump($match);
-
-            if ($opCharacter == '-' && !$expectingOperator) {                //    Is it a negation instead of a minus?
-//echo 'Element is a Negation operator', PHP_EOL;
-                $stack->push('Unary Operator', '~');                            //    Put a negation on the stack
-                ++$index;                                                    //        and drop the negation symbol
-            } elseif ($opCharacter == '%' && $expectingOperator) {
-//echo 'Element is a Percentage operator', PHP_EOL;
-                $stack->push('Unary Operator', '%');                            //    Put a percentage on the stack
-                ++$index;
-            } elseif ($opCharacter == '+' && !$expectingOperator) {            //    Positive (unary plus rather than binary operator plus) can be discarded?
-//echo 'Element is a Positive number, not Plus operator', PHP_EOL;
-                ++$index;                                                    //    Drop the redundant plus symbol
-            } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) {    //    We have to explicitly deny a tilde or pipe, because they are legal
-                return $this->raiseFormulaError("Formula Error: Illegal character '~'");                //        on the stack but not in the input expression
-
-            } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) {    //    Are we putting an operator on the stack?
-//echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL;
-                while ($stack->count() > 0 &&
-                    ($o2 = $stack->last()) &&
-                    isset(self::$operators[$o2['value']]) &&
-                    @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
-                    $output[] = $stack->pop();                                //    Swap operands and higher precedence operators from the stack to the output
-                }
-                $stack->push('Binary Operator', $opCharacter);    //    Finally put our current operator onto the stack
-                ++$index;
-                $expectingOperator = false;
-
-            } elseif ($opCharacter == ')' && $expectingOperator) {            //    Are we expecting to close a parenthesis?
-//echo 'Element is a Closing bracket', PHP_EOL;
-                $expectingOperand = false;
-                while (($o2 = $stack->pop()) && $o2['value'] != '(') {        //    Pop off the stack back to the last (
-                    if ($o2 === null) {
-                        return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"');
-                    } else {
-                        $output[] = $o2;
-                    }
-                }
-                $d = $stack->last(2);
-                if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {    //    Did this parenthesis just close a function?
-                    $functionName = $matches[1];                                        //    Get the function name
-//echo 'Closed Function is '.$functionName, PHP_EOL;
-                    $d = $stack->pop();
-                    $argumentCount = $d['value'];        //    See how many arguments there were (argument count is the next value stored on the stack)
-//if ($argumentCount == 0) {
-//    echo 'With no arguments', PHP_EOL;
-//} elseif ($argumentCount == 1) {
-//    echo 'With 1 argument', PHP_EOL;
-//} else {
-//    echo 'With '.$argumentCount.' arguments', PHP_EOL;
-//}
-                    $output[] = $d;                        //    Dump the argument count on the output
-                    $output[] = $stack->pop();            //    Pop the function and push onto the output
-                    if (isset(self::$controlFunctions[$functionName])) {
-//echo 'Built-in function '.$functionName, PHP_EOL;
-                        $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
-                        $functionCall = self::$controlFunctions[$functionName]['functionCall'];
-                    } elseif (isset(self::$PHPExcelFunctions[$functionName])) {
-//echo 'PHPExcel function '.$functionName, PHP_EOL;
-                        $expectedArgumentCount = self::$PHPExcelFunctions[$functionName]['argumentCount'];
-                        $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
-                    } else {    // did we somehow push a non-function on the stack? this should never happen
-                        return $this->raiseFormulaError("Formula Error: Internal error, non-function on stack");
-                    }
-                    //    Check the argument count
-                    $argumentCountError = false;
-                    if (is_numeric($expectedArgumentCount)) {
-                        if ($expectedArgumentCount < 0) {
-//echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount), PHP_EOL;
-                            if ($argumentCount > abs($expectedArgumentCount)) {
-                                $argumentCountError = true;
-                                $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount);
-                            }
-                        } else {
-//echo '$expectedArgumentCount is numeric '.$expectedArgumentCount, PHP_EOL;
-                            if ($argumentCount != $expectedArgumentCount) {
-                                $argumentCountError = true;
-                                $expectedArgumentCountString = $expectedArgumentCount;
-                            }
-                        }
-                    } elseif ($expectedArgumentCount != '*') {
-                        $isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch);
-//print_r($argMatch);
-//echo PHP_EOL;
-                        switch ($argMatch[2]) {
-                            case '+':
-                                if ($argumentCount < $argMatch[1]) {
-                                    $argumentCountError = true;
-                                    $expectedArgumentCountString = $argMatch[1].' or more ';
-                                }
-                                break;
-                            case '-':
-                                if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) {
-                                    $argumentCountError = true;
-                                    $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3];
-                                }
-                                break;
-                            case ',':
-                                if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) {
-                                    $argumentCountError = true;
-                                    $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3];
-                                }
-                                break;
-                        }
-                    }
-                    if ($argumentCountError) {
-                        return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected");
-                    }
-                }
-                ++$index;
-
-            } elseif ($opCharacter == ',') {            //    Is this the separator for function arguments?
-//echo 'Element is a Function argument separator', PHP_EOL;
-                while (($o2 = $stack->pop()) && $o2['value'] != '(') {        //    Pop off the stack back to the last (
-                    if ($o2 === null) {
-                        return $this->raiseFormulaError("Formula Error: Unexpected ,");
-                    } else {
-                        $output[] = $o2;    // pop the argument expression stuff and push onto the output
-                    }
-                }
-                //    If we've a comma when we're expecting an operand, then what we actually have is a null operand;
-                //        so push a null onto the stack
-                if (($expectingOperand) || (!$expectingOperator)) {
-                    $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
-                }
-                // make sure there was a function
-                $d = $stack->last(2);
-                if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {
-                    return $this->raiseFormulaError("Formula Error: Unexpected ,");
-                }
-                $d = $stack->pop();
-                $stack->push($d['type'], ++$d['value'], $d['reference']);    // increment the argument count
-                $stack->push('Brace', '(');    // put the ( back on, we'll need to pop back to it again
-                $expectingOperator = false;
-                $expectingOperand = true;
-                ++$index;
-
-            } elseif ($opCharacter == '(' && !$expectingOperator) {
-//                echo 'Element is an Opening Bracket<br />';
-                $stack->push('Brace', '(');
-                ++$index;
-
-            } elseif ($isOperandOrFunction && !$expectingOperator) {    // do we now have a function/variable/number?
-                $expectingOperator = true;
-                $expectingOperand = false;
-                $val = $match[1];
-                $length = strlen($val);
-//                echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
-
-                if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
-                    $val = preg_replace('/\s/u', '', $val);
-//                    echo 'Element '.$val.' is a Function<br />';
-                    if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) {    // it's a function
-                        $stack->push('Function', strtoupper($val));
-                        $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
-                        if ($ax) {
-                            $stack->push('Operand Count for Function '.strtoupper($val).')', 0);
-                            $expectingOperator = true;
-                        } else {
-                            $stack->push('Operand Count for Function '.strtoupper($val).')', 1);
-                            $expectingOperator = false;
-                        }
-                        $stack->push('Brace', '(');
-                    } else {    // it's a var w/ implicit multiplication
-                        $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null);
-                    }
-                } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) {
-//                    echo 'Element '.$val.' is a Cell reference<br />';
-                    //    Watch for this case-change when modifying to allow cell references in different worksheets...
-                    //    Should only be applied to the actual cell column, not the worksheet name
-
-                    //    If the last entry on the stack was a : operator, then we have a cell range reference
-                    $testPrevOp = $stack->last(1);
-                    if ($testPrevOp['value'] == ':') {
-                        //    If we have a worksheet reference, then we're playing with a 3D reference
-                        if ($matches[2] == '') {
-                            //    Otherwise, we 'inherit' the worksheet reference from the start cell reference
-                            //    The start of the cell range reference should be the last entry in $output
-                            $startCellRef = $output[count($output)-1]['value'];
-                            preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches);
-                            if ($startMatches[2] > '') {
-                                $val = $startMatches[2].'!'.$val;
-                            }
-                        } else {
-                            return $this->raiseFormulaError("3D Range references are not yet supported");
-                        }
-                    }
-
-                    $output[] = array('type' => 'Cell Reference', 'value' => $val, 'reference' => $val);
-//                    $expectingOperator = FALSE;
-                } else {    // it's a variable, constant, string, number or boolean
-//                    echo 'Element is a Variable, Constant, String, Number or Boolean<br />';
-                    //    If the last entry on the stack was a : operator, then we may have a row or column range reference
-                    $testPrevOp = $stack->last(1);
-                    if ($testPrevOp['value'] == ':') {
-                        $startRowColRef = $output[count($output)-1]['value'];
-                        $rangeWS1 = '';
-                        if (strpos('!', $startRowColRef) !== false) {
-                            list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef);
-                        }
-                        if ($rangeWS1 != '') {
-                            $rangeWS1 .= '!';
-                        }
-                        $rangeWS2 = $rangeWS1;
-                        if (strpos('!', $val) !== false) {
-                            list($rangeWS2, $val) = explode('!', $val);
-                        }
-                        if ($rangeWS2 != '') {
-                            $rangeWS2 .= '!';
-                        }
-                        if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
-                            ($startRowColRef <= 1048576) && ($val <= 1048576)) {
-                            //    Row range
-                            $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD';    //    Max 16,384 columns for Excel2007
-                            $output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef;
-                            $val = $rangeWS2.$endRowColRef.$val;
-                        } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
-                            (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
-                            //    Column range
-                            $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576;        //    Max 1,048,576 rows for Excel2007
-                            $output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
-                            $val = $rangeWS2.$val.$endRowColRef;
-                        }
-                    }
-
-                    $localeConstant = false;
-                    if ($opCharacter == '"') {
-//                        echo 'Element is a String<br />';
-                        //    UnEscape any quotes within the string
-                        $val = self::wrapResult(str_replace('""', '"', self::unwrapResult($val)));
-                    } elseif (is_numeric($val)) {
-//                        echo 'Element is a Number<br />';
-                        if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
-//                            echo 'Casting '.$val.' to float<br />';
-                            $val = (float) $val;
-                        } else {
-//                            echo 'Casting '.$val.' to integer<br />';
-                            $val = (integer) $val;
-                        }
-                    } elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
-                        $excelConstant = trim(strtoupper($val));
-//                        echo 'Element '.$excelConstant.' is an Excel Constant<br />';
-                        $val = self::$excelConstants[$excelConstant];
-                    } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
-//                        echo 'Element '.$localeConstant.' is an Excel Constant<br />';
-                        $val = self::$excelConstants[$localeConstant];
-                    }
-                    $details = array('type' => 'Value', 'value' => $val, 'reference' => null);
-                    if ($localeConstant) {
-                        $details['localeValue'] = $localeConstant;
-                    }
-                    $output[] = $details;
-                }
-                $index += $length;
-
-            } elseif ($opCharacter == '$') {    // absolute row or column range
-                ++$index;
-            } elseif ($opCharacter == ')') {    // miscellaneous error checking
-                if ($expectingOperand) {
-                    $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
-                    $expectingOperand = false;
-                    $expectingOperator = true;
-                } else {
-                    return $this->raiseFormulaError("Formula Error: Unexpected ')'");
-                }
-            } elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
-                return $this->raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
-            } else {    // I don't even want to know what you did to get here
-                return $this->raiseFormulaError("Formula Error: An unexpected error occured");
-            }
-            //    Test for end of formula string
-            if ($index == strlen($formula)) {
-                //    Did we end with an operator?.
-                //    Only valid for the % unary operator
-                if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
-                    return $this->raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
-                } else {
-                    break;
-                }
-            }
-            //    Ignore white space
-            while (($formula{$index} == "\n") || ($formula{$index} == "\r")) {
-                ++$index;
-            }
-            if ($formula{$index} == ' ') {
-                while ($formula{$index} == ' ') {
-                    ++$index;
-                }
-                //    If we're expecting an operator, but only have a space between the previous and next operands (and both are
-                //        Cell References) then we have an INTERSECTION operator
-//                echo 'Possible Intersect Operator<br />';
-                if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) &&
-                    ($output[count($output)-1]['type'] == 'Cell Reference')) {
-//                    echo 'Element is an Intersect Operator<br />';
-                    while ($stack->count() > 0 &&
-                        ($o2 = $stack->last()) &&
-                        isset(self::$operators[$o2['value']]) &&
-                        @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
-                        $output[] = $stack->pop();                                //    Swap operands and higher precedence operators from the stack to the output
-                    }
-                    $stack->push('Binary Operator', '|');    //    Put an Intersect Operator on the stack
-                    $expectingOperator = false;
-                }
-            }
-        }
-
-        while (($op = $stack->pop()) !== null) {    // pop everything off the stack and push onto output
-            if ((is_array($op) && $op['value'] == '(') || ($op === '(')) {
-                return $this->raiseFormulaError("Formula Error: Expecting ')'");    // if there are any opening braces on the stack, then braces were unbalanced
-            }
-            $output[] = $op;
-        }
-        return $output;
-    }
-
-
-    private static function dataTestReference(&$operandData)
-    {
-        $operand = $operandData['value'];
-        if (($operandData['reference'] === null) && (is_array($operand))) {
-            $rKeys = array_keys($operand);
-            $rowKey = array_shift($rKeys);
-            $cKeys = array_keys(array_keys($operand[$rowKey]));
-            $colKey = array_shift($cKeys);
-            if (ctype_upper($colKey)) {
-                $operandData['reference'] = $colKey.$rowKey;
-            }
-        }
-        return $operand;
-    }
-
-    // evaluate postfix notation
-    private function processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null)
-    {
-        if ($tokens == false) {
-            return false;
-        }
-
-        //    If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent cell collection),
-        //        so we store the parent cell collection so that we can re-attach it when necessary
-        $pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null;
-        $pCellParent = ($pCell !== null) ? $pCell->getParent() : null;
-        $stack = new PHPExcel_Calculation_Token_Stack;
-
-        //    Loop through each token in turn
-        foreach ($tokens as $tokenData) {
-//            print_r($tokenData);
-//            echo '<br />';
-            $token = $tokenData['value'];
-//            echo '<b>Token is '.$token.'</b><br />';
-            // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
-            if (isset(self::$binaryOperators[$token])) {
-//                echo 'Token is a binary operator<br />';
-                //    We must have two operands, error if we don't
-                if (($operand2Data = $stack->pop()) === null) {
-                    return $this->raiseFormulaError('Internal error - Operand value missing from stack');
-                }
-                if (($operand1Data = $stack->pop()) === null) {
-                    return $this->raiseFormulaError('Internal error - Operand value missing from stack');
-                }
-
-                $operand1 = self::dataTestReference($operand1Data);
-                $operand2 = self::dataTestReference($operand2Data);
-
-                //    Log what we're doing
-                if ($token == ':') {
-                    $this->_debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference']));
-                } else {
-                    $this->_debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2));
-                }
-
-                //    Process the operation in the appropriate manner
-                switch ($token) {
-                    //    Comparison (Boolean) Operators
-                    case '>':            //    Greater than
-                    case '<':            //    Less than
-                    case '>=':            //    Greater than or Equal to
-                    case '<=':            //    Less than or Equal to
-                    case '=':            //    Equality
-                    case '<>':            //    Inequality
-                        $this->executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack);
-                        break;
-                    //    Binary Operators
-                    case ':':            //    Range
-                        $sheet1 = $sheet2 = '';
-                        if (strpos($operand1Data['reference'], '!') !== false) {
-                            list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']);
-                        } else {
-                            $sheet1 = ($pCellParent !== null) ? $pCellWorksheet->getTitle() : '';
-                        }
-                        if (strpos($operand2Data['reference'], '!') !== false) {
-                            list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']);
-                        } else {
-                            $sheet2 = $sheet1;
-                        }
-                        if ($sheet1 == $sheet2) {
-                            if ($operand1Data['reference'] === null) {
-                                if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) {
-                                    $operand1Data['reference'] = $pCell->getColumn().$operand1Data['value'];
-                                } elseif (trim($operand1Data['reference']) == '') {
-                                    $operand1Data['reference'] = $pCell->getCoordinate();
-                                } else {
-                                    $operand1Data['reference'] = $operand1Data['value'].$pCell->getRow();
-                                }
-                            }
-                            if ($operand2Data['reference'] === null) {
-                                if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) {
-                                    $operand2Data['reference'] = $pCell->getColumn().$operand2Data['value'];
-                                } elseif (trim($operand2Data['reference']) == '') {
-                                    $operand2Data['reference'] = $pCell->getCoordinate();
-                                } else {
-                                    $operand2Data['reference'] = $operand2Data['value'].$pCell->getRow();
-                                }
-                            }
-
-                            $oData = array_merge(explode(':', $operand1Data['reference']), explode(':', $operand2Data['reference']));
-                            $oCol = $oRow = array();
-                            foreach ($oData as $oDatum) {
-                                $oCR = PHPExcel_Cell::coordinateFromString($oDatum);
-                                $oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1;
-                                $oRow[] = $oCR[1];
-                            }
-                            $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
-                            if ($pCellParent !== null) {
-                                $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
-                            } else {
-                                return $this->raiseFormulaError('Unable to access Cell Reference');
-                            }
-                            $stack->push('Cell Reference', $cellValue, $cellRef);
-                        } else {
-                            $stack->push('Error', PHPExcel_Calculation_Functions::REF(), null);
-                        }
-                        break;
-                    case '+':            //    Addition
-                        $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack);
-                        break;
-                    case '-':            //    Subtraction
-                        $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack);
-                        break;
-                    case '*':            //    Multiplication
-                        $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack);
-                        break;
-                    case '/':            //    Division
-                        $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack);
-                        break;
-                    case '^':            //    Exponential
-                        $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack);
-                        break;
-                    case '&':            //    Concatenation
-                        //    If either of the operands is a matrix, we need to treat them both as matrices
-                        //        (converting the other operand to a matrix if need be); then perform the required
-                        //        matrix operation
-                        if (is_bool($operand1)) {
-                            $operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
-                        }
-                        if (is_bool($operand2)) {
-                            $operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
-                        }
-                        if ((is_array($operand1)) || (is_array($operand2))) {
-                            //    Ensure that both operands are arrays/matrices
-                            self::checkMatrixOperands($operand1, $operand2, 2);
-                            try {
-                                //    Convert operand 1 from a PHP array to a matrix
-                                $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
-                                //    Perform the required operation against the operand 1 matrix, passing in operand 2
-                                $matrixResult = $matrix->concat($operand2);
-                                $result = $matrixResult->getArray();
-                            } catch (PHPExcel_Exception $ex) {
-                                $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
-                                $result = '#VALUE!';
-                            }
-                        } else {
-                            $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"';
-                        }
-                        $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-                        $stack->push('Value', $result);
-                        break;
-                    case '|':            //    Intersect
-                        $rowIntersect = array_intersect_key($operand1, $operand2);
-                        $cellIntersect = $oCol = $oRow = array();
-                        foreach (array_keys($rowIntersect) as $row) {
-                            $oRow[] = $row;
-                            foreach ($rowIntersect[$row] as $col => $data) {
-                                $oCol[] = PHPExcel_Cell::columnIndexFromString($col) - 1;
-                                $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]);
-                            }
-                        }
-                        $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
-                        $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect));
-                        $stack->push('Value', $cellIntersect, $cellRef);
-                        break;
-                }
-
-            // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
-            } elseif (($token === '~') || ($token === '%')) {
-//                echo 'Token is a unary operator<br />';
-                if (($arg = $stack->pop()) === null) {
-                    return $this->raiseFormulaError('Internal error - Operand value missing from stack');
-                }
-                $arg = $arg['value'];
-                if ($token === '~') {
-//                    echo 'Token is a negation operator<br />';
-                    $this->_debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg));
-                    $multiplier = -1;
-                } else {
-//                    echo 'Token is a percentile operator<br />';
-                    $this->_debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg));
-                    $multiplier = 0.01;
-                }
-                if (is_array($arg)) {
-                    self::checkMatrixOperands($arg, $multiplier, 2);
-                    try {
-                        $matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg);
-                        $matrixResult = $matrix1->arrayTimesEquals($multiplier);
-                        $result = $matrixResult->getArray();
-                    } catch (PHPExcel_Exception $ex) {
-                        $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
-                        $result = '#VALUE!';
-                    }
-                    $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-                    $stack->push('Value', $result);
-                } else {
-                    $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
-                }
-
-            } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
-                $cellRef = null;
-//                echo 'Element '.$token.' is a Cell reference<br />';
-                if (isset($matches[8])) {
-//                    echo 'Reference is a Range of cells<br />';
-                    if ($pCell === null) {
-//                        We can't access the range, so return a REF error
-                        $cellValue = PHPExcel_Calculation_Functions::REF();
-                    } else {
-                        $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10];
-                        if ($matches[2] > '') {
-                            $matches[2] = trim($matches[2], "\"'");
-                            if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
-                                //    It's a Reference to an external workbook (not currently supported)
-                                return $this->raiseFormulaError('Unable to access External Workbook');
-                            }
-                            $matches[2] = trim($matches[2], "\"'");
-//                            echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
-                            $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
-                            if ($pCellParent !== null) {
-                                $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
-                            } else {
-                                return $this->raiseFormulaError('Unable to access Cell Reference');
-                            }
-                            $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
-//                            $cellRef = $matches[2].'!'.$cellRef;
-                        } else {
-//                            echo '$cellRef='.$cellRef.' in current worksheet<br />';
-                            $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
-                            if ($pCellParent !== null) {
-                                $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
-                            } else {
-                                return $this->raiseFormulaError('Unable to access Cell Reference');
-                            }
-                            $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
-                        }
-                    }
-                } else {
-//                    echo 'Reference is a single Cell<br />';
-                    if ($pCell === null) {
-//                        We can't access the cell, so return a REF error
-                        $cellValue = PHPExcel_Calculation_Functions::REF();
-                    } else {
-                        $cellRef = $matches[6].$matches[7];
-                        if ($matches[2] > '') {
-                            $matches[2] = trim($matches[2], "\"'");
-                            if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
-                                //    It's a Reference to an external workbook (not currently supported)
-                                return $this->raiseFormulaError('Unable to access External Workbook');
-                            }
-//                            echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
-                            $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
-                            if ($pCellParent !== null) {
-                                $cellSheet = $this->workbook->getSheetByName($matches[2]);
-                                if ($cellSheet && $cellSheet->cellExists($cellRef)) {
-                                    $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
-                                    $pCell->attach($pCellParent);
-                                } else {
-                                    $cellValue = null;
-                                }
-                            } else {
-                                return $this->raiseFormulaError('Unable to access Cell Reference');
-                            }
-                            $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
-//                            $cellRef = $matches[2].'!'.$cellRef;
-                        } else {
-//                            echo '$cellRef='.$cellRef.' in current worksheet<br />';
-                            $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
-                            if ($pCellParent->isDataSet($cellRef)) {
-                                $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
-                                $pCell->attach($pCellParent);
-                            } else {
-                                $cellValue = null;
-                            }
-                            $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
-                        }
-                    }
-                }
-                $stack->push('Value', $cellValue, $cellRef);
-
-            // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
-            } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) {
-//                echo 'Token is a function<br />';
-                $functionName = $matches[1];
-                $argCount = $stack->pop();
-                $argCount = $argCount['value'];
-                if ($functionName != 'MKMATRIX') {
-                    $this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
-                }
-                if ((isset(self::$PHPExcelFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) {    // function
-                    if (isset(self::$PHPExcelFunctions[$functionName])) {
-                        $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
-                        $passByReference = isset(self::$PHPExcelFunctions[$functionName]['passByReference']);
-                        $passCellReference = isset(self::$PHPExcelFunctions[$functionName]['passCellReference']);
-                    } elseif (isset(self::$controlFunctions[$functionName])) {
-                        $functionCall = self::$controlFunctions[$functionName]['functionCall'];
-                        $passByReference = isset(self::$controlFunctions[$functionName]['passByReference']);
-                        $passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
-                    }
-                    // get the arguments for this function
-//                    echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
-                    $args = $argArrayVals = array();
-                    for ($i = 0; $i < $argCount; ++$i) {
-                        $arg = $stack->pop();
-                        $a = $argCount - $i - 1;
-                        if (($passByReference) &&
-                            (isset(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
-                            (self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) {
-                            if ($arg['reference'] === null) {
-                                $args[] = $cellID;
-                                if ($functionName != 'MKMATRIX') {
-                                    $argArrayVals[] = $this->showValue($cellID);
-                                }
-                            } else {
-                                $args[] = $arg['reference'];
-                                if ($functionName != 'MKMATRIX') {
-                                    $argArrayVals[] = $this->showValue($arg['reference']);
-                                }
-                            }
-                        } else {
-                            $args[] = self::unwrapResult($arg['value']);
-                            if ($functionName != 'MKMATRIX') {
-                                $argArrayVals[] = $this->showValue($arg['value']);
-                            }
-                        }
-                    }
-                    //    Reverse the order of the arguments
-                    krsort($args);
-                    if (($passByReference) && ($argCount == 0)) {
-                        $args[] = $cellID;
-                        $argArrayVals[] = $this->showValue($cellID);
-                    }
-//                    echo 'Arguments are: ';
-//                    print_r($args);
-//                    echo '<br />';
-                    if ($functionName != 'MKMATRIX') {
-                        if ($this->_debugLog->getWriteDebugLog()) {
-                            krsort($argArrayVals);
-                            $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
-                        }
-                    }
-                    //    Process each argument in turn, building the return value as an array
-//                    if (($argCount == 1) && (is_array($args[1])) && ($functionName != 'MKMATRIX')) {
-//                        $operand1 = $args[1];
-//                        $this->_debugLog->writeDebugLog('Argument is a matrix: ', $this->showValue($operand1));
-//                        $result = array();
-//                        $row = 0;
-//                        foreach($operand1 as $args) {
-//                            if (is_array($args)) {
-//                                foreach($args as $arg) {
-//                                    $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->showValue($arg), ' )');
-//                                    $r = call_user_func_array($functionCall, $arg);
-//                                    $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($r));
-//                                    $result[$row][] = $r;
-//                                }
-//                                ++$row;
-//                            } else {
-//                                $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->showValue($args), ' )');
-//                                $r = call_user_func_array($functionCall, $args);
-//                                $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($r));
-//                                $result[] = $r;
-//                            }
-//                        }
-//                    } else {
-                    //    Process the argument with the appropriate function call
-                    if ($passCellReference) {
-                        $args[] = $pCell;
-                    }
-                    if (strpos($functionCall, '::') !== false) {
-                        $result = call_user_func_array(explode('::', $functionCall), $args);
-                    } else {
-                        foreach ($args as &$arg) {
-                            $arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg);
-                        }
-                        unset($arg);
-                        $result = call_user_func_array($functionCall, $args);
-                    }
-                    if ($functionName != 'MKMATRIX') {
-                        $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result));
-                    }
-                    $stack->push('Value', self::wrapResult($result));
-                }
-
-            } else {
-                // if the token is a number, boolean, string or an Excel error, push it onto the stack
-                if (isset(self::$excelConstants[strtoupper($token)])) {
-                    $excelConstant = strtoupper($token);
-//                    echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
-                    $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
-                    $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
-                } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
-//                    echo 'Token is a number, boolean, string, null or an Excel error<br />';
-                    $stack->push('Value', $token);
-                // if the token is a named range, push the named range name onto the stack
-                } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) {
-//                    echo 'Token is a named range<br />';
-                    $namedRange = $matches[6];
-//                    echo 'Named Range is '.$namedRange.'<br />';
-                    $this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
-                    $cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
-                    $pCell->attach($pCellParent);
-                    $this->_debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));
-                    $stack->push('Named Range', $cellValue, $namedRange);
-                } else {
-                    return $this->raiseFormulaError("undefined variable '$token'");
-                }
-            }
-        }
-        // when we're out of tokens, the stack should have a single element, the final result
-        if ($stack->count() != 1) {
-            return $this->raiseFormulaError("internal error");
-        }
-        $output = $stack->pop();
-        $output = $output['value'];
-
-//        if ((is_array($output)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
-//            return array_shift(PHPExcel_Calculation_Functions::flattenArray($output));
-//        }
-        return $output;
-    }
-
-
-    private function validateBinaryOperand($cellID, &$operand, &$stack)
-    {
-        if (is_array($operand)) {
-            if ((count($operand, COUNT_RECURSIVE) - count($operand)) == 1) {
-                do {
-                    $operand = array_pop($operand);
-                } while (is_array($operand));
-            }
-        }
-        //    Numbers, matrices and booleans can pass straight through, as they're already valid
-        if (is_string($operand)) {
-            //    We only need special validations for the operand if it is a string
-            //    Start by stripping off the quotation marks we use to identify true excel string values internally
-            if ($operand > '' && $operand{0} == '"') {
-                $operand = self::unwrapResult($operand);
-            }
-            //    If the string is a numeric value, we treat it as a numeric, so no further testing
-            if (!is_numeric($operand)) {
-                //    If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
-                if ($operand > '' && $operand{0} == '#') {
-                    $stack->push('Value', $operand);
-                    $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
-                    return false;
-                } elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) {
-                    //    If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
-                    $stack->push('Value', '#VALUE!');
-                    $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
-                    return false;
-                }
-            }
-        }
-
-        //    return a true if the value of the operand is one that we can use in normal binary operations
-        return true;
-    }
-
-
-    private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays = false)
-    {
-        //    If we're dealing with matrix operations, we want a matrix result
-        if ((is_array($operand1)) || (is_array($operand2))) {
-            $result = array();
-            if ((is_array($operand1)) && (!is_array($operand2))) {
-                foreach ($operand1 as $x => $operandData) {
-                    $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2));
-                    $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
-                    $r = $stack->pop();
-                    $result[$x] = $r['value'];
-                }
-            } elseif ((!is_array($operand1)) && (is_array($operand2))) {
-                foreach ($operand2 as $x => $operandData) {
-                    $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData));
-                    $this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
-                    $r = $stack->pop();
-                    $result[$x] = $r['value'];
-                }
-            } else {
-                if (!$recursingArrays) {
-                    self::checkMatrixOperands($operand1, $operand2, 2);
-                }
-                foreach ($operand1 as $x => $operandData) {
-                    $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x]));
-                    $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true);
-                    $r = $stack->pop();
-                    $result[$x] = $r['value'];
-                }
-            }
-            //    Log the result details
-            $this->_debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result));
-            //    And push the result onto the stack
-            $stack->push('Array', $result);
-            return true;
-        }
-
-        //    Simple validate the two operands if they are string values
-        if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') {
-            $operand1 = self::unwrapResult($operand1);
-        }
-        if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') {
-            $operand2 = self::unwrapResult($operand2);
-        }
-
-        // Use case insensitive comparaison if not OpenOffice mode
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-            if (is_string($operand1)) {
-                $operand1 = strtoupper($operand1);
-            }
-            if (is_string($operand2)) {
-                $operand2 = strtoupper($operand2);
-            }
-        }
-
-        $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE;
-
-        //    execute the necessary operation
-        switch ($operation) {
-            //    Greater than
-            case '>':
-                if ($useLowercaseFirstComparison) {
-                    $result = $this->strcmpLowercaseFirst($operand1, $operand2) > 0;
-                } else {
-                    $result = ($operand1 > $operand2);
-                }
-                break;
-            //    Less than
-            case '<':
-                if ($useLowercaseFirstComparison) {
-                    $result = $this->strcmpLowercaseFirst($operand1, $operand2) < 0;
-                } else {
-                    $result = ($operand1 < $operand2);
-                }
-                break;
-            //    Equality
-            case '=':
-                if (is_numeric($operand1) && is_numeric($operand2)) {
-                    $result = (abs($operand1 - $operand2) < $this->delta);
-                } else {
-                    $result = strcmp($operand1, $operand2) == 0;
-                }
-                break;
-            //    Greater than or equal
-            case '>=':
-                if (is_numeric($operand1) && is_numeric($operand2)) {
-                    $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 > $operand2));
-                } elseif ($useLowercaseFirstComparison) {
-                    $result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0;
-                } else {
-                    $result = strcmp($operand1, $operand2) >= 0;
-                }
-                break;
-            //    Less than or equal
-            case '<=':
-                if (is_numeric($operand1) && is_numeric($operand2)) {
-                    $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 < $operand2));
-                } elseif ($useLowercaseFirstComparison) {
-                    $result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0;
-                } else {
-                    $result = strcmp($operand1, $operand2) <= 0;
-                }
-                break;
-            //    Inequality
-            case '<>':
-                if (is_numeric($operand1) && is_numeric($operand2)) {
-                    $result = (abs($operand1 - $operand2) > 1E-14);
-                } else {
-                    $result = strcmp($operand1, $operand2) != 0;
-                }
-                break;
-        }
-
-        //    Log the result details
-        $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-        //    And push the result onto the stack
-        $stack->push('Value', $result);
-        return true;
-    }
-
-    /**
-     * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters
-     * @param    string    $str1    First string value for the comparison
-     * @param    string    $str2    Second string value for the comparison
-     * @return   integer
-     */
-    private function strcmpLowercaseFirst($str1, $str2)
-    {
-        $inversedStr1 = PHPExcel_Shared_String::StrCaseReverse($str1);
-        $inversedStr2 = PHPExcel_Shared_String::StrCaseReverse($str2);
-
-        return strcmp($inversedStr1, $inversedStr2);
-    }
-
-    private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack)
-    {
-        //    Validate the two operands
-        if (!$this->validateBinaryOperand($cellID, $operand1, $stack)) {
-            return false;
-        }
-        if (!$this->validateBinaryOperand($cellID, $operand2, $stack)) {
-            return false;
-        }
-
-        //    If either of the operands is a matrix, we need to treat them both as matrices
-        //        (converting the other operand to a matrix if need be); then perform the required
-        //        matrix operation
-        if ((is_array($operand1)) || (is_array($operand2))) {
-            //    Ensure that both operands are arrays/matrices of the same size
-            self::checkMatrixOperands($operand1, $operand2, 2);
-
-            try {
-                //    Convert operand 1 from a PHP array to a matrix
-                $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
-                //    Perform the required operation against the operand 1 matrix, passing in operand 2
-                $matrixResult = $matrix->$matrixFunction($operand2);
-                $result = $matrixResult->getArray();
-            } catch (PHPExcel_Exception $ex) {
-                $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
-                $result = '#VALUE!';
-            }
-        } else {
-            if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
-                ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
-                 (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
-                $result = PHPExcel_Calculation_Functions::VALUE();
-            } else {
-                //    If we're dealing with non-matrix operations, execute the necessary operation
-                switch ($operation) {
-                    //    Addition
-                    case '+':
-                        $result = $operand1 + $operand2;
-                        break;
-                    //    Subtraction
-                    case '-':
-                        $result = $operand1 - $operand2;
-                        break;
-                    //    Multiplication
-                    case '*':
-                        $result = $operand1 * $operand2;
-                        break;
-                    //    Division
-                    case '/':
-                        if ($operand2 == 0) {
-                            //    Trap for Divide by Zero error
-                            $stack->push('Value', '#DIV/0!');
-                            $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!'));
-                            return false;
-                        } else {
-                            $result = $operand1 / $operand2;
-                        }
-                        break;
-                    //    Power
-                    case '^':
-                        $result = pow($operand1, $operand2);
-                        break;
-                }
-            }
-        }
-
-        //    Log the result details
-        $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-        //    And push the result onto the stack
-        $stack->push('Value', $result);
-        return true;
-    }
-
-
-    // trigger an error, but nicely, if need be
-    protected function raiseFormulaError($errorMessage)
-    {
-        $this->formulaError = $errorMessage;
-        $this->cyclicReferenceStack->clear();
-        if (!$this->suppressFormulaErrors) {
-            throw new PHPExcel_Calculation_Exception($errorMessage);
-        }
-        trigger_error($errorMessage, E_USER_ERROR);
-    }
-
-
-    /**
-     * Extract range values
-     *
-     * @param    string                &$pRange    String based range representation
-     * @param    PHPExcel_Worksheet    $pSheet        Worksheet
-     * @param    boolean                $resetLog    Flag indicating whether calculation log should be reset or not
-     * @return  mixed                Array of values in range if range contains more than one element. Otherwise, a single value is returned.
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true)
-    {
-        // Return value
-        $returnValue = array ();
-
-//        echo 'extractCellRange('.$pRange.')', PHP_EOL;
-        if ($pSheet !== null) {
-            $pSheetName = $pSheet->getTitle();
-//            echo 'Passed sheet name is '.$pSheetName.PHP_EOL;
-//            echo 'Range reference is '.$pRange.PHP_EOL;
-            if (strpos($pRange, '!') !== false) {
-//                echo '$pRange reference includes sheet reference', PHP_EOL;
-                list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
-//                echo 'New sheet name is '.$pSheetName, PHP_EOL;
-//                echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
-                $pSheet = $this->workbook->getSheetByName($pSheetName);
-            }
-
-            // Extract range
-            $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
-            $pRange = $pSheetName.'!'.$pRange;
-            if (!isset($aReferences[1])) {
-                //    Single cell in range
-                sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow);
-                $cellValue = null;
-                if ($pSheet->cellExists($aReferences[0])) {
-                    $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
-                } else {
-                    $returnValue[$currentRow][$currentCol] = null;
-                }
-            } else {
-                // Extract cell data for all cells in the range
-                foreach ($aReferences as $reference) {
-                    // Extract range
-                    sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow);
-                    $cellValue = null;
-                    if ($pSheet->cellExists($reference)) {
-                        $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
-                    } else {
-                        $returnValue[$currentRow][$currentCol] = null;
-                    }
-                }
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * Extract range values
-     *
-     * @param    string                &$pRange    String based range representation
-     * @param    PHPExcel_Worksheet    $pSheet        Worksheet
-     * @return  mixed                Array of values in range if range contains more than one element. Otherwise, a single value is returned.
-     * @param    boolean                $resetLog    Flag indicating whether calculation log should be reset or not
-     * @throws    PHPExcel_Calculation_Exception
-     */
-    public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true)
-    {
-        // Return value
-        $returnValue = array ();
-
-//        echo 'extractNamedRange('.$pRange.')<br />';
-        if ($pSheet !== null) {
-            $pSheetName = $pSheet->getTitle();
-//            echo 'Current sheet name is '.$pSheetName.'<br />';
-//            echo 'Range reference is '.$pRange.'<br />';
-            if (strpos($pRange, '!') !== false) {
-//                echo '$pRange reference includes sheet reference', PHP_EOL;
-                list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
-//                echo 'New sheet name is '.$pSheetName, PHP_EOL;
-//                echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
-                $pSheet = $this->workbook->getSheetByName($pSheetName);
-            }
-
-            // Named range?
-            $namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
-            if ($namedRange !== null) {
-                $pSheet = $namedRange->getWorksheet();
-//                echo 'Named Range '.$pRange.' (';
-                $pRange = $namedRange->getRange();
-                $splitRange = PHPExcel_Cell::splitRange($pRange);
-                //    Convert row and column references
-                if (ctype_alpha($splitRange[0][0])) {
-                    $pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
-                } elseif (ctype_digit($splitRange[0][0])) {
-                    $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
-                }
-//                echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
-
-//                if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
-//                    if (!$namedRange->getLocalOnly()) {
-//                        $pSheet = $namedRange->getWorksheet();
-//                    } else {
-//                        return $returnValue;
-//                    }
-//                }
-            } else {
-                return PHPExcel_Calculation_Functions::REF();
-            }
-
-            // Extract range
-            $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
-//            var_dump($aReferences);
-            if (!isset($aReferences[1])) {
-                //    Single cell (or single column or row) in range
-                list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
-                $cellValue = null;
-                if ($pSheet->cellExists($aReferences[0])) {
-                    $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
-                } else {
-                    $returnValue[$currentRow][$currentCol] = null;
-                }
-            } else {
-                // Extract cell data for all cells in the range
-                foreach ($aReferences as $reference) {
-                    // Extract range
-                    list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($reference);
-//                    echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
-                    $cellValue = null;
-                    if ($pSheet->cellExists($reference)) {
-                        $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
-                    } else {
-                        $returnValue[$currentRow][$currentCol] = null;
-                    }
-                }
-            }
-//                print_r($returnValue);
-//            echo '<br />';
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * Is a specific function implemented?
-     *
-     * @param    string    $pFunction    Function Name
-     * @return    boolean
-     */
-    public function isImplemented($pFunction = '')
-    {
-        $pFunction = strtoupper($pFunction);
-        if (isset(self::$PHPExcelFunctions[$pFunction])) {
-            return (self::$PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
-        } else {
-            return false;
-        }
-    }
-
-
-    /**
-     * Get a list of all implemented functions as an array of function objects
-     *
-     * @return    array of PHPExcel_Calculation_Function
-     */
-    public function listFunctions()
-    {
-        $returnValue = array();
-
-        foreach (self::$PHPExcelFunctions as $functionName => $function) {
-            if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
-                $returnValue[$functionName] = new PHPExcel_Calculation_Function(
-                    $function['category'],
-                    $functionName,
-                    $function['functionCall']
-                );
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * Get a list of all Excel function names
-     *
-     * @return    array
-     */
-    public function listAllFunctionNames()
-    {
-        return array_keys(self::$PHPExcelFunctions);
-    }
-
-    /**
-     * Get a list of implemented Excel function names
-     *
-     * @return    array
-     */
-    public function listFunctionNames()
-    {
-        $returnValue = array();
-        foreach (self::$PHPExcelFunctions as $functionName => $function) {
-            if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
-                $returnValue[] = $functionName;
-            }
-        }
-
-        return $returnValue;
-    }
-}

+ 0 - 676
libs/PHPExcel/PHPExcel/Calculation/Database.php

xqd
@@ -1,676 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_Database
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Database
-{
-    /**
-     * fieldExtract
-     *
-     * Extracts the column ID to use for the data field.
-     *
-     * @access    private
-     * @param    mixed[]        $database        The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    mixed        $field            Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @return    string|NULL
-     *
-     */
-    private static function fieldExtract($database, $field)
-    {
-        $field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field));
-        $fieldNames = array_map('strtoupper', array_shift($database));
-
-        if (is_numeric($field)) {
-            $keys = array_keys($fieldNames);
-            return $keys[$field-1];
-        }
-        $key = array_search($field, $fieldNames);
-        return ($key) ? $key : null;
-    }
-
-    /**
-     * filter
-     *
-     * Parses the selection criteria, extracts the database rows that match those criteria, and
-     * returns that subset of rows.
-     *
-     * @access    private
-     * @param    mixed[]        $database        The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    mixed[]        $criteria        The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    array of mixed
-     *
-     */
-    private static function filter($database, $criteria)
-    {
-        $fieldNames = array_shift($database);
-        $criteriaNames = array_shift($criteria);
-
-        //    Convert the criteria into a set of AND/OR conditions with [:placeholders]
-        $testConditions = $testValues = array();
-        $testConditionsCount = 0;
-        foreach ($criteriaNames as $key => $criteriaName) {
-            $testCondition = array();
-            $testConditionCount = 0;
-            foreach ($criteria as $row => $criterion) {
-                if ($criterion[$key] > '') {
-                    $testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::ifCondition($criterion[$key]);
-                    $testConditionCount++;
-                }
-            }
-            if ($testConditionCount > 1) {
-                $testConditions[] = 'OR(' . implode(',', $testCondition) . ')';
-                $testConditionsCount++;
-            } elseif ($testConditionCount == 1) {
-                $testConditions[] = $testCondition[0];
-                $testConditionsCount++;
-            }
-        }
-
-        if ($testConditionsCount > 1) {
-            $testConditionSet = 'AND(' . implode(',', $testConditions) . ')';
-        } elseif ($testConditionsCount == 1) {
-            $testConditionSet = $testConditions[0];
-        }
-
-        //    Loop through each row of the database
-        foreach ($database as $dataRow => $dataValues) {
-            //    Substitute actual values from the database row for our [:placeholders]
-            $testConditionList = $testConditionSet;
-            foreach ($criteriaNames as $key => $criteriaName) {
-                $k = array_search($criteriaName, $fieldNames);
-                if (isset($dataValues[$k])) {
-                    $dataValue = $dataValues[$k];
-                    $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
-                    $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
-                }
-            }
-            //    evaluate the criteria against the row data
-            $result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
-            //    If the row failed to meet the criteria, remove it from the database
-            if (!$result) {
-                unset($database[$dataRow]);
-            }
-        }
-
-        return $database;
-    }
-
-
-    private static function getFilteredColumn($database, $field, $criteria)
-    {
-        //    reduce the database to a set of rows that match all the criteria
-        $database = self::filter($database, $criteria);
-        //    extract an array of values for the requested column
-        $colData = array();
-        foreach ($database as $row) {
-            $colData[] = $row[$field];
-        }
-        
-        return $colData;
-    }
-
-    /**
-     * DAVERAGE
-     *
-     * Averages the values in a column of a list or database that match conditions you specify.
-     *
-     * Excel Function:
-     *        DAVERAGE(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DAVERAGE($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::AVERAGE(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DCOUNT
-     *
-     * Counts the cells that contain numbers in a column of a list or database that match conditions
-     * that you specify.
-     *
-     * Excel Function:
-     *        DCOUNT(database,[field],criteria)
-     *
-     * Excel Function:
-     *        DAVERAGE(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    integer
-     *
-     * @TODO    The field argument is optional. If field is omitted, DCOUNT counts all records in the
-     *            database that match the criteria.
-     *
-     */
-    public static function DCOUNT($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::COUNT(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DCOUNTA
-     *
-     * Counts the nonblank cells in a column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DCOUNTA(database,[field],criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    integer
-     *
-     * @TODO    The field argument is optional. If field is omitted, DCOUNTA counts all records in the
-     *            database that match the criteria.
-     *
-     */
-    public static function DCOUNTA($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        //    reduce the database to a set of rows that match all the criteria
-        $database = self::filter($database, $criteria);
-        //    extract an array of values for the requested column
-        $colData = array();
-        foreach ($database as $row) {
-            $colData[] = $row[$field];
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::COUNTA(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DGET
-     *
-     * Extracts a single value from a column of a list or database that matches conditions that you
-     * specify.
-     *
-     * Excel Function:
-     *        DGET(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    mixed
-     *
-     */
-    public static function DGET($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        $colData = self::getFilteredColumn($database, $field, $criteria);
-        if (count($colData) > 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return $colData[0];
-    }
-
-
-    /**
-     * DMAX
-     *
-     * Returns the largest number in a column of a list or database that matches conditions you that
-     * specify.
-     *
-     * Excel Function:
-     *        DMAX(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DMAX($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::MAX(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DMIN
-     *
-     * Returns the smallest number in a column of a list or database that matches conditions you that
-     * specify.
-     *
-     * Excel Function:
-     *        DMIN(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DMIN($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::MIN(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DPRODUCT
-     *
-     * Multiplies the values in a column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DPRODUCT(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DPRODUCT($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_MathTrig::PRODUCT(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DSTDEV
-     *
-     * Estimates the standard deviation of a population based on a sample by using the numbers in a
-     * column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DSTDEV(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DSTDEV($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::STDEV(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DSTDEVP
-     *
-     * Calculates the standard deviation of a population based on the entire population by using the
-     * numbers in a column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DSTDEVP(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DSTDEVP($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::STDEVP(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DSUM
-     *
-     * Adds the numbers in a column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DSUM(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DSUM($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_MathTrig::SUM(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DVAR
-     *
-     * Estimates the variance of a population based on a sample by using the numbers in a column
-     * of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DVAR(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DVAR($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::VARFunc(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-
-
-    /**
-     * DVARP
-     *
-     * Calculates the variance of a population based on the entire population by using the numbers
-     * in a column of a list or database that match conditions that you specify.
-     *
-     * Excel Function:
-     *        DVARP(database,field,criteria)
-     *
-     * @access    public
-     * @category Database Functions
-     * @param    mixed[]            $database    The range of cells that makes up the list or database.
-     *                                        A database is a list of related data in which rows of related
-     *                                        information are records, and columns of data are fields. The
-     *                                        first row of the list contains labels for each column.
-     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
-     *                                        column label enclosed between double quotation marks, such as
-     *                                        "Age" or "Yield," or a number (without quotation marks) that
-     *                                        represents the position of the column within the list: 1 for
-     *                                        the first column, 2 for the second column, and so on.
-     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
-     *                                        You can use any range for the criteria argument, as long as it
-     *                                        includes at least one column label and at least one cell below
-     *                                        the column label in which you specify a condition for the
-     *                                        column.
-     * @return    float
-     *
-     */
-    public static function DVARP($database, $field, $criteria)
-    {
-        $field = self::fieldExtract($database, $field);
-        if (is_null($field)) {
-            return null;
-        }
-
-        // Return
-        return PHPExcel_Calculation_Statistical::VARP(
-            self::getFilteredColumn($database, $field, $criteria)
-        );
-    }
-}

+ 0 - 1553
libs/PHPExcel/PHPExcel/Calculation/DateTime.php

xqd
@@ -1,1553 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_DateTime
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_DateTime
-{
-    /**
-     * Identify if a year is a leap year or not
-     *
-     * @param    integer    $year    The year to test
-     * @return    boolean            TRUE if the year is a leap year, otherwise FALSE
-     */
-    public static function isLeapYear($year)
-    {
-        return ((($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0));
-    }
-
-
-    /**
-     * Return the number of days between two dates based on a 360 day calendar
-     *
-     * @param    integer    $startDay        Day of month of the start date
-     * @param    integer    $startMonth        Month of the start date
-     * @param    integer    $startYear        Year of the start date
-     * @param    integer    $endDay            Day of month of the start date
-     * @param    integer    $endMonth        Month of the start date
-     * @param    integer    $endYear        Year of the start date
-     * @param    boolean $methodUS        Whether to use the US method or the European method of calculation
-     * @return    integer    Number of days between the start date and the end date
-     */
-    private static function dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS)
-    {
-        if ($startDay == 31) {
-            --$startDay;
-        } elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || ($startDay == 28 && !self::isLeapYear($startYear))))) {
-            $startDay = 30;
-        }
-        if ($endDay == 31) {
-            if ($methodUS && $startDay != 30) {
-                $endDay = 1;
-                if ($endMonth == 12) {
-                    ++$endYear;
-                    $endMonth = 1;
-                } else {
-                    ++$endMonth;
-                }
-            } else {
-                $endDay = 30;
-            }
-        }
-
-        return $endDay + $endMonth * 30 + $endYear * 360 - $startDay - $startMonth * 30 - $startYear * 360;
-    }
-
-
-    /**
-     * getDateValue
-     *
-     * @param    string    $dateValue
-     * @return    mixed    Excel date/time serial value, or string if error
-     */
-    public static function getDateValue($dateValue)
-    {
-        if (!is_numeric($dateValue)) {
-            if ((is_string($dateValue)) &&
-                (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
-                $dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
-            } else {
-                $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
-                PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
-                $dateValue = self::DATEVALUE($dateValue);
-                PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType);
-            }
-        }
-        return $dateValue;
-    }
-
-
-    /**
-     * getTimeValue
-     *
-     * @param    string    $timeValue
-     * @return    mixed    Excel date/time serial value, or string if error
-     */
-    private static function getTimeValue($timeValue)
-    {
-        $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
-        PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
-        $timeValue = self::TIMEVALUE($timeValue);
-        PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType);
-        return $timeValue;
-    }
-
-
-    private static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
-    {
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-        $oMonth = (int) $PHPDateObject->format('m');
-        $oYear = (int) $PHPDateObject->format('Y');
-
-        $adjustmentMonthsString = (string) $adjustmentMonths;
-        if ($adjustmentMonths > 0) {
-            $adjustmentMonthsString = '+'.$adjustmentMonths;
-        }
-        if ($adjustmentMonths != 0) {
-            $PHPDateObject->modify($adjustmentMonthsString.' months');
-        }
-        $nMonth = (int) $PHPDateObject->format('m');
-        $nYear = (int) $PHPDateObject->format('Y');
-
-        $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12);
-        if ($monthDiff != $adjustmentMonths) {
-            $adjustDays = (int) $PHPDateObject->format('d');
-            $adjustDaysString = '-'.$adjustDays.' days';
-            $PHPDateObject->modify($adjustDaysString);
-        }
-        return $PHPDateObject;
-    }
-
-
-    /**
-     * DATETIMENOW
-     *
-     * Returns the current date and time.
-     * The NOW function is useful when you need to display the current date and time on a worksheet or
-     * calculate a value based on the current date and time, and have that value updated each time you
-     * open the worksheet.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
-     * and time format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        NOW()
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function DATETIMENOW()
-    {
-        $saveTimeZone = date_default_timezone_get();
-        date_default_timezone_set('UTC');
-        $retValue = false;
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                $retValue = (float) PHPExcel_Shared_Date::PHPToExcel(time());
-                break;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                $retValue = (integer) time();
-                break;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                $retValue = new DateTime();
-                break;
-        }
-        date_default_timezone_set($saveTimeZone);
-
-        return $retValue;
-    }
-
-
-    /**
-     * DATENOW
-     *
-     * Returns the current date.
-     * The NOW function is useful when you need to display the current date and time on a worksheet or
-     * calculate a value based on the current date and time, and have that value updated each time you
-     * open the worksheet.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
-     * and time format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        TODAY()
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function DATENOW()
-    {
-        $saveTimeZone = date_default_timezone_get();
-        date_default_timezone_set('UTC');
-        $retValue = false;
-        $excelDateTime = floor(PHPExcel_Shared_Date::PHPToExcel(time()));
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                $retValue = (float) $excelDateTime;
-                break;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                $retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime);
-                break;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                $retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime);
-                break;
-        }
-        date_default_timezone_set($saveTimeZone);
-
-        return $retValue;
-    }
-
-
-    /**
-     * DATE
-     *
-     * The DATE function returns a value that represents a particular date.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
-     * format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        DATE(year,month,day)
-     *
-     * PHPExcel is a lot more forgiving than MS Excel when passing non numeric values to this function.
-     * A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
-     *     as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    integer        $year    The value of the year argument can include one to four digits.
-     *                                Excel interprets the year argument according to the configured
-     *                                date system: 1900 or 1904.
-     *                                If year is between 0 (zero) and 1899 (inclusive), Excel adds that
-     *                                value to 1900 to calculate the year. For example, DATE(108,1,2)
-     *                                returns January 2, 2008 (1900+108).
-     *                                If year is between 1900 and 9999 (inclusive), Excel uses that
-     *                                value as the year. For example, DATE(2008,1,2) returns January 2,
-     *                                2008.
-     *                                If year is less than 0 or is 10000 or greater, Excel returns the
-     *                                #NUM! error value.
-     * @param    integer        $month    A positive or negative integer representing the month of the year
-     *                                from 1 to 12 (January to December).
-     *                                If month is greater than 12, month adds that number of months to
-     *                                the first month in the year specified. For example, DATE(2008,14,2)
-     *                                returns the serial number representing February 2, 2009.
-     *                                If month is less than 1, month subtracts the magnitude of that
-     *                                number of months, plus 1, from the first month in the year
-     *                                specified. For example, DATE(2008,-3,2) returns the serial number
-     *                                representing September 2, 2007.
-     * @param    integer        $day    A positive or negative integer representing the day of the month
-     *                                from 1 to 31.
-     *                                If day is greater than the number of days in the month specified,
-     *                                day adds that number of days to the first day in the month. For
-     *                                example, DATE(2008,1,35) returns the serial number representing
-     *                                February 4, 2008.
-     *                                If day is less than 1, day subtracts the magnitude that number of
-     *                                days, plus one, from the first day of the month specified. For
-     *                                example, DATE(2008,1,-15) returns the serial number representing
-     *                                December 16, 2007.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function DATE($year = 0, $month = 1, $day = 1)
-    {
-        $year  = PHPExcel_Calculation_Functions::flattenSingleValue($year);
-        $month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
-        $day   = PHPExcel_Calculation_Functions::flattenSingleValue($day);
-
-        if (($month !== null) && (!is_numeric($month))) {
-            $month = PHPExcel_Shared_Date::monthStringToNumber($month);
-        }
-
-        if (($day !== null) && (!is_numeric($day))) {
-            $day = PHPExcel_Shared_Date::dayStringToNumber($day);
-        }
-
-        $year = ($year !== null) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
-        $month = ($month !== null) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
-        $day = ($day !== null) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
-        if ((!is_numeric($year)) ||
-            (!is_numeric($month)) ||
-            (!is_numeric($day))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $year    = (integer) $year;
-        $month    = (integer) $month;
-        $day    = (integer) $day;
-
-        $baseYear = PHPExcel_Shared_Date::getExcelCalendar();
-        // Validate parameters
-        if ($year < ($baseYear-1900)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        if (($year < $baseYear) && ($year >= ($baseYear-1900))) {
-            $year += 1900;
-        }
-
-        if ($month < 1) {
-            //    Handle year/month adjustment if month < 1
-            --$month;
-            $year += ceil($month / 12) - 1;
-            $month = 13 - abs($month % 12);
-        } elseif ($month > 12) {
-            //    Handle year/month adjustment if month > 12
-            $year += floor($month / 12);
-            $month = ($month % 12);
-        }
-
-        // Re-validate the year parameter after adjustments
-        if (($year < $baseYear) || ($year >= 10000)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day);
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                return (float) $excelDateValue;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue);
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                return PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue);
-        }
-    }
-
-
-    /**
-     * TIME
-     *
-     * The TIME function returns a value that represents a particular time.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
-     * format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        TIME(hour,minute,second)
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    integer        $hour        A number from 0 (zero) to 32767 representing the hour.
-     *                                    Any value greater than 23 will be divided by 24 and the remainder
-     *                                    will be treated as the hour value. For example, TIME(27,0,0) =
-     *                                    TIME(3,0,0) = .125 or 3:00 AM.
-     * @param    integer        $minute        A number from 0 to 32767 representing the minute.
-     *                                    Any value greater than 59 will be converted to hours and minutes.
-     *                                    For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.
-     * @param    integer        $second        A number from 0 to 32767 representing the second.
-     *                                    Any value greater than 59 will be converted to hours, minutes,
-     *                                    and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148
-     *                                    or 12:33:20 AM
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function TIME($hour = 0, $minute = 0, $second = 0)
-    {
-        $hour = PHPExcel_Calculation_Functions::flattenSingleValue($hour);
-        $minute = PHPExcel_Calculation_Functions::flattenSingleValue($minute);
-        $second = PHPExcel_Calculation_Functions::flattenSingleValue($second);
-
-        if ($hour == '') {
-            $hour = 0;
-        }
-        if ($minute == '') {
-            $minute = 0;
-        }
-        if ($second == '') {
-            $second = 0;
-        }
-
-        if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $hour = (integer) $hour;
-        $minute = (integer) $minute;
-        $second = (integer) $second;
-
-        if ($second < 0) {
-            $minute += floor($second / 60);
-            $second = 60 - abs($second % 60);
-            if ($second == 60) {
-                $second = 0;
-            }
-        } elseif ($second >= 60) {
-            $minute += floor($second / 60);
-            $second = $second % 60;
-        }
-        if ($minute < 0) {
-            $hour += floor($minute / 60);
-            $minute = 60 - abs($minute % 60);
-            if ($minute == 60) {
-                $minute = 0;
-            }
-        } elseif ($minute >= 60) {
-            $hour += floor($minute / 60);
-            $minute = $minute % 60;
-        }
-
-        if ($hour > 23) {
-            $hour = $hour % 24;
-        } elseif ($hour < 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                $date = 0;
-                $calendar = PHPExcel_Shared_Date::getExcelCalendar();
-                if ($calendar != PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900) {
-                    $date = 1;
-                }
-                return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second));    // -2147468400; //    -2147472000 + 3600
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                $dayAdjust = 0;
-                if ($hour < 0) {
-                    $dayAdjust = floor($hour / 24);
-                    $hour = 24 - abs($hour % 24);
-                    if ($hour == 24) {
-                        $hour = 0;
-                    }
-                } elseif ($hour >= 24) {
-                    $dayAdjust = floor($hour / 24);
-                    $hour = $hour % 24;
-                }
-                $phpDateObject = new DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second);
-                if ($dayAdjust != 0) {
-                    $phpDateObject->modify($dayAdjust.' days');
-                }
-                return $phpDateObject;
-        }
-    }
-
-
-    /**
-     * DATEVALUE
-     *
-     * Returns a value that represents a particular date.
-     * Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp
-     * value.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
-     * format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        DATEVALUE(dateValue)
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    string    $dateValue        Text that represents a date in a Microsoft Excel date format.
-     *                                    For example, "1/30/2008" or "30-Jan-2008" are text strings within
-     *                                    quotation marks that represent dates. Using the default date
-     *                                    system in Excel for Windows, date_text must represent a date from
-     *                                    January 1, 1900, to December 31, 9999. Using the default date
-     *                                    system in Excel for the Macintosh, date_text must represent a date
-     *                                    from January 1, 1904, to December 31, 9999. DATEVALUE returns the
-     *                                    #VALUE! error value if date_text is out of this range.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function DATEVALUE($dateValue = 1)
-    {
-        $dateValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($dateValue), '"');
-        //    Strip any ordinals because they're allowed in Excel (English only)
-        $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
-        //    Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
-        $dateValue    = str_replace(array('/', '.', '-', '  '), array(' ', ' ', ' ', ' '), $dateValue);
-
-        $yearFound = false;
-        $t1 = explode(' ', $dateValue);
-        foreach ($t1 as &$t) {
-            if ((is_numeric($t)) && ($t > 31)) {
-                if ($yearFound) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                } else {
-                    if ($t < 100) {
-                        $t += 1900;
-                    }
-                    $yearFound = true;
-                }
-            }
-        }
-        if ((count($t1) == 1) && (strpos($t, ':') != false)) {
-            //    We've been fed a time value without any date
-            return 0.0;
-        } elseif (count($t1) == 2) {
-            //    We only have two parts of the date: either day/month or month/year
-            if ($yearFound) {
-                array_unshift($t1, 1);
-            } else {
-                array_push($t1, date('Y'));
-            }
-        }
-        unset($t);
-        $dateValue = implode(' ', $t1);
-
-        $PHPDateArray = date_parse($dateValue);
-        if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
-            $testVal1 = strtok($dateValue, '- ');
-            if ($testVal1 !== false) {
-                $testVal2 = strtok('- ');
-                if ($testVal2 !== false) {
-                    $testVal3 = strtok('- ');
-                    if ($testVal3 === false) {
-                        $testVal3 = strftime('%Y');
-                    }
-                } else {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3);
-            if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
-                $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3);
-                if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            }
-        }
-
-        if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
-            // Execute function
-            if ($PHPDateArray['year'] == '') {
-                $PHPDateArray['year'] = strftime('%Y');
-            }
-            if ($PHPDateArray['year'] < 1900) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            if ($PHPDateArray['month'] == '') {
-                $PHPDateArray['month'] = strftime('%m');
-            }
-            if ($PHPDateArray['day'] == '') {
-                $PHPDateArray['day'] = strftime('%d');
-            }
-            $excelDateValue = floor(
-                PHPExcel_Shared_Date::FormattedPHPToExcel(
-                    $PHPDateArray['year'],
-                    $PHPDateArray['month'],
-                    $PHPDateArray['day'],
-                    $PHPDateArray['hour'],
-                    $PHPDateArray['minute'],
-                    $PHPDateArray['second']
-                )
-            );
-
-            switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-                case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                    return (float) $excelDateValue;
-                case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                    return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue);
-                case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                    return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00');
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * TIMEVALUE
-     *
-     * Returns a value that represents a particular time.
-     * Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp
-     * value.
-     *
-     * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
-     * format of your regional settings. PHPExcel does not change cell formatting in this way.
-     *
-     * Excel Function:
-     *        TIMEVALUE(timeValue)
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    string    $timeValue        A text string that represents a time in any one of the Microsoft
-     *                                    Excel time formats; for example, "6:45 PM" and "18:45" text strings
-     *                                    within quotation marks that represent time.
-     *                                    Date information in time_text is ignored.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function TIMEVALUE($timeValue)
-    {
-        $timeValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($timeValue), '"');
-        $timeValue = str_replace(array('/', '.'), array('-', '-'), $timeValue);
-
-        $PHPDateArray = date_parse($timeValue);
-        if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(
-                    $PHPDateArray['year'],
-                    $PHPDateArray['month'],
-                    $PHPDateArray['day'],
-                    $PHPDateArray['hour'],
-                    $PHPDateArray['minute'],
-                    $PHPDateArray['second']
-                );
-            } else {
-                $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
-            }
-
-            switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-                case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                    return (float) $excelDateValue;
-                case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                    return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;
-                case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                    return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * DATEDIF
-     *
-     * @param    mixed    $startDate        Excel date serial value, PHP date/time stamp, PHP DateTime object
-     *                                    or a standard date string
-     * @param    mixed    $endDate        Excel date serial value, PHP date/time stamp, PHP DateTime object
-     *                                    or a standard date string
-     * @param    string    $unit
-     * @return    integer    Interval between the dates
-     */
-    public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
-    {
-        $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
-        $endDate   = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
-        $unit      = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($unit));
-
-        if (is_string($startDate = self::getDateValue($startDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($endDate = self::getDateValue($endDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Validate parameters
-        if ($startDate >= $endDate) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $difference = $endDate - $startDate;
-
-        $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
-        $startDays = $PHPStartDateObject->format('j');
-        $startMonths = $PHPStartDateObject->format('n');
-        $startYears = $PHPStartDateObject->format('Y');
-
-        $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
-        $endDays = $PHPEndDateObject->format('j');
-        $endMonths = $PHPEndDateObject->format('n');
-        $endYears = $PHPEndDateObject->format('Y');
-
-        $retVal = PHPExcel_Calculation_Functions::NaN();
-        switch ($unit) {
-            case 'D':
-                $retVal = intval($difference);
-                break;
-            case 'M':
-                $retVal = intval($endMonths - $startMonths) + (intval($endYears - $startYears) * 12);
-                //    We're only interested in full months
-                if ($endDays < $startDays) {
-                    --$retVal;
-                }
-                break;
-            case 'Y':
-                $retVal = intval($endYears - $startYears);
-                //    We're only interested in full months
-                if ($endMonths < $startMonths) {
-                    --$retVal;
-                } elseif (($endMonths == $startMonths) && ($endDays < $startDays)) {
-                    --$retVal;
-                }
-                break;
-            case 'MD':
-                if ($endDays < $startDays) {
-                    $retVal = $endDays;
-                    $PHPEndDateObject->modify('-'.$endDays.' days');
-                    $adjustDays = $PHPEndDateObject->format('j');
-                    if ($adjustDays > $startDays) {
-                        $retVal += ($adjustDays - $startDays);
-                    }
-                } else {
-                    $retVal = $endDays - $startDays;
-                }
-                break;
-            case 'YM':
-                $retVal = intval($endMonths - $startMonths);
-                if ($retVal < 0) {
-                    $retVal += 12;
-                }
-                //    We're only interested in full months
-                if ($endDays < $startDays) {
-                    --$retVal;
-                }
-                break;
-            case 'YD':
-                $retVal = intval($difference);
-                if ($endYears > $startYears) {
-                    while ($endYears > $startYears) {
-                        $PHPEndDateObject->modify('-1 year');
-                        $endYears = $PHPEndDateObject->format('Y');
-                    }
-                    $retVal = $PHPEndDateObject->format('z') - $PHPStartDateObject->format('z');
-                    if ($retVal < 0) {
-                        $retVal += 365;
-                    }
-                }
-                break;
-            default:
-                $retVal = PHPExcel_Calculation_Functions::NaN();
-        }
-        return $retVal;
-    }
-
-
-    /**
-     * DAYS360
-     *
-     * Returns the number of days between two dates based on a 360-day year (twelve 30-day months),
-     * which is used in some accounting calculations. Use this function to help compute payments if
-     * your accounting system is based on twelve 30-day months.
-     *
-     * Excel Function:
-     *        DAYS360(startDate,endDate[,method])
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    mixed        $startDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                        PHP DateTime object, or a standard date string
-     * @param    mixed        $endDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                        PHP DateTime object, or a standard date string
-     * @param    boolean        $method            US or European Method
-     *                                        FALSE or omitted: U.S. (NASD) method. If the starting date is
-     *                                        the last day of a month, it becomes equal to the 30th of the
-     *                                        same month. If the ending date is the last day of a month and
-     *                                        the starting date is earlier than the 30th of a month, the
-     *                                        ending date becomes equal to the 1st of the next month;
-     *                                        otherwise the ending date becomes equal to the 30th of the
-     *                                        same month.
-     *                                        TRUE: European method. Starting dates and ending dates that
-     *                                        occur on the 31st of a month become equal to the 30th of the
-     *                                        same month.
-     * @return    integer        Number of days between start date and end date
-     */
-    public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
-    {
-        $startDate    = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
-        $endDate    = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
-
-        if (is_string($startDate = self::getDateValue($startDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($endDate = self::getDateValue($endDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (!is_bool($method)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Execute function
-        $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
-        $startDay = $PHPStartDateObject->format('j');
-        $startMonth = $PHPStartDateObject->format('n');
-        $startYear = $PHPStartDateObject->format('Y');
-
-        $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
-        $endDay = $PHPEndDateObject->format('j');
-        $endMonth = $PHPEndDateObject->format('n');
-        $endYear = $PHPEndDateObject->format('Y');
-
-        return self::dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method);
-    }
-
-
-    /**
-     * YEARFRAC
-     *
-     * Calculates the fraction of the year represented by the number of whole days between two dates
-     * (the start_date and the end_date).
-     * Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or
-     * obligations to assign to a specific term.
-     *
-     * Excel Function:
-     *        YEARFRAC(startDate,endDate[,method])
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    mixed    $startDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @param    mixed    $endDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @param    integer    $method            Method used for the calculation
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float    fraction of the year
-     */
-    public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
-    {
-        $startDate    = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
-        $endDate    = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
-        $method        = PHPExcel_Calculation_Functions::flattenSingleValue($method);
-
-        if (is_string($startDate = self::getDateValue($startDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($endDate = self::getDateValue($endDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
-            switch ($method) {
-                case 0:
-                    return self::DAYS360($startDate, $endDate) / 360;
-                case 1:
-                    $days = self::DATEDIF($startDate, $endDate);
-                    $startYear = self::YEAR($startDate);
-                    $endYear = self::YEAR($endDate);
-                    $years = $endYear - $startYear + 1;
-                    $leapDays = 0;
-                    if ($years == 1) {
-                        if (self::isLeapYear($endYear)) {
-                            $startMonth = self::MONTHOFYEAR($startDate);
-                            $endMonth = self::MONTHOFYEAR($endDate);
-                            $endDay = self::DAYOFMONTH($endDate);
-                            if (($startMonth < 3) ||
-                                (($endMonth * 100 + $endDay) >= (2 * 100 + 29))) {
-                                 $leapDays += 1;
-                            }
-                        }
-                    } else {
-                        for ($year = $startYear; $year <= $endYear; ++$year) {
-                            if ($year == $startYear) {
-                                $startMonth = self::MONTHOFYEAR($startDate);
-                                $startDay = self::DAYOFMONTH($startDate);
-                                if ($startMonth < 3) {
-                                    $leapDays += (self::isLeapYear($year)) ? 1 : 0;
-                                }
-                            } elseif ($year == $endYear) {
-                                $endMonth = self::MONTHOFYEAR($endDate);
-                                $endDay = self::DAYOFMONTH($endDate);
-                                if (($endMonth * 100 + $endDay) >= (2 * 100 + 29)) {
-                                    $leapDays += (self::isLeapYear($year)) ? 1 : 0;
-                                }
-                            } else {
-                                $leapDays += (self::isLeapYear($year)) ? 1 : 0;
-                            }
-                        }
-                        if ($years == 2) {
-                            if (($leapDays == 0) && (self::isLeapYear($startYear)) && ($days > 365)) {
-                                $leapDays = 1;
-                            } elseif ($days < 366) {
-                                $years = 1;
-                            }
-                        }
-                        $leapDays /= $years;
-                    }
-                    return $days / (365 + $leapDays);
-                case 2:
-                    return self::DATEDIF($startDate, $endDate) / 360;
-                case 3:
-                    return self::DATEDIF($startDate, $endDate) / 365;
-                case 4:
-                    return self::DAYS360($startDate, $endDate, true) / 360;
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * NETWORKDAYS
-     *
-     * Returns the number of whole working days between start_date and end_date. Working days
-     * exclude weekends and any dates identified in holidays.
-     * Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days
-     * worked during a specific term.
-     *
-     * Excel Function:
-     *        NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    mixed            $startDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                            PHP DateTime object, or a standard date string
-     * @param    mixed            $endDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                            PHP DateTime object, or a standard date string
-     * @param    mixed            $holidays,...    Optional series of Excel date serial value (float), PHP date
-     *                                            timestamp (integer), PHP DateTime object, or a standard date
-     *                                            strings that will be excluded from the working calendar, such
-     *                                            as state and federal holidays and floating holidays.
-     * @return    integer            Interval between the dates
-     */
-    public static function NETWORKDAYS($startDate, $endDate)
-    {
-        //    Retrieve the mandatory start and end date that are referenced in the function definition
-        $startDate    = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
-        $endDate    = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
-        //    Flush the mandatory start and end date that are referenced in the function definition, and get the optional days
-        $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        array_shift($dateArgs);
-        array_shift($dateArgs);
-
-        //    Validate the start and end dates
-        if (is_string($startDate = $sDate = self::getDateValue($startDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $startDate = (float) floor($startDate);
-        if (is_string($endDate = $eDate = self::getDateValue($endDate))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $endDate = (float) floor($endDate);
-
-        if ($sDate > $eDate) {
-            $startDate = $eDate;
-            $endDate = $sDate;
-        }
-
-        // Execute function
-        $startDoW = 6 - self::DAYOFWEEK($startDate, 2);
-        if ($startDoW < 0) {
-            $startDoW = 0;
-        }
-        $endDoW = self::DAYOFWEEK($endDate, 2);
-        if ($endDoW >= 6) {
-            $endDoW = 0;
-        }
-
-        $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5;
-        $partWeekDays = $endDoW + $startDoW;
-        if ($partWeekDays > 5) {
-            $partWeekDays -= 5;
-        }
-
-        //    Test any extra holiday parameters
-        $holidayCountedArray = array();
-        foreach ($dateArgs as $holidayDate) {
-            if (is_string($holidayDate = self::getDateValue($holidayDate))) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
-                if ((self::DAYOFWEEK($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
-                    --$partWeekDays;
-                    $holidayCountedArray[] = $holidayDate;
-                }
-            }
-        }
-
-        if ($sDate > $eDate) {
-            return 0 - ($wholeWeekDays + $partWeekDays);
-        }
-        return $wholeWeekDays + $partWeekDays;
-    }
-
-
-    /**
-     * WORKDAY
-     *
-     * Returns the date that is the indicated number of working days before or after a date (the
-     * starting date). Working days exclude weekends and any dates identified as holidays.
-     * Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected
-     * delivery times, or the number of days of work performed.
-     *
-     * Excel Function:
-     *        WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])
-     *
-     * @access    public
-     * @category Date/Time Functions
-     * @param    mixed        $startDate        Excel date serial value (float), PHP date timestamp (integer),
-     *                                        PHP DateTime object, or a standard date string
-     * @param    integer        $endDays        The number of nonweekend and nonholiday days before or after
-     *                                        startDate. A positive value for days yields a future date; a
-     *                                        negative value yields a past date.
-     * @param    mixed        $holidays,...    Optional series of Excel date serial value (float), PHP date
-     *                                        timestamp (integer), PHP DateTime object, or a standard date
-     *                                        strings that will be excluded from the working calendar, such
-     *                                        as state and federal holidays and floating holidays.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function WORKDAY($startDate, $endDays)
-    {
-        //    Retrieve the mandatory start date and days that are referenced in the function definition
-        $startDate    = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
-        $endDays    = PHPExcel_Calculation_Functions::flattenSingleValue($endDays);
-        //    Flush the mandatory start date and days that are referenced in the function definition, and get the optional days
-        $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        array_shift($dateArgs);
-        array_shift($dateArgs);
-
-        if ((is_string($startDate = self::getDateValue($startDate))) || (!is_numeric($endDays))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $startDate = (float) floor($startDate);
-        $endDays = (int) floor($endDays);
-        //    If endDays is 0, we always return startDate
-        if ($endDays == 0) {
-            return $startDate;
-        }
-
-        $decrementing = ($endDays < 0) ? true : false;
-
-        //    Adjust the start date if it falls over a weekend
-
-        $startDoW = self::DAYOFWEEK($startDate, 3);
-        if (self::DAYOFWEEK($startDate, 3) >= 5) {
-            $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW;
-            ($decrementing) ? $endDays++ : $endDays--;
-        }
-
-        //    Add endDays
-        $endDate = (float) $startDate + (intval($endDays / 5) * 7) + ($endDays % 5);
-
-        //    Adjust the calculated end date if it falls over a weekend
-        $endDoW = self::DAYOFWEEK($endDate, 3);
-        if ($endDoW >= 5) {
-            $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
-        }
-
-        //    Test any extra holiday parameters
-        if (!empty($dateArgs)) {
-            $holidayCountedArray = $holidayDates = array();
-            foreach ($dateArgs as $holidayDate) {
-                if (($holidayDate !== null) && (trim($holidayDate) > '')) {
-                    if (is_string($holidayDate = self::getDateValue($holidayDate))) {
-                        return PHPExcel_Calculation_Functions::VALUE();
-                    }
-                    if (self::DAYOFWEEK($holidayDate, 3) < 5) {
-                        $holidayDates[] = $holidayDate;
-                    }
-                }
-            }
-            if ($decrementing) {
-                rsort($holidayDates, SORT_NUMERIC);
-            } else {
-                sort($holidayDates, SORT_NUMERIC);
-            }
-            foreach ($holidayDates as $holidayDate) {
-                if ($decrementing) {
-                    if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) {
-                        if (!in_array($holidayDate, $holidayCountedArray)) {
-                            --$endDate;
-                            $holidayCountedArray[] = $holidayDate;
-                        }
-                    }
-                } else {
-                    if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
-                        if (!in_array($holidayDate, $holidayCountedArray)) {
-                            ++$endDate;
-                            $holidayCountedArray[] = $holidayDate;
-                        }
-                    }
-                }
-                //    Adjust the calculated end date if it falls over a weekend
-                $endDoW = self::DAYOFWEEK($endDate, 3);
-                if ($endDoW >= 5) {
-                    $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW;
-                }
-            }
-        }
-
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                return (float) $endDate;
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate);
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                return PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
-        }
-    }
-
-
-    /**
-     * DAYOFMONTH
-     *
-     * Returns the day of the month, for a specified date. The day is given as an integer
-     * ranging from 1 to 31.
-     *
-     * Excel Function:
-     *        DAY(dateValue)
-     *
-     * @param    mixed    $dateValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @return    int        Day of the month
-     */
-    public static function DAYOFMONTH($dateValue = 1)
-    {
-        $dateValue    = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-
-        if ($dateValue === null) {
-            $dateValue = 1;
-        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($dateValue == 0.0) {
-            return 0;
-        } elseif ($dateValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-
-        return (int) $PHPDateObject->format('j');
-    }
-
-
-    /**
-     * DAYOFWEEK
-     *
-     * Returns the day of the week for a specified date. The day is given as an integer
-     * ranging from 0 to 7 (dependent on the requested style).
-     *
-     * Excel Function:
-     *        WEEKDAY(dateValue[,style])
-     *
-     * @param    mixed    $dateValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @param    int        $style            A number that determines the type of return value
-     *                                        1 or omitted    Numbers 1 (Sunday) through 7 (Saturday).
-     *                                        2                Numbers 1 (Monday) through 7 (Sunday).
-     *                                        3                Numbers 0 (Monday) through 6 (Sunday).
-     * @return    int        Day of the week value
-     */
-    public static function DAYOFWEEK($dateValue = 1, $style = 1)
-    {
-        $dateValue    = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-        $style        = PHPExcel_Calculation_Functions::flattenSingleValue($style);
-
-        if (!is_numeric($style)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif (($style < 1) || ($style > 3)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $style = floor($style);
-
-        if ($dateValue === null) {
-            $dateValue = 1;
-        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($dateValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-        $DoW = $PHPDateObject->format('w');
-
-        $firstDay = 1;
-        switch ($style) {
-            case 1:
-                ++$DoW;
-                break;
-            case 2:
-                if ($DoW == 0) {
-                    $DoW = 7;
-                }
-                break;
-            case 3:
-                if ($DoW == 0) {
-                    $DoW = 7;
-                }
-                $firstDay = 0;
-                --$DoW;
-                break;
-        }
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL) {
-            //    Test for Excel's 1900 leap year, and introduce the error as required
-            if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) {
-                --$DoW;
-                if ($DoW < $firstDay) {
-                    $DoW += 7;
-                }
-            }
-        }
-
-        return (int) $DoW;
-    }
-
-
-    /**
-     * WEEKOFYEAR
-     *
-     * Returns the week of the year for a specified date.
-     * The WEEKNUM function considers the week containing January 1 to be the first week of the year.
-     * However, there is a European standard that defines the first week as the one with the majority
-     * of days (four or more) falling in the new year. This means that for years in which there are
-     * three days or less in the first week of January, the WEEKNUM function returns week numbers
-     * that are incorrect according to the European standard.
-     *
-     * Excel Function:
-     *        WEEKNUM(dateValue[,style])
-     *
-     * @param    mixed    $dateValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @param    boolean    $method            Week begins on Sunday or Monday
-     *                                        1 or omitted    Week begins on Sunday.
-     *                                        2                Week begins on Monday.
-     * @return    int        Week Number
-     */
-    public static function WEEKOFYEAR($dateValue = 1, $method = 1)
-    {
-        $dateValue    = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-        $method        = PHPExcel_Calculation_Functions::flattenSingleValue($method);
-
-        if (!is_numeric($method)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif (($method < 1) || ($method > 2)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $method = floor($method);
-
-        if ($dateValue === null) {
-            $dateValue = 1;
-        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($dateValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-        $dayOfYear = $PHPDateObject->format('z');
-        $dow = $PHPDateObject->format('w');
-        $PHPDateObject->modify('-' . $dayOfYear . ' days');
-        $dow = $PHPDateObject->format('w');
-        $daysInFirstWeek = 7 - (($dow + (2 - $method)) % 7);
-        $dayOfYear -= $daysInFirstWeek;
-        $weekOfYear = ceil($dayOfYear / 7) + 1;
-
-        return (int) $weekOfYear;
-    }
-
-
-    /**
-     * MONTHOFYEAR
-     *
-     * Returns the month of a date represented by a serial number.
-     * The month is given as an integer, ranging from 1 (January) to 12 (December).
-     *
-     * Excel Function:
-     *        MONTH(dateValue)
-     *
-     * @param    mixed    $dateValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @return    int        Month of the year
-     */
-    public static function MONTHOFYEAR($dateValue = 1)
-    {
-        $dateValue    = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-
-        if ($dateValue === null) {
-            $dateValue = 1;
-        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($dateValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-
-        return (int) $PHPDateObject->format('n');
-    }
-
-
-    /**
-     * YEAR
-     *
-     * Returns the year corresponding to a date.
-     * The year is returned as an integer in the range 1900-9999.
-     *
-     * Excel Function:
-     *        YEAR(dateValue)
-     *
-     * @param    mixed    $dateValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard date string
-     * @return    int        Year
-     */
-    public static function YEAR($dateValue = 1)
-    {
-        $dateValue    = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-
-        if ($dateValue === null) {
-            $dateValue = 1;
-        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($dateValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Execute function
-        $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue);
-
-        return (int) $PHPDateObject->format('Y');
-    }
-
-
-    /**
-     * HOUROFDAY
-     *
-     * Returns the hour of a time value.
-     * The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
-     *
-     * Excel Function:
-     *        HOUR(timeValue)
-     *
-     * @param    mixed    $timeValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard time string
-     * @return    int        Hour
-     */
-    public static function HOUROFDAY($timeValue = 0)
-    {
-        $timeValue    = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
-
-        if (!is_numeric($timeValue)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                $testVal = strtok($timeValue, '/-: ');
-                if (strlen($testVal) < strlen($timeValue)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            }
-            $timeValue = self::getTimeValue($timeValue);
-            if (is_string($timeValue)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        // Execute function
-        if ($timeValue >= 1) {
-            $timeValue = fmod($timeValue, 1);
-        } elseif ($timeValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
-
-        return (int) gmdate('G', $timeValue);
-    }
-
-
-    /**
-     * MINUTEOFHOUR
-     *
-     * Returns the minutes of a time value.
-     * The minute is given as an integer, ranging from 0 to 59.
-     *
-     * Excel Function:
-     *        MINUTE(timeValue)
-     *
-     * @param    mixed    $timeValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard time string
-     * @return    int        Minute
-     */
-    public static function MINUTEOFHOUR($timeValue = 0)
-    {
-        $timeValue = $timeTester    = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
-
-        if (!is_numeric($timeValue)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                $testVal = strtok($timeValue, '/-: ');
-                if (strlen($testVal) < strlen($timeValue)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            }
-            $timeValue = self::getTimeValue($timeValue);
-            if (is_string($timeValue)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        // Execute function
-        if ($timeValue >= 1) {
-            $timeValue = fmod($timeValue, 1);
-        } elseif ($timeValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
-
-        return (int) gmdate('i', $timeValue);
-    }
-
-
-    /**
-     * SECONDOFMINUTE
-     *
-     * Returns the seconds of a time value.
-     * The second is given as an integer in the range 0 (zero) to 59.
-     *
-     * Excel Function:
-     *        SECOND(timeValue)
-     *
-     * @param    mixed    $timeValue        Excel date serial value (float), PHP date timestamp (integer),
-     *                                    PHP DateTime object, or a standard time string
-     * @return    int        Second
-     */
-    public static function SECONDOFMINUTE($timeValue = 0)
-    {
-        $timeValue    = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
-
-        if (!is_numeric($timeValue)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                $testVal = strtok($timeValue, '/-: ');
-                if (strlen($testVal) < strlen($timeValue)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            }
-            $timeValue = self::getTimeValue($timeValue);
-            if (is_string($timeValue)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        // Execute function
-        if ($timeValue >= 1) {
-            $timeValue = fmod($timeValue, 1);
-        } elseif ($timeValue < 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
-
-        return (int) gmdate('s', $timeValue);
-    }
-
-
-    /**
-     * EDATE
-     *
-     * Returns the serial number that represents the date that is the indicated number of months
-     * before or after a specified date (the start_date).
-     * Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
-     * as the date of issue.
-     *
-     * Excel Function:
-     *        EDATE(dateValue,adjustmentMonths)
-     *
-     * @param    mixed    $dateValue            Excel date serial value (float), PHP date timestamp (integer),
-     *                                        PHP DateTime object, or a standard date string
-     * @param    int        $adjustmentMonths    The number of months before or after start_date.
-     *                                        A positive value for months yields a future date;
-     *                                        a negative value yields a past date.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
-    {
-        $dateValue            = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-        $adjustmentMonths    = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
-
-        if (!is_numeric($adjustmentMonths)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $adjustmentMonths = floor($adjustmentMonths);
-
-        if (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Execute function
-        $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths);
-
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject));
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                return $PHPDateObject;
-        }
-    }
-
-
-    /**
-     * EOMONTH
-     *
-     * Returns the date value for the last day of the month that is the indicated number of months
-     * before or after start_date.
-     * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
-     *
-     * Excel Function:
-     *        EOMONTH(dateValue,adjustmentMonths)
-     *
-     * @param    mixed    $dateValue            Excel date serial value (float), PHP date timestamp (integer),
-     *                                        PHP DateTime object, or a standard date string
-     * @param    int        $adjustmentMonths    The number of months before or after start_date.
-     *                                        A positive value for months yields a future date;
-     *                                        a negative value yields a past date.
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
-    {
-        $dateValue            = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
-        $adjustmentMonths    = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
-
-        if (!is_numeric($adjustmentMonths)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $adjustmentMonths = floor($adjustmentMonths);
-
-        if (is_string($dateValue = self::getDateValue($dateValue))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Execute function
-        $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths+1);
-        $adjustDays = (int) $PHPDateObject->format('d');
-        $adjustDaysString = '-' . $adjustDays . ' days';
-        $PHPDateObject->modify($adjustDaysString);
-
-        switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
-            case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
-                return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
-                return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject));
-            case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
-                return $PHPDateObject;
-        }
-    }
-}

+ 0 - 2650
libs/PHPExcel/PHPExcel/Calculation/Engineering.php

xqd
@@ -1,2650 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/** EULER */
-define('EULER', 2.71828182845904523536);
-
-/**
- * PHPExcel_Calculation_Engineering
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Engineering
-{
-    /**
-     * Details of the Units of measure that can be used in CONVERTUOM()
-     *
-     * @var mixed[]
-     */
-    private static $conversionUnits = array(
-        'g'     => array('Group' => 'Mass',        'Unit Name' => 'Gram',                     'AllowPrefix' => true),
-        'sg'    => array('Group' => 'Mass',        'Unit Name' => 'Slug',                     'AllowPrefix' => false),
-        'lbm'   => array('Group' => 'Mass',        'Unit Name' => 'Pound mass (avoirdupois)', 'AllowPrefix' => false),
-        'u'     => array('Group' => 'Mass',        'Unit Name' => 'U (atomic mass unit)',     'AllowPrefix' => true),
-        'ozm'   => array('Group' => 'Mass',        'Unit Name' => 'Ounce mass (avoirdupois)', 'AllowPrefix' => false),
-        'm'     => array('Group' => 'Distance',    'Unit Name' => 'Meter',                    'AllowPrefix' => true),
-        'mi'    => array('Group' => 'Distance',    'Unit Name' => 'Statute mile',             'AllowPrefix' => false),
-        'Nmi'   => array('Group' => 'Distance',    'Unit Name' => 'Nautical mile',            'AllowPrefix' => false),
-        'in'    => array('Group' => 'Distance',    'Unit Name' => 'Inch',                     'AllowPrefix' => false),
-        'ft'    => array('Group' => 'Distance',    'Unit Name' => 'Foot',                     'AllowPrefix' => false),
-        'yd'    => array('Group' => 'Distance',    'Unit Name' => 'Yard',                     'AllowPrefix' => false),
-        'ang'   => array('Group' => 'Distance',    'Unit Name' => 'Angstrom',                 'AllowPrefix' => true),
-        'Pica'  => array('Group' => 'Distance',    'Unit Name' => 'Pica (1/72 in)',           'AllowPrefix' => false),
-        'yr'    => array('Group' => 'Time',        'Unit Name' => 'Year',                     'AllowPrefix' => false),
-        'day'   => array('Group' => 'Time',        'Unit Name' => 'Day',                      'AllowPrefix' => false),
-        'hr'    => array('Group' => 'Time',        'Unit Name' => 'Hour',                     'AllowPrefix' => false),
-        'mn'    => array('Group' => 'Time',        'Unit Name' => 'Minute',                   'AllowPrefix' => false),
-        'sec'   => array('Group' => 'Time',        'Unit Name' => 'Second',                   'AllowPrefix' => true),
-        'Pa'    => array('Group' => 'Pressure',    'Unit Name' => 'Pascal',                   'AllowPrefix' => true),
-        'p'     => array('Group' => 'Pressure',    'Unit Name' => 'Pascal',                   'AllowPrefix' => true),
-        'atm'   => array('Group' => 'Pressure',    'Unit Name' => 'Atmosphere',               'AllowPrefix' => true),
-        'at'    => array('Group' => 'Pressure',    'Unit Name' => 'Atmosphere',               'AllowPrefix' => true),
-        'mmHg'  => array('Group' => 'Pressure',    'Unit Name' => 'mm of Mercury',            'AllowPrefix' => true),
-        'N'     => array('Group' => 'Force',       'Unit Name' => 'Newton',                   'AllowPrefix' => true),
-        'dyn'   => array('Group' => 'Force',       'Unit Name' => 'Dyne',                     'AllowPrefix' => true),
-        'dy'    => array('Group' => 'Force',       'Unit Name' => 'Dyne',                     'AllowPrefix' => true),
-        'lbf'   => array('Group' => 'Force',       'Unit Name' => 'Pound force',              'AllowPrefix' => false),
-        'J'     => array('Group' => 'Energy',      'Unit Name' => 'Joule',                    'AllowPrefix' => true),
-        'e'     => array('Group' => 'Energy',      'Unit Name' => 'Erg',                      'AllowPrefix' => true),
-        'c'     => array('Group' => 'Energy',      'Unit Name' => 'Thermodynamic calorie',    'AllowPrefix' => true),
-        'cal'   => array('Group' => 'Energy',      'Unit Name' => 'IT calorie',               'AllowPrefix' => true),
-        'eV'    => array('Group' => 'Energy',      'Unit Name' => 'Electron volt',            'AllowPrefix' => true),
-        'ev'    => array('Group' => 'Energy',      'Unit Name' => 'Electron volt',            'AllowPrefix' => true),
-        'HPh'   => array('Group' => 'Energy',      'Unit Name' => 'Horsepower-hour',          'AllowPrefix' => false),
-        'hh'    => array('Group' => 'Energy',      'Unit Name' => 'Horsepower-hour',          'AllowPrefix' => false),
-        'Wh'    => array('Group' => 'Energy',      'Unit Name' => 'Watt-hour',                'AllowPrefix' => true),
-        'wh'    => array('Group' => 'Energy',      'Unit Name' => 'Watt-hour',                'AllowPrefix' => true),
-        'flb'   => array('Group' => 'Energy',      'Unit Name' => 'Foot-pound',               'AllowPrefix' => false),
-        'BTU'   => array('Group' => 'Energy',      'Unit Name' => 'BTU',                      'AllowPrefix' => false),
-        'btu'   => array('Group' => 'Energy',      'Unit Name' => 'BTU',                      'AllowPrefix' => false),
-        'HP'    => array('Group' => 'Power',       'Unit Name' => 'Horsepower',               'AllowPrefix' => false),
-        'h'     => array('Group' => 'Power',       'Unit Name' => 'Horsepower',               'AllowPrefix' => false),
-        'W'     => array('Group' => 'Power',       'Unit Name' => 'Watt',                     'AllowPrefix' => true),
-        'w'     => array('Group' => 'Power',       'Unit Name' => 'Watt',                     'AllowPrefix' => true),
-        'T'     => array('Group' => 'Magnetism',   'Unit Name' => 'Tesla',                    'AllowPrefix' => true),
-        'ga'    => array('Group' => 'Magnetism',   'Unit Name' => 'Gauss',                    'AllowPrefix' => true),
-        'C'     => array('Group' => 'Temperature', 'Unit Name' => 'Celsius',                  'AllowPrefix' => false),
-        'cel'   => array('Group' => 'Temperature', 'Unit Name' => 'Celsius',                  'AllowPrefix' => false),
-        'F'     => array('Group' => 'Temperature', 'Unit Name' => 'Fahrenheit',               'AllowPrefix' => false),
-        'fah'   => array('Group' => 'Temperature', 'Unit Name' => 'Fahrenheit',               'AllowPrefix' => false),
-        'K'     => array('Group' => 'Temperature', 'Unit Name' => 'Kelvin',                   'AllowPrefix' => false),
-        'kel'   => array('Group' => 'Temperature', 'Unit Name' => 'Kelvin',                   'AllowPrefix' => false),
-        'tsp'   => array('Group' => 'Liquid',      'Unit Name' => 'Teaspoon',                 'AllowPrefix' => false),
-        'tbs'   => array('Group' => 'Liquid',      'Unit Name' => 'Tablespoon',               'AllowPrefix' => false),
-        'oz'    => array('Group' => 'Liquid',      'Unit Name' => 'Fluid Ounce',              'AllowPrefix' => false),
-        'cup'   => array('Group' => 'Liquid',      'Unit Name' => 'Cup',                      'AllowPrefix' => false),
-        'pt'    => array('Group' => 'Liquid',      'Unit Name' => 'U.S. Pint',                'AllowPrefix' => false),
-        'us_pt' => array('Group' => 'Liquid',      'Unit Name' => 'U.S. Pint',                'AllowPrefix' => false),
-        'uk_pt' => array('Group' => 'Liquid',      'Unit Name' => 'U.K. Pint',                'AllowPrefix' => false),
-        'qt'    => array('Group' => 'Liquid',      'Unit Name' => 'Quart',                    'AllowPrefix' => false),
-        'gal'   => array('Group' => 'Liquid',      'Unit Name' => 'Gallon',                   'AllowPrefix' => false),
-        'l'     => array('Group' => 'Liquid',      'Unit Name' => 'Litre',                    'AllowPrefix' => true),
-        'lt'    => array('Group' => 'Liquid',      'Unit Name' => 'Litre',                    'AllowPrefix' => true),
-    );
-
-    /**
-     * Details of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM()
-     *
-     * @var mixed[]
-     */
-    private static $conversionMultipliers = array(
-        'Y' => array('multiplier' => 1E24,  'name' => 'yotta'),
-        'Z' => array('multiplier' => 1E21,  'name' => 'zetta'),
-        'E' => array('multiplier' => 1E18,  'name' => 'exa'),
-        'P' => array('multiplier' => 1E15,  'name' => 'peta'),
-        'T' => array('multiplier' => 1E12,  'name' => 'tera'),
-        'G' => array('multiplier' => 1E9,   'name' => 'giga'),
-        'M' => array('multiplier' => 1E6,   'name' => 'mega'),
-        'k' => array('multiplier' => 1E3,   'name' => 'kilo'),
-        'h' => array('multiplier' => 1E2,   'name' => 'hecto'),
-        'e' => array('multiplier' => 1E1,   'name' => 'deka'),
-        'd' => array('multiplier' => 1E-1,  'name' => 'deci'),
-        'c' => array('multiplier' => 1E-2,  'name' => 'centi'),
-        'm' => array('multiplier' => 1E-3,  'name' => 'milli'),
-        'u' => array('multiplier' => 1E-6,  'name' => 'micro'),
-        'n' => array('multiplier' => 1E-9,  'name' => 'nano'),
-        'p' => array('multiplier' => 1E-12, 'name' => 'pico'),
-        'f' => array('multiplier' => 1E-15, 'name' => 'femto'),
-        'a' => array('multiplier' => 1E-18, 'name' => 'atto'),
-        'z' => array('multiplier' => 1E-21, 'name' => 'zepto'),
-        'y' => array('multiplier' => 1E-24, 'name' => 'yocto'),
-    );
-
-    /**
-     * Details of the Units of measure conversion factors, organised by group
-     *
-     * @var mixed[]
-     */
-    private static $unitConversions = array(
-        'Mass' => array(
-            'g' => array(
-                'g'   => 1.0,
-                'sg'  => 6.85220500053478E-05,
-                'lbm' => 2.20462291469134E-03,
-                'u'   => 6.02217000000000E+23,
-                'ozm' => 3.52739718003627E-02,
-            ),
-            'sg' => array(
-                'g'   => 1.45938424189287E+04,
-                'sg'  => 1.0,
-                'lbm' => 3.21739194101647E+01,
-                'u'   => 8.78866000000000E+27,
-                'ozm' => 5.14782785944229E+02,
-            ),
-            'lbm' => array(
-                'g'   => 4.5359230974881148E+02,
-                'sg'  => 3.10810749306493E-02,
-                'lbm' => 1.0,
-                'u'   => 2.73161000000000E+26,
-                'ozm' => 1.60000023429410E+01,
-            ),
-            'u' => array(
-                'g'   => 1.66053100460465E-24,
-                'sg'  => 1.13782988532950E-28,
-                'lbm' => 3.66084470330684E-27,
-                'u'   => 1.0,
-                'ozm' => 5.85735238300524E-26,
-            ),
-            'ozm' => array(
-                'g'   => 2.83495152079732E+01,
-                'sg'  => 1.94256689870811E-03,
-                'lbm' => 6.24999908478882E-02,
-                'u'   => 1.70725600000000E+25,
-                'ozm' => 1.0,
-            ),
-        ),
-        'Distance' => array(
-            'm' => array(
-                'm'    => 1.0,
-                'mi'   => 6.21371192237334E-04,
-                'Nmi'  => 5.39956803455724E-04,
-                'in'   => 3.93700787401575E+01,
-                'ft'   => 3.28083989501312E+00,
-                'yd'   => 1.09361329797891E+00,
-                'ang'  => 1.00000000000000E+10,
-                'Pica' => 2.83464566929116E+03,
-            ),
-            'mi' => array(
-                'm'    => 1.60934400000000E+03,
-                'mi'   => 1.0,
-                'Nmi'  => 8.68976241900648E-01,
-                'in'   => 6.33600000000000E+04,
-                'ft'   => 5.28000000000000E+03,
-                'yd'   => 1.76000000000000E+03,
-                'ang'  => 1.60934400000000E+13,
-                'Pica' => 4.56191999999971E+06,
-            ),
-            'Nmi' => array(
-                'm'    => 1.85200000000000E+03,
-                'mi'   => 1.15077944802354E+00,
-                'Nmi'  => 1.0,
-                'in'   => 7.29133858267717E+04,
-                'ft'   => 6.07611548556430E+03,
-                'yd'   => 2.02537182785694E+03,
-                'ang'  => 1.85200000000000E+13,
-                'Pica' => 5.24976377952723E+06,
-            ),
-            'in' => array(
-                'm'    => 2.54000000000000E-02,
-                'mi'   => 1.57828282828283E-05,
-                'Nmi'  => 1.37149028077754E-05,
-                'in'   => 1.0,
-                'ft'   => 8.33333333333333E-02,
-                'yd'   => 2.77777777686643E-02,
-                'ang'  => 2.54000000000000E+08,
-                'Pica' => 7.19999999999955E+01,
-            ),
-            'ft' => array(
-                'm'    => 3.04800000000000E-01,
-                'mi'   => 1.89393939393939E-04,
-                'Nmi'  => 1.64578833693305E-04,
-                'in'   => 1.20000000000000E+01,
-                'ft'   => 1.0,
-                'yd'   => 3.33333333223972E-01,
-                'ang'  => 3.04800000000000E+09,
-                'Pica' => 8.63999999999946E+02,
-            ),
-            'yd' => array(
-                'm'    => 9.14400000300000E-01,
-                'mi'   => 5.68181818368230E-04,
-                'Nmi'  => 4.93736501241901E-04,
-                'in'   => 3.60000000118110E+01,
-                'ft'   => 3.00000000000000E+00,
-                'yd'   => 1.0,
-                'ang'  => 9.14400000300000E+09,
-                'Pica' => 2.59200000085023E+03,
-            ),
-            'ang' => array(
-                'm'    => 1.00000000000000E-10,
-                'mi'   => 6.21371192237334E-14,
-                'Nmi'  => 5.39956803455724E-14,
-                'in'   => 3.93700787401575E-09,
-                'ft'   => 3.28083989501312E-10,
-                'yd'   => 1.09361329797891E-10,
-                'ang'  => 1.0,
-                'Pica' => 2.83464566929116E-07,
-            ),
-            'Pica' => array(
-                'm'    => 3.52777777777800E-04,
-                'mi'   => 2.19205948372629E-07,
-                'Nmi'  => 1.90484761219114E-07,
-                'in'   => 1.38888888888898E-02,
-                'ft'   => 1.15740740740748E-03,
-                'yd'   => 3.85802469009251E-04,
-                'ang'  => 3.52777777777800E+06,
-                'Pica' => 1.0,
-            ),
-        ),
-        'Time' => array(
-            'yr' => array(
-                'yr'  => 1.0,
-                'day' => 365.25,
-                'hr'  => 8766.0,
-                'mn'  => 525960.0,
-                'sec' => 31557600.0,
-            ),
-            'day' => array(
-                'yr'  => 2.73785078713210E-03,
-                'day' => 1.0,
-                'hr'  => 24.0,
-                'mn'  => 1440.0,
-                'sec' => 86400.0,
-            ),
-            'hr' => array(
-                'yr'  => 1.14077116130504E-04,
-                'day' => 4.16666666666667E-02,
-                'hr'  => 1.0,
-                'mn'  => 60.0,
-                'sec' => 3600.0,
-            ),
-            'mn' => array(
-                'yr'  => 1.90128526884174E-06,
-                'day' => 6.94444444444444E-04,
-                'hr'  => 1.66666666666667E-02,
-                'mn'  => 1.0,
-                'sec' => 60.0,
-            ),
-            'sec' => array(
-                'yr'  => 3.16880878140289E-08,
-                'day' => 1.15740740740741E-05,
-                'hr'  => 2.77777777777778E-04,
-                'mn'  => 1.66666666666667E-02,
-                'sec' => 1.0,
-            ),
-        ),
-        'Pressure' => array(
-            'Pa' => array(
-                'Pa'   => 1.0,
-                'p'    => 1.0,
-                'atm'  => 9.86923299998193E-06,
-                'at'   => 9.86923299998193E-06,
-                'mmHg' => 7.50061707998627E-03,
-            ),
-            'p' => array(
-                'Pa'   => 1.0,
-                'p'    => 1.0,
-                'atm'  => 9.86923299998193E-06,
-                'at'   => 9.86923299998193E-06,
-                'mmHg' => 7.50061707998627E-03,
-            ),
-            'atm' => array(
-                'Pa'   => 1.01324996583000E+05,
-                'p'    => 1.01324996583000E+05,
-                'atm'  => 1.0,
-                'at'   => 1.0,
-                'mmHg' => 760.0,
-            ),
-            'at' => array(
-                'Pa'   => 1.01324996583000E+05,
-                'p'    => 1.01324996583000E+05,
-                'atm'  => 1.0,
-                'at'   => 1.0,
-                'mmHg' => 760.0,
-            ),
-            'mmHg' => array(
-                'Pa'   => 1.33322363925000E+02,
-                'p'    => 1.33322363925000E+02,
-                'atm'  => 1.31578947368421E-03,
-                'at'   => 1.31578947368421E-03,
-                'mmHg' => 1.0,
-            ),
-        ),
-        'Force' => array(
-            'N' => array(
-                'N'   => 1.0,
-                'dyn' => 1.0E+5,
-                'dy'  => 1.0E+5,
-                'lbf' => 2.24808923655339E-01,
-            ),
-            'dyn' => array(
-                'N'   => 1.0E-5,
-                'dyn' => 1.0,
-                'dy'  => 1.0,
-                'lbf' => 2.24808923655339E-06,
-            ),
-            'dy' => array(
-                'N'   => 1.0E-5,
-                'dyn' => 1.0,
-                'dy'  => 1.0,
-                'lbf' => 2.24808923655339E-06,
-            ),
-            'lbf' => array(
-                'N'   => 4.448222,
-                'dyn' => 4.448222E+5,
-                'dy'  => 4.448222E+5,
-                'lbf' => 1.0,
-            ),
-        ),
-        'Energy' => array(
-            'J' => array(
-                'J'   => 1.0,
-                'e'   => 9.99999519343231E+06,
-                'c'   => 2.39006249473467E-01,
-                'cal' => 2.38846190642017E-01,
-                'eV'  => 6.24145700000000E+18,
-                'ev'  => 6.24145700000000E+18,
-                'HPh' => 3.72506430801000E-07,
-                'hh'  => 3.72506430801000E-07,
-                'Wh'  => 2.77777916238711E-04,
-                'wh'  => 2.77777916238711E-04,
-                'flb' => 2.37304222192651E+01,
-                'BTU' => 9.47815067349015E-04,
-                'btu' => 9.47815067349015E-04,
-            ),
-            'e' => array(
-                'J'   => 1.00000048065700E-07,
-                'e'   => 1.0,
-                'c'   => 2.39006364353494E-08,
-                'cal' => 2.38846305445111E-08,
-                'eV'  => 6.24146000000000E+11,
-                'ev'  => 6.24146000000000E+11,
-                'HPh' => 3.72506609848824E-14,
-                'hh'  => 3.72506609848824E-14,
-                'Wh'  => 2.77778049754611E-11,
-                'wh'  => 2.77778049754611E-11,
-                'flb' => 2.37304336254586E-06,
-                'BTU' => 9.47815522922962E-11,
-                'btu' => 9.47815522922962E-11,
-            ),
-            'c' => array(
-                'J'   => 4.18399101363672E+00,
-                'e'   => 4.18398900257312E+07,
-                'c'   => 1.0,
-                'cal' => 9.99330315287563E-01,
-                'eV'  => 2.61142000000000E+19,
-                'ev'  => 2.61142000000000E+19,
-                'HPh' => 1.55856355899327E-06,
-                'hh'  => 1.55856355899327E-06,
-                'Wh'  => 1.16222030532950E-03,
-                'wh'  => 1.16222030532950E-03,
-                'flb' => 9.92878733152102E+01,
-                'BTU' => 3.96564972437776E-03,
-                'btu' => 3.96564972437776E-03,
-            ),
-            'cal' => array(
-                'J'   => 4.18679484613929E+00,
-                'e'   => 4.18679283372801E+07,
-                'c'   => 1.00067013349059E+00,
-                'cal' => 1.0,
-                'eV'  => 2.61317000000000E+19,
-                'ev'  => 2.61317000000000E+19,
-                'HPh' => 1.55960800463137E-06,
-                'hh'  => 1.55960800463137E-06,
-                'Wh'  => 1.16299914807955E-03,
-                'wh'  => 1.16299914807955E-03,
-                'flb' => 9.93544094443283E+01,
-                'BTU' => 3.96830723907002E-03,
-                'btu' => 3.96830723907002E-03,
-            ),
-            'eV' => array(
-                'J'   => 1.60219000146921E-19,
-                'e'   => 1.60218923136574E-12,
-                'c'   => 3.82933423195043E-20,
-                'cal' => 3.82676978535648E-20,
-                'eV'  => 1.0,
-                'ev'  => 1.0,
-                'HPh' => 5.96826078912344E-26,
-                'hh'  => 5.96826078912344E-26,
-                'Wh'  => 4.45053000026614E-23,
-                'wh'  => 4.45053000026614E-23,
-                'flb' => 3.80206452103492E-18,
-                'BTU' => 1.51857982414846E-22,
-                'btu' => 1.51857982414846E-22,
-            ),
-            'ev' => array(
-                'J'   => 1.60219000146921E-19,
-                'e'   => 1.60218923136574E-12,
-                'c'   => 3.82933423195043E-20,
-                'cal' => 3.82676978535648E-20,
-                'eV'  => 1.0,
-                'ev'  => 1.0,
-                'HPh' => 5.96826078912344E-26,
-                'hh'  => 5.96826078912344E-26,
-                'Wh'  => 4.45053000026614E-23,
-                'wh'  => 4.45053000026614E-23,
-                'flb' => 3.80206452103492E-18,
-                'BTU' => 1.51857982414846E-22,
-                'btu' => 1.51857982414846E-22,
-            ),
-            'HPh' => array(
-                'J'   => 2.68451741316170E+06,
-                'e'   => 2.68451612283024E+13,
-                'c'   => 6.41616438565991E+05,
-                'cal' => 6.41186757845835E+05,
-                'eV'  => 1.67553000000000E+25,
-                'ev'  => 1.67553000000000E+25,
-                'HPh' => 1.0,
-                'hh'  => 1.0,
-                'Wh'  => 7.45699653134593E+02,
-                'wh'  => 7.45699653134593E+02,
-                'flb' => 6.37047316692964E+07,
-                'BTU' => 2.54442605275546E+03,
-                'btu' => 2.54442605275546E+03,
-            ),
-            'hh' => array(
-                'J'   => 2.68451741316170E+06,
-                'e'   => 2.68451612283024E+13,
-                'c'   => 6.41616438565991E+05,
-                'cal' => 6.41186757845835E+05,
-                'eV'  => 1.67553000000000E+25,
-                'ev'  => 1.67553000000000E+25,
-                'HPh' => 1.0,
-                'hh'  => 1.0,
-                'Wh'  => 7.45699653134593E+02,
-                'wh'  => 7.45699653134593E+02,
-                'flb' => 6.37047316692964E+07,
-                'BTU' => 2.54442605275546E+03,
-                'btu' => 2.54442605275546E+03,
-            ),
-            'Wh' => array(
-                'J'   => 3.59999820554720E+03,
-                'e'   => 3.59999647518369E+10,
-                'c'   => 8.60422069219046E+02,
-                'cal' => 8.59845857713046E+02,
-                'eV'  => 2.24692340000000E+22,
-                'ev'  => 2.24692340000000E+22,
-                'HPh' => 1.34102248243839E-03,
-                'hh'  => 1.34102248243839E-03,
-                'Wh'  => 1.0,
-                'wh'  => 1.0,
-                'flb' => 8.54294774062316E+04,
-                'BTU' => 3.41213254164705E+00,
-                'btu' => 3.41213254164705E+00,
-            ),
-            'wh' => array(
-                'J'   => 3.59999820554720E+03,
-                'e'   => 3.59999647518369E+10,
-                'c'   => 8.60422069219046E+02,
-                'cal' => 8.59845857713046E+02,
-                'eV'  => 2.24692340000000E+22,
-                'ev'  => 2.24692340000000E+22,
-                'HPh' => 1.34102248243839E-03,
-                'hh'  => 1.34102248243839E-03,
-                'Wh'  => 1.0,
-                'wh'  => 1.0,
-                'flb' => 8.54294774062316E+04,
-                'BTU' => 3.41213254164705E+00,
-                'btu' => 3.41213254164705E+00,
-            ),
-            'flb' => array(
-                'J'   => 4.21400003236424E-02,
-                'e'   => 4.21399800687660E+05,
-                'c'   => 1.00717234301644E-02,
-                'cal' => 1.00649785509554E-02,
-                'eV'  => 2.63015000000000E+17,
-                'ev'  => 2.63015000000000E+17,
-                'HPh' => 1.56974211145130E-08,
-                'hh'  => 1.56974211145130E-08,
-                'Wh'  => 1.17055614802000E-05,
-                'wh'  => 1.17055614802000E-05,
-                'flb' => 1.0,
-                'BTU' => 3.99409272448406E-05,
-                'btu' => 3.99409272448406E-05,
-            ),
-            'BTU' => array(
-                'J'   => 1.05505813786749E+03,
-                'e'   => 1.05505763074665E+10,
-                'c'   => 2.52165488508168E+02,
-                'cal' => 2.51996617135510E+02,
-                'eV'  => 6.58510000000000E+21,
-                'ev'  => 6.58510000000000E+21,
-                'HPh' => 3.93015941224568E-04,
-                'hh'  => 3.93015941224568E-04,
-                'Wh'  => 2.93071851047526E-01,
-                'wh'  => 2.93071851047526E-01,
-                'flb' => 2.50369750774671E+04,
-                'BTU' => 1.0,
-                'btu' => 1.0,
-            ),
-            'btu' => array(
-                'J'   => 1.05505813786749E+03,
-                'e'   => 1.05505763074665E+10,
-                'c'   => 2.52165488508168E+02,
-                'cal' => 2.51996617135510E+02,
-                'eV'  => 6.58510000000000E+21,
-                'ev'  => 6.58510000000000E+21,
-                'HPh' => 3.93015941224568E-04,
-                'hh'  => 3.93015941224568E-04,
-                'Wh'  => 2.93071851047526E-01,
-                'wh'  => 2.93071851047526E-01,
-                'flb' => 2.50369750774671E+04,
-                'BTU' => 1.0,
-                'btu' => 1.0,
-            ),
-        ),
-        'Power' => array(
-            'HP' => array(
-                'HP' => 1.0,
-                'h'  => 1.0,
-                'W'  => 7.45701000000000E+02,
-                'w'  => 7.45701000000000E+02,
-            ),
-            'h' => array(
-                'HP' => 1.0,
-                'h'  => 1.0,
-                'W'  => 7.45701000000000E+02,
-                'w'  => 7.45701000000000E+02,
-            ),
-            'W' => array(
-                'HP' => 1.34102006031908E-03,
-                'h'  => 1.34102006031908E-03,
-                'W'  => 1.0,
-                'w'  => 1.0,
-            ),
-            'w' => array(
-                'HP' => 1.34102006031908E-03,
-                'h'  => 1.34102006031908E-03,
-                'W'  => 1.0,
-                'w'  => 1.0,
-            ),
-        ),
-        'Magnetism' => array(
-            'T' => array(
-                'T'  => 1.0,
-                'ga' => 10000.0,
-            ),
-            'ga' => array(
-                'T'  => 0.0001,
-                'ga' => 1.0,
-            ),
-        ),
-        'Liquid' => array(
-            'tsp' => array(
-                'tsp'   => 1.0,
-                'tbs'   => 3.33333333333333E-01,
-                'oz'    => 1.66666666666667E-01,
-                'cup'   => 2.08333333333333E-02,
-                'pt'    => 1.04166666666667E-02,
-                'us_pt' => 1.04166666666667E-02,
-                'uk_pt' => 8.67558516821960E-03,
-                'qt'    => 5.20833333333333E-03,
-                'gal'   => 1.30208333333333E-03,
-                'l'     => 4.92999408400710E-03,
-                'lt'    => 4.92999408400710E-03,
-            ),
-            'tbs' => array(
-                'tsp'   => 3.00000000000000E+00,
-                'tbs'   => 1.0,
-                'oz'    => 5.00000000000000E-01,
-                'cup'   => 6.25000000000000E-02,
-                'pt'    => 3.12500000000000E-02,
-                'us_pt' => 3.12500000000000E-02,
-                'uk_pt' => 2.60267555046588E-02,
-                'qt'    => 1.56250000000000E-02,
-                'gal'   => 3.90625000000000E-03,
-                'l'     => 1.47899822520213E-02,
-                'lt'    => 1.47899822520213E-02,
-            ),
-            'oz' => array(
-                'tsp'   => 6.00000000000000E+00,
-                'tbs'   => 2.00000000000000E+00,
-                'oz'    => 1.0,
-                'cup'   => 1.25000000000000E-01,
-                'pt'    => 6.25000000000000E-02,
-                'us_pt' => 6.25000000000000E-02,
-                'uk_pt' => 5.20535110093176E-02,
-                'qt'    => 3.12500000000000E-02,
-                'gal'   => 7.81250000000000E-03,
-                'l'     => 2.95799645040426E-02,
-                'lt'    => 2.95799645040426E-02,
-            ),
-            'cup' => array(
-                'tsp'   => 4.80000000000000E+01,
-                'tbs'   => 1.60000000000000E+01,
-                'oz'    => 8.00000000000000E+00,
-                'cup'   => 1.0,
-                'pt'    => 5.00000000000000E-01,
-                'us_pt' => 5.00000000000000E-01,
-                'uk_pt' => 4.16428088074541E-01,
-                'qt'    => 2.50000000000000E-01,
-                'gal'   => 6.25000000000000E-02,
-                'l'     => 2.36639716032341E-01,
-                'lt'    => 2.36639716032341E-01,
-            ),
-            'pt' => array(
-                'tsp'   => 9.60000000000000E+01,
-                'tbs'   => 3.20000000000000E+01,
-                'oz'    => 1.60000000000000E+01,
-                'cup'   => 2.00000000000000E+00,
-                'pt'    => 1.0,
-                'us_pt' => 1.0,
-                'uk_pt' => 8.32856176149081E-01,
-                'qt'    => 5.00000000000000E-01,
-                'gal'   => 1.25000000000000E-01,
-                'l'     => 4.73279432064682E-01,
-                'lt'    => 4.73279432064682E-01,
-            ),
-            'us_pt' => array(
-                'tsp'   => 9.60000000000000E+01,
-                'tbs'   => 3.20000000000000E+01,
-                'oz'    => 1.60000000000000E+01,
-                'cup'   => 2.00000000000000E+00,
-                'pt'    => 1.0,
-                'us_pt' => 1.0,
-                'uk_pt' => 8.32856176149081E-01,
-                'qt'    => 5.00000000000000E-01,
-                'gal'   => 1.25000000000000E-01,
-                'l'     => 4.73279432064682E-01,
-                'lt'    => 4.73279432064682E-01,
-            ),
-            'uk_pt' => array(
-                'tsp'   => 1.15266000000000E+02,
-                'tbs'   => 3.84220000000000E+01,
-                'oz'    => 1.92110000000000E+01,
-                'cup'   => 2.40137500000000E+00,
-                'pt'    => 1.20068750000000E+00,
-                'us_pt' => 1.20068750000000E+00,
-                'uk_pt' => 1.0,
-                'qt'    => 6.00343750000000E-01,
-                'gal'   => 1.50085937500000E-01,
-                'l'     => 5.68260698087162E-01,
-                'lt'    => 5.68260698087162E-01,
-            ),
-            'qt' => array(
-                'tsp'   => 1.92000000000000E+02,
-                'tbs'   => 6.40000000000000E+01,
-                'oz'    => 3.20000000000000E+01,
-                'cup'   => 4.00000000000000E+00,
-                'pt'    => 2.00000000000000E+00,
-                'us_pt' => 2.00000000000000E+00,
-                'uk_pt' => 1.66571235229816E+00,
-                'qt'    => 1.0,
-                'gal'   => 2.50000000000000E-01,
-                'l'     => 9.46558864129363E-01,
-                'lt'    => 9.46558864129363E-01,
-            ),
-            'gal' => array(
-                'tsp'   => 7.68000000000000E+02,
-                'tbs'   => 2.56000000000000E+02,
-                'oz'    => 1.28000000000000E+02,
-                'cup'   => 1.60000000000000E+01,
-                'pt'    => 8.00000000000000E+00,
-                'us_pt' => 8.00000000000000E+00,
-                'uk_pt' => 6.66284940919265E+00,
-                'qt'    => 4.00000000000000E+00,
-                'gal'   => 1.0,
-                'l'     => 3.78623545651745E+00,
-                'lt'    => 3.78623545651745E+00,
-            ),
-            'l' => array(
-                'tsp'   => 2.02840000000000E+02,
-                'tbs'   => 6.76133333333333E+01,
-                'oz'    => 3.38066666666667E+01,
-                'cup'   => 4.22583333333333E+00,
-                'pt'    => 2.11291666666667E+00,
-                'us_pt' => 2.11291666666667E+00,
-                'uk_pt' => 1.75975569552166E+00,
-                'qt'    => 1.05645833333333E+00,
-                'gal'   => 2.64114583333333E-01,
-                'l'     => 1.0,
-                'lt'    => 1.0,
-            ),
-            'lt' => array(
-                'tsp'   => 2.02840000000000E+02,
-                'tbs'   => 6.76133333333333E+01,
-                'oz'    => 3.38066666666667E+01,
-                'cup'   => 4.22583333333333E+00,
-                'pt'    => 2.11291666666667E+00,
-                'us_pt' => 2.11291666666667E+00,
-                'uk_pt' => 1.75975569552166E+00,
-                'qt'    => 1.05645833333333E+00,
-                'gal'   => 2.64114583333333E-01,
-                'l'     => 1.0,
-                'lt'    => 1.0,
-            ),
-        ),
-    );
-
-
-    /**
-     * parseComplex
-     *
-     * Parses a complex number into its real and imaginary parts, and an I or J suffix
-     *
-     * @param    string        $complexNumber    The complex number
-     * @return    string[]    Indexed on "real", "imaginary" and "suffix"
-     */
-    public static function parseComplex($complexNumber)
-    {
-        $workString = (string) $complexNumber;
-
-        $realNumber = $imaginary = 0;
-        //    Extract the suffix, if there is one
-        $suffix = substr($workString, -1);
-        if (!is_numeric($suffix)) {
-            $workString = substr($workString, 0, -1);
-        } else {
-            $suffix = '';
-        }
-
-        //    Split the input into its Real and Imaginary components
-        $leadingSign = 0;
-        if (strlen($workString) > 0) {
-            $leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0;
-        }
-        $power = '';
-        $realNumber = strtok($workString, '+-');
-        if (strtoupper(substr($realNumber, -1)) == 'E') {
-            $power = strtok('+-');
-            ++$leadingSign;
-        }
-
-        $realNumber = substr($workString, 0, strlen($realNumber)+strlen($power)+$leadingSign);
-
-        if ($suffix != '') {
-            $imaginary = substr($workString, strlen($realNumber));
-
-            if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
-                $imaginary = $realNumber.'1';
-                $realNumber = '0';
-            } elseif ($imaginary == '') {
-                $imaginary = $realNumber;
-                $realNumber = '0';
-            } elseif (($imaginary == '+') || ($imaginary == '-')) {
-                $imaginary .= '1';
-            }
-        }
-
-        return array(
-            'real'   => $realNumber,
-            'imaginary' => $imaginary,
-            'suffix' => $suffix
-        );
-    }
-
-
-    /**
-     * Cleans the leading characters in a complex number string
-     *
-     * @param    string        $complexNumber    The complex number to clean
-     * @return    string        The "cleaned" complex number
-     */
-    private static function cleanComplex($complexNumber)
-    {
-        if ($complexNumber{0} == '+') {
-            $complexNumber = substr($complexNumber, 1);
-        }
-        if ($complexNumber{0} == '0') {
-            $complexNumber = substr($complexNumber, 1);
-        }
-        if ($complexNumber{0} == '.') {
-            $complexNumber = '0'.$complexNumber;
-        }
-        if ($complexNumber{0} == '+') {
-            $complexNumber = substr($complexNumber, 1);
-        }
-        return $complexNumber;
-    }
-
-    /**
-     * Formats a number base string value with leading zeroes
-     *
-     * @param    string        $xVal        The "number" to pad
-     * @param    integer        $places        The length that we want to pad this value
-     * @return    string        The padded "number"
-     */
-    private static function nbrConversionFormat($xVal, $places)
-    {
-        if (!is_null($places)) {
-            if (strlen($xVal) <= $places) {
-                return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
-            } else {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-        }
-
-        return substr($xVal, -10);
-    }
-
-    /**
-     *    BESSELI
-     *
-     *    Returns the modified Bessel function In(x), which is equivalent to the Bessel function evaluated
-     *        for purely imaginary arguments
-     *
-     *    Excel Function:
-     *        BESSELI(x,ord)
-     *
-     *    @access    public
-     *    @category Engineering Functions
-     *    @param    float        $x        The value at which to evaluate the function.
-     *                                If x is nonnumeric, BESSELI returns the #VALUE! error value.
-     *    @param    integer        $ord    The order of the Bessel function.
-     *                                If ord is not an integer, it is truncated.
-     *                                If $ord is nonnumeric, BESSELI returns the #VALUE! error value.
-     *                                If $ord < 0, BESSELI returns the #NUM! error value.
-     *    @return    float
-     *
-     */
-    public static function BESSELI($x, $ord)
-    {
-        $x    = (is_null($x))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $ord    = (is_null($ord))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($ord);
-
-        if ((is_numeric($x)) && (is_numeric($ord))) {
-            $ord    = floor($ord);
-            if ($ord < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            if (abs($x) <= 30) {
-                $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
-                $ordK = 1;
-                $fSqrX = ($x * $x) / 4;
-                do {
-                    $fTerm *= $fSqrX;
-                    $fTerm /= ($ordK * ($ordK + $ord));
-                    $fResult += $fTerm;
-                } while ((abs($fTerm) > 1e-12) && (++$ordK < 100));
-            } else {
-                $f_2_PI = 2 * M_PI;
-
-                $fXAbs = abs($x);
-                $fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs);
-                if (($ord & 1) && ($x < 0)) {
-                    $fResult = -$fResult;
-                }
-            }
-            return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     *    BESSELJ
-     *
-     *    Returns the Bessel function
-     *
-     *    Excel Function:
-     *        BESSELJ(x,ord)
-     *
-     *    @access    public
-     *    @category Engineering Functions
-     *    @param    float        $x        The value at which to evaluate the function.
-     *                                If x is nonnumeric, BESSELJ returns the #VALUE! error value.
-     *    @param    integer        $ord    The order of the Bessel function. If n is not an integer, it is truncated.
-     *                                If $ord is nonnumeric, BESSELJ returns the #VALUE! error value.
-     *                                If $ord < 0, BESSELJ returns the #NUM! error value.
-     *    @return    float
-     *
-     */
-    public static function BESSELJ($x, $ord)
-    {
-        $x    = (is_null($x))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $ord    = (is_null($ord))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($ord);
-
-        if ((is_numeric($x)) && (is_numeric($ord))) {
-            $ord    = floor($ord);
-            if ($ord < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            $fResult = 0;
-            if (abs($x) <= 30) {
-                $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
-                $ordK = 1;
-                $fSqrX = ($x * $x) / -4;
-                do {
-                    $fTerm *= $fSqrX;
-                    $fTerm /= ($ordK * ($ordK + $ord));
-                    $fResult += $fTerm;
-                } while ((abs($fTerm) > 1e-12) && (++$ordK < 100));
-            } else {
-                $f_PI_DIV_2 = M_PI / 2;
-                $f_PI_DIV_4 = M_PI / 4;
-
-                $fXAbs = abs($x);
-                $fResult = sqrt(M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4);
-                if (($ord & 1) && ($x < 0)) {
-                    $fResult = -$fResult;
-                }
-            }
-            return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    private static function besselK0($fNum)
-    {
-        if ($fNum <= 2) {
-            $fNum2 = $fNum * 0.5;
-            $y = ($fNum2 * $fNum2);
-            $fRet = -log($fNum2) * self::BESSELI($fNum, 0) +
-                (-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y *
-                (0.10750e-3 + $y * 0.74e-5))))));
-        } else {
-            $y = 2 / $fNum;
-            $fRet = exp(-$fNum) / sqrt($fNum) *
-                (1.25331414 + $y * (-0.7832358e-1 + $y * (0.2189568e-1 + $y * (-0.1062446e-1 + $y *
-                (0.587872e-2 + $y * (-0.251540e-2 + $y * 0.53208e-3))))));
-        }
-        return $fRet;
-    }
-
-
-    private static function besselK1($fNum)
-    {
-        if ($fNum <= 2) {
-            $fNum2 = $fNum * 0.5;
-            $y = ($fNum2 * $fNum2);
-            $fRet = log($fNum2) * self::BESSELI($fNum, 1) +
-                (1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y *
-                (-0.110404e-2 + $y * (-0.4686e-4))))))) / $fNum;
-        } else {
-            $y = 2 / $fNum;
-            $fRet = exp(-$fNum) / sqrt($fNum) *
-                (1.25331414 + $y * (0.23498619 + $y * (-0.3655620e-1 + $y * (0.1504268e-1 + $y * (-0.780353e-2 + $y *
-                (0.325614e-2 + $y * (-0.68245e-3)))))));
-        }
-        return $fRet;
-    }
-
-
-    /**
-     *    BESSELK
-     *
-     *    Returns the modified Bessel function Kn(x), which is equivalent to the Bessel functions evaluated
-     *        for purely imaginary arguments.
-     *
-     *    Excel Function:
-     *        BESSELK(x,ord)
-     *
-     *    @access    public
-     *    @category Engineering Functions
-     *    @param    float        $x        The value at which to evaluate the function.
-     *                                If x is nonnumeric, BESSELK returns the #VALUE! error value.
-     *    @param    integer        $ord    The order of the Bessel function. If n is not an integer, it is truncated.
-     *                                If $ord is nonnumeric, BESSELK returns the #VALUE! error value.
-     *                                If $ord < 0, BESSELK returns the #NUM! error value.
-     *    @return    float
-     *
-     */
-    public static function BESSELK($x, $ord)
-    {
-        $x        = (is_null($x))        ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $ord    = (is_null($ord))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($ord);
-
-        if ((is_numeric($x)) && (is_numeric($ord))) {
-            if (($ord < 0) || ($x == 0.0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            switch (floor($ord)) {
-                case 0:
-                    return self::besselK0($x);
-                case 1:
-                    return self::besselK1($x);
-                default:
-                    $fTox    = 2 / $x;
-                    $fBkm    = self::besselK0($x);
-                    $fBk    = self::besselK1($x);
-                    for ($n = 1; $n < $ord; ++$n) {
-                        $fBkp    = $fBkm + $n * $fTox * $fBk;
-                        $fBkm    = $fBk;
-                        $fBk    = $fBkp;
-                    }
-            }
-            return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    private static function besselY0($fNum)
-    {
-        if ($fNum < 8.0) {
-            $y = ($fNum * $fNum);
-            $f1 = -2957821389.0 + $y * (7062834065.0 + $y * (-512359803.6 + $y * (10879881.29 + $y * (-86327.92757 + $y * 228.4622733))));
-            $f2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y))));
-            $fRet = $f1 / $f2 + 0.636619772 * self::BESSELJ($fNum, 0) * log($fNum);
-        } else {
-            $z = 8.0 / $fNum;
-            $y = ($z * $z);
-            $xx = $fNum - 0.785398164;
-            $f1 = 1 + $y * (-0.1098628627e-2 + $y * (0.2734510407e-4 + $y * (-0.2073370639e-5 + $y * 0.2093887211e-6)));
-            $f2 = -0.1562499995e-1 + $y * (0.1430488765e-3 + $y * (-0.6911147651e-5 + $y * (0.7621095161e-6 + $y * (-0.934945152e-7))));
-            $fRet = sqrt(0.636619772 / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2);
-        }
-        return $fRet;
-    }
-
-
-    private static function besselY1($fNum)
-    {
-        if ($fNum < 8.0) {
-            $y = ($fNum * $fNum);
-            $f1 = $fNum * (-0.4900604943e13 + $y * (0.1275274390e13 + $y * (-0.5153438139e11 + $y * (0.7349264551e9 + $y *
-                (-0.4237922726e7 + $y * 0.8511937935e4)))));
-            $f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y *
-                (0.1020426050e6 + $y * (0.3549632885e3 + $y)))));
-            $fRet = $f1 / $f2 + 0.636619772 * ( self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum);
-        } else {
-            $fRet = sqrt(0.636619772 / $fNum) * sin($fNum - 2.356194491);
-        }
-        return $fRet;
-    }
-
-
-    /**
-     *    BESSELY
-     *
-     *    Returns the Bessel function, which is also called the Weber function or the Neumann function.
-     *
-     *    Excel Function:
-     *        BESSELY(x,ord)
-     *
-     *    @access    public
-     *    @category Engineering Functions
-     *    @param    float        $x        The value at which to evaluate the function.
-     *                                If x is nonnumeric, BESSELK returns the #VALUE! error value.
-     *    @param    integer        $ord    The order of the Bessel function. If n is not an integer, it is truncated.
-     *                                If $ord is nonnumeric, BESSELK returns the #VALUE! error value.
-     *                                If $ord < 0, BESSELK returns the #NUM! error value.
-     *
-     *    @return    float
-     */
-    public static function BESSELY($x, $ord)
-    {
-        $x        = (is_null($x))        ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $ord    = (is_null($ord))    ? 0.0 :    PHPExcel_Calculation_Functions::flattenSingleValue($ord);
-
-        if ((is_numeric($x)) && (is_numeric($ord))) {
-            if (($ord < 0) || ($x == 0.0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            switch (floor($ord)) {
-                case 0:
-                    return self::besselY0($x);
-                case 1:
-                    return self::besselY1($x);
-                default:
-                    $fTox    = 2 / $x;
-                    $fBym    = self::besselY0($x);
-                    $fBy    = self::besselY1($x);
-                    for ($n = 1; $n < $ord; ++$n) {
-                        $fByp    = $n * $fTox * $fBy - $fBym;
-                        $fBym    = $fBy;
-                        $fBy    = $fByp;
-                    }
-            }
-            return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * BINTODEC
-     *
-     * Return a binary value as decimal.
-     *
-     * Excel Function:
-     *        BIN2DEC(x)
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The binary number (as a string) that you want to convert. The number
-     *                                cannot contain more than 10 characters (10 bits). The most significant
-     *                                bit of number is the sign bit. The remaining 9 bits are magnitude bits.
-     *                                Negative numbers are represented using two's-complement notation.
-     *                                If number is not a valid binary number, or if number contains more than
-     *                                10 characters (10 bits), BIN2DEC returns the #NUM! error value.
-     * @return    string
-     */
-    public static function BINTODEC($x)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-            $x = floor($x);
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if (strlen($x) > 10) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (strlen($x) == 10) {
-            //    Two's Complement
-            $x = substr($x, -9);
-            return '-'.(512-bindec($x));
-        }
-        return bindec($x);
-    }
-
-
-    /**
-     * BINTOHEX
-     *
-     * Return a binary value as hex.
-     *
-     * Excel Function:
-     *        BIN2HEX(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The binary number (as a string) that you want to convert. The number
-     *                                cannot contain more than 10 characters (10 bits). The most significant
-     *                                bit of number is the sign bit. The remaining 9 bits are magnitude bits.
-     *                                Negative numbers are represented using two's-complement notation.
-     *                                If number is not a valid binary number, or if number contains more than
-     *                                10 characters (10 bits), BIN2HEX returns the #NUM! error value.
-     * @param    integer        $places    The number of characters to use. If places is omitted, BIN2HEX uses the
-     *                                minimum number of characters necessary. Places is useful for padding the
-     *                                return value with leading 0s (zeros).
-     *                                If places is not an integer, it is truncated.
-     *                                If places is nonnumeric, BIN2HEX returns the #VALUE! error value.
-     *                                If places is negative, BIN2HEX returns the #NUM! error value.
-     * @return    string
-     */
-    public static function BINTOHEX($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-            $x = floor($x);
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if (strlen($x) > 10) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (strlen($x) == 10) {
-            //    Two's Complement
-            return str_repeat('F', 8).substr(strtoupper(dechex(bindec(substr($x, -9)))), -2);
-        }
-        $hexVal = (string) strtoupper(dechex(bindec($x)));
-
-        return self::nbrConversionFormat($hexVal, $places);
-    }
-
-
-    /**
-     * BINTOOCT
-     *
-     * Return a binary value as octal.
-     *
-     * Excel Function:
-     *        BIN2OCT(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The binary number (as a string) that you want to convert. The number
-     *                                cannot contain more than 10 characters (10 bits). The most significant
-     *                                bit of number is the sign bit. The remaining 9 bits are magnitude bits.
-     *                                Negative numbers are represented using two's-complement notation.
-     *                                If number is not a valid binary number, or if number contains more than
-     *                                10 characters (10 bits), BIN2OCT returns the #NUM! error value.
-     * @param    integer        $places    The number of characters to use. If places is omitted, BIN2OCT uses the
-     *                                minimum number of characters necessary. Places is useful for padding the
-     *                                return value with leading 0s (zeros).
-     *                                If places is not an integer, it is truncated.
-     *                                If places is nonnumeric, BIN2OCT returns the #VALUE! error value.
-     *                                If places is negative, BIN2OCT returns the #NUM! error value.
-     * @return    string
-     */
-    public static function BINTOOCT($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-            $x = floor($x);
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if (strlen($x) > 10) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (strlen($x) == 10) {
-            //    Two's Complement
-            return str_repeat('7', 7).substr(strtoupper(decoct(bindec(substr($x, -9)))), -3);
-        }
-        $octVal = (string) decoct(bindec($x));
-
-        return self::nbrConversionFormat($octVal, $places);
-    }
-
-
-    /**
-     * DECTOBIN
-     *
-     * Return a decimal value as binary.
-     *
-     * Excel Function:
-     *        DEC2BIN(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The decimal integer you want to convert. If number is negative,
-     *                                valid place values are ignored and DEC2BIN returns a 10-character
-     *                                (10-bit) binary number in which the most significant bit is the sign
-     *                                bit. The remaining 9 bits are magnitude bits. Negative numbers are
-     *                                represented using two's-complement notation.
-     *                                If number < -512 or if number > 511, DEC2BIN returns the #NUM! error
-     *                                value.
-     *                                If number is nonnumeric, DEC2BIN returns the #VALUE! error value.
-     *                                If DEC2BIN requires more than places characters, it returns the #NUM!
-     *                                error value.
-     * @param    integer        $places    The number of characters to use. If places is omitted, DEC2BIN uses
-     *                                the minimum number of characters necessary. Places is useful for
-     *                                padding the return value with leading 0s (zeros).
-     *                                If places is not an integer, it is truncated.
-     *                                If places is nonnumeric, DEC2BIN returns the #VALUE! error value.
-     *                                If places is zero or negative, DEC2BIN returns the #NUM! error value.
-     * @return    string
-     */
-    public static function DECTOBIN($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) floor($x);
-        $r = decbin($x);
-        if (strlen($r) == 32) {
-            //    Two's Complement
-            $r = substr($r, -10);
-        } elseif (strlen($r) > 11) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return self::nbrConversionFormat($r, $places);
-    }
-
-
-    /**
-     * DECTOHEX
-     *
-     * Return a decimal value as hex.
-     *
-     * Excel Function:
-     *        DEC2HEX(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The decimal integer you want to convert. If number is negative,
-     *                                places is ignored and DEC2HEX returns a 10-character (40-bit)
-     *                                hexadecimal number in which the most significant bit is the sign
-     *                                bit. The remaining 39 bits are magnitude bits. Negative numbers
-     *                                are represented using two's-complement notation.
-     *                                If number < -549,755,813,888 or if number > 549,755,813,887,
-     *                                DEC2HEX returns the #NUM! error value.
-     *                                If number is nonnumeric, DEC2HEX returns the #VALUE! error value.
-     *                                If DEC2HEX requires more than places characters, it returns the
-     *                                #NUM! error value.
-     * @param    integer        $places    The number of characters to use. If places is omitted, DEC2HEX uses
-     *                                the minimum number of characters necessary. Places is useful for
-     *                                padding the return value with leading 0s (zeros).
-     *                                If places is not an integer, it is truncated.
-     *                                If places is nonnumeric, DEC2HEX returns the #VALUE! error value.
-     *                                If places is zero or negative, DEC2HEX returns the #NUM! error value.
-     * @return    string
-     */
-    public static function DECTOHEX($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) floor($x);
-        $r = strtoupper(dechex($x));
-        if (strlen($r) == 8) {
-            //    Two's Complement
-            $r = 'FF'.$r;
-        }
-
-        return self::nbrConversionFormat($r, $places);
-    }
-
-
-    /**
-     * DECTOOCT
-     *
-     * Return an decimal value as octal.
-     *
-     * Excel Function:
-     *        DEC2OCT(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The decimal integer you want to convert. If number is negative,
-     *                                places is ignored and DEC2OCT returns a 10-character (30-bit)
-     *                                octal number in which the most significant bit is the sign bit.
-     *                                The remaining 29 bits are magnitude bits. Negative numbers are
-     *                                represented using two's-complement notation.
-     *                                If number < -536,870,912 or if number > 536,870,911, DEC2OCT
-     *                                returns the #NUM! error value.
-     *                                If number is nonnumeric, DEC2OCT returns the #VALUE! error value.
-     *                                If DEC2OCT requires more than places characters, it returns the
-     *                                #NUM! error value.
-     * @param    integer        $places    The number of characters to use. If places is omitted, DEC2OCT uses
-     *                                the minimum number of characters necessary. Places is useful for
-     *                                padding the return value with leading 0s (zeros).
-     *                                If places is not an integer, it is truncated.
-     *                                If places is nonnumeric, DEC2OCT returns the #VALUE! error value.
-     *                                If places is zero or negative, DEC2OCT returns the #NUM! error value.
-     * @return    string
-     */
-    public static function DECTOOCT($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $x = (int) $x;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) floor($x);
-        $r = decoct($x);
-        if (strlen($r) == 11) {
-            //    Two's Complement
-            $r = substr($r, -10);
-        }
-
-        return self::nbrConversionFormat($r, $places);
-    }
-
-
-    /**
-     * HEXTOBIN
-     *
-     * Return a hex value as binary.
-     *
-     * Excel Function:
-     *        HEX2BIN(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x            the hexadecimal number you want to convert. Number cannot
-     *                                    contain more than 10 characters. The most significant bit of
-     *                                    number is the sign bit (40th bit from the right). The remaining
-     *                                    9 bits are magnitude bits. Negative numbers are represented
-     *                                    using two's-complement notation.
-     *                                    If number is negative, HEX2BIN ignores places and returns a
-     *                                    10-character binary number.
-     *                                    If number is negative, it cannot be less than FFFFFFFE00, and
-     *                                    if number is positive, it cannot be greater than 1FF.
-     *                                    If number is not a valid hexadecimal number, HEX2BIN returns
-     *                                    the #NUM! error value.
-     *                                    If HEX2BIN requires more than places characters, it returns
-     *                                    the #NUM! error value.
-     * @param    integer        $places        The number of characters to use. If places is omitted,
-     *                                    HEX2BIN uses the minimum number of characters necessary. Places
-     *                                    is useful for padding the return value with leading 0s (zeros).
-     *                                    If places is not an integer, it is truncated.
-     *                                    If places is nonnumeric, HEX2BIN returns the #VALUE! error value.
-     *                                    If places is negative, HEX2BIN returns the #NUM! error value.
-     * @return    string
-     */
-    public static function HEXTOBIN($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $binVal = decbin(hexdec($x));
-
-        return substr(self::nbrConversionFormat($binVal, $places), -10);
-    }
-
-
-    /**
-     * HEXTODEC
-     *
-     * Return a hex value as decimal.
-     *
-     * Excel Function:
-     *        HEX2DEC(x)
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The hexadecimal number you want to convert. This number cannot
-     *                                contain more than 10 characters (40 bits). The most significant
-     *                                bit of number is the sign bit. The remaining 39 bits are magnitude
-     *                                bits. Negative numbers are represented using two's-complement
-     *                                notation.
-     *                                If number is not a valid hexadecimal number, HEX2DEC returns the
-     *                                #NUM! error value.
-     * @return    string
-     */
-    public static function HEXTODEC($x)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return hexdec($x);
-    }
-
-
-    /**
-     * HEXTOOCT
-     *
-     * Return a hex value as octal.
-     *
-     * Excel Function:
-     *        HEX2OCT(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x            The hexadecimal number you want to convert. Number cannot
-     *                                    contain more than 10 characters. The most significant bit of
-     *                                    number is the sign bit. The remaining 39 bits are magnitude
-     *                                    bits. Negative numbers are represented using two's-complement
-     *                                    notation.
-     *                                    If number is negative, HEX2OCT ignores places and returns a
-     *                                    10-character octal number.
-     *                                    If number is negative, it cannot be less than FFE0000000, and
-     *                                    if number is positive, it cannot be greater than 1FFFFFFF.
-     *                                    If number is not a valid hexadecimal number, HEX2OCT returns
-     *                                    the #NUM! error value.
-     *                                    If HEX2OCT requires more than places characters, it returns
-     *                                    the #NUM! error value.
-     * @param    integer        $places        The number of characters to use. If places is omitted, HEX2OCT
-     *                                    uses the minimum number of characters necessary. Places is
-     *                                    useful for padding the return value with leading 0s (zeros).
-     *                                    If places is not an integer, it is truncated.
-     *                                    If places is nonnumeric, HEX2OCT returns the #VALUE! error
-     *                                    value.
-     *                                    If places is negative, HEX2OCT returns the #NUM! error value.
-     * @return    string
-     */
-    public static function HEXTOOCT($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $octVal = decoct(hexdec($x));
-
-        return self::nbrConversionFormat($octVal, $places);
-    }    //    function HEXTOOCT()
-
-
-    /**
-     * OCTTOBIN
-     *
-     * Return an octal value as binary.
-     *
-     * Excel Function:
-     *        OCT2BIN(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x            The octal number you want to convert. Number may not
-     *                                    contain more than 10 characters. The most significant
-     *                                    bit of number is the sign bit. The remaining 29 bits
-     *                                    are magnitude bits. Negative numbers are represented
-     *                                    using two's-complement notation.
-     *                                    If number is negative, OCT2BIN ignores places and returns
-     *                                    a 10-character binary number.
-     *                                    If number is negative, it cannot be less than 7777777000,
-     *                                    and if number is positive, it cannot be greater than 777.
-     *                                    If number is not a valid octal number, OCT2BIN returns
-     *                                    the #NUM! error value.
-     *                                    If OCT2BIN requires more than places characters, it
-     *                                    returns the #NUM! error value.
-     * @param    integer        $places        The number of characters to use. If places is omitted,
-     *                                    OCT2BIN uses the minimum number of characters necessary.
-     *                                    Places is useful for padding the return value with
-     *                                    leading 0s (zeros).
-     *                                    If places is not an integer, it is truncated.
-     *                                    If places is nonnumeric, OCT2BIN returns the #VALUE!
-     *                                    error value.
-     *                                    If places is negative, OCT2BIN returns the #NUM! error
-     *                                    value.
-     * @return    string
-     */
-    public static function OCTTOBIN($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $r = decbin(octdec($x));
-
-        return self::nbrConversionFormat($r, $places);
-    }
-
-
-    /**
-     * OCTTODEC
-     *
-     * Return an octal value as decimal.
-     *
-     * Excel Function:
-     *        OCT2DEC(x)
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x        The octal number you want to convert. Number may not contain
-     *                                more than 10 octal characters (30 bits). The most significant
-     *                                bit of number is the sign bit. The remaining 29 bits are
-     *                                magnitude bits. Negative numbers are represented using
-     *                                two's-complement notation.
-     *                                If number is not a valid octal number, OCT2DEC returns the
-     *                                #NUM! error value.
-     * @return    string
-     */
-    public static function OCTTODEC($x)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return octdec($x);
-    }
-
-
-    /**
-     * OCTTOHEX
-     *
-     * Return an octal value as hex.
-     *
-     * Excel Function:
-     *        OCT2HEX(x[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $x            The octal number you want to convert. Number may not contain
-     *                                    more than 10 octal characters (30 bits). The most significant
-     *                                    bit of number is the sign bit. The remaining 29 bits are
-     *                                    magnitude bits. Negative numbers are represented using
-     *                                    two's-complement notation.
-     *                                    If number is negative, OCT2HEX ignores places and returns a
-     *                                    10-character hexadecimal number.
-     *                                    If number is not a valid octal number, OCT2HEX returns the
-     *                                    #NUM! error value.
-     *                                    If OCT2HEX requires more than places characters, it returns
-     *                                    the #NUM! error value.
-     * @param    integer        $places        The number of characters to use. If places is omitted, OCT2HEX
-     *                                    uses the minimum number of characters necessary. Places is useful
-     *                                    for padding the return value with leading 0s (zeros).
-     *                                    If places is not an integer, it is truncated.
-     *                                    If places is nonnumeric, OCT2HEX returns the #VALUE! error value.
-     *                                    If places is negative, OCT2HEX returns the #NUM! error value.
-     * @return    string
-     */
-    public static function OCTTOHEX($x, $places = null)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $places    = PHPExcel_Calculation_Functions::flattenSingleValue($places);
-
-        if (is_bool($x)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $x = (string) $x;
-        if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $hexVal = strtoupper(dechex(octdec($x)));
-
-        return self::nbrConversionFormat($hexVal, $places);
-    }
-
-
-    /**
-     * COMPLEX
-     *
-     * Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj.
-     *
-     * Excel Function:
-     *        COMPLEX(realNumber,imaginary[,places])
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    float        $realNumber        The real coefficient of the complex number.
-     * @param    float        $imaginary        The imaginary coefficient of the complex number.
-     * @param    string        $suffix            The suffix for the imaginary component of the complex number.
-     *                                        If omitted, the suffix is assumed to be "i".
-     * @return    string
-     */
-    public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i')
-    {
-        $realNumber = (is_null($realNumber)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
-        $imaginary  = (is_null($imaginary))  ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
-        $suffix     = (is_null($suffix))     ? 'i' : PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
-
-        if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
-            (($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) {
-            $realNumber    = (float) $realNumber;
-            $imaginary    = (float) $imaginary;
-
-            if ($suffix == '') {
-                $suffix = 'i';
-            }
-            if ($realNumber == 0.0) {
-                if ($imaginary == 0.0) {
-                    return (string) '0';
-                } elseif ($imaginary == 1.0) {
-                    return (string) $suffix;
-                } elseif ($imaginary == -1.0) {
-                    return (string) '-'.$suffix;
-                }
-                return (string) $imaginary.$suffix;
-            } elseif ($imaginary == 0.0) {
-                return (string) $realNumber;
-            } elseif ($imaginary == 1.0) {
-                return (string) $realNumber.'+'.$suffix;
-            } elseif ($imaginary == -1.0) {
-                return (string) $realNumber.'-'.$suffix;
-            }
-            if ($imaginary > 0) {
-                $imaginary = (string) '+'.$imaginary;
-            }
-            return (string) $realNumber.$imaginary.$suffix;
-        }
-
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * IMAGINARY
-     *
-     * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMAGINARY(complexNumber)
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $complexNumber    The complex number for which you want the imaginary
-     *                                         coefficient.
-     * @return    float
-     */
-    public static function IMAGINARY($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-        return $parsedComplex['imaginary'];
-    }
-
-
-    /**
-     * IMREAL
-     *
-     * Returns the real coefficient of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMREAL(complexNumber)
-     *
-     * @access    public
-     * @category Engineering Functions
-     * @param    string        $complexNumber    The complex number for which you want the real coefficient.
-     * @return    float
-     */
-    public static function IMREAL($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-        return $parsedComplex['real'];
-    }
-
-
-    /**
-     * IMABS
-     *
-     * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMABS(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the absolute value.
-     * @return    float
-     */
-    public static function IMABS($complexNumber)
-    {
-        $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        return sqrt(
-            ($parsedComplex['real'] * $parsedComplex['real']) +
-            ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])
-        );
-    }
-
-
-    /**
-     * IMARGUMENT
-     *
-     * Returns the argument theta of a complex number, i.e. the angle in radians from the real
-     * axis to the representation of the number in polar coordinates.
-     *
-     * Excel Function:
-     *        IMARGUMENT(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the argument theta.
-     * @return    float
-     */
-    public static function IMARGUMENT($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if ($parsedComplex['real'] == 0.0) {
-            if ($parsedComplex['imaginary'] == 0.0) {
-                return 0.0;
-            } elseif ($parsedComplex['imaginary'] < 0.0) {
-                return M_PI / -2;
-            } else {
-                return M_PI / 2;
-            }
-        } elseif ($parsedComplex['real'] > 0.0) {
-            return atan($parsedComplex['imaginary'] / $parsedComplex['real']);
-        } elseif ($parsedComplex['imaginary'] < 0.0) {
-            return 0 - (M_PI - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real'])));
-        } else {
-            return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real']));
-        }
-    }
-
-
-    /**
-     * IMCONJUGATE
-     *
-     * Returns the complex conjugate of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMCONJUGATE(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the conjugate.
-     * @return    string
-     */
-    public static function IMCONJUGATE($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if ($parsedComplex['imaginary'] == 0.0) {
-            return $parsedComplex['real'];
-        } else {
-            return self::cleanComplex(
-                self::COMPLEX(
-                    $parsedComplex['real'],
-                    0 - $parsedComplex['imaginary'],
-                    $parsedComplex['suffix']
-                )
-            );
-        }
-    }
-
-
-    /**
-     * IMCOS
-     *
-     * Returns the cosine of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMCOS(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the cosine.
-     * @return    string|float
-     */
-    public static function IMCOS($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if ($parsedComplex['imaginary'] == 0.0) {
-            return cos($parsedComplex['real']);
-        } else {
-            return self::IMCONJUGATE(
-                self::COMPLEX(
-                    cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),
-                    sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),
-                    $parsedComplex['suffix']
-                )
-            );
-        }
-    }
-
-
-    /**
-     * IMSIN
-     *
-     * Returns the sine of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMSIN(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the sine.
-     * @return    string|float
-     */
-    public static function IMSIN($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if ($parsedComplex['imaginary'] == 0.0) {
-            return sin($parsedComplex['real']);
-        } else {
-            return self::COMPLEX(
-                sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),
-                cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),
-                $parsedComplex['suffix']
-            );
-        }
-    }
-
-
-    /**
-     * IMSQRT
-     *
-     * Returns the square root of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMSQRT(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the square root.
-     * @return    string
-     */
-    public static function IMSQRT($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        $theta = self::IMARGUMENT($complexNumber);
-        $d1 = cos($theta / 2);
-        $d2 = sin($theta / 2);
-        $r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
-
-        if ($parsedComplex['suffix'] == '') {
-            return self::COMPLEX($d1 * $r, $d2 * $r);
-        } else {
-            return self::COMPLEX($d1 * $r, $d2 * $r, $parsedComplex['suffix']);
-        }
-    }
-
-
-    /**
-     * IMLN
-     *
-     * Returns the natural logarithm of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMLN(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the natural logarithm.
-     * @return    string
-     */
-    public static function IMLN($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
-        $t = self::IMARGUMENT($complexNumber);
-
-        if ($parsedComplex['suffix'] == '') {
-            return self::COMPLEX($logR, $t);
-        } else {
-            return self::COMPLEX($logR, $t, $parsedComplex['suffix']);
-        }
-    }
-
-
-    /**
-     * IMLOG10
-     *
-     * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMLOG10(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the common logarithm.
-     * @return    string
-     */
-    public static function IMLOG10($complexNumber)
-    {
-        $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return log10($parsedComplex['real']);
-        }
-
-        return self::IMPRODUCT(log10(EULER), self::IMLN($complexNumber));
-    }
-
-
-    /**
-     * IMLOG2
-     *
-     * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMLOG2(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the base-2 logarithm.
-     * @return    string
-     */
-    public static function IMLOG2($complexNumber)
-    {
-        $complexNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return log($parsedComplex['real'], 2);
-        }
-
-        return self::IMPRODUCT(log(EULER, 2), self::IMLN($complexNumber));
-    }
-
-
-    /**
-     * IMEXP
-     *
-     * Returns the exponential of a complex number in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMEXP(complexNumber)
-     *
-     * @param    string        $complexNumber    The complex number for which you want the exponential.
-     * @return    string
-     */
-    public static function IMEXP($complexNumber)
-    {
-        $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
-            return '1';
-        }
-
-        $e = exp($parsedComplex['real']);
-        $eX = $e * cos($parsedComplex['imaginary']);
-        $eY = $e * sin($parsedComplex['imaginary']);
-
-        if ($parsedComplex['suffix'] == '') {
-            return self::COMPLEX($eX, $eY);
-        } else {
-            return self::COMPLEX($eX, $eY, $parsedComplex['suffix']);
-        }
-    }
-
-
-    /**
-     * IMPOWER
-     *
-     * Returns a complex number in x + yi or x + yj text format raised to a power.
-     *
-     * Excel Function:
-     *        IMPOWER(complexNumber,realNumber)
-     *
-     * @param    string        $complexNumber    The complex number you want to raise to a power.
-     * @param    float        $realNumber        The power to which you want to raise the complex number.
-     * @return    string
-     */
-    public static function IMPOWER($complexNumber, $realNumber)
-    {
-        $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
-        $realNumber    = PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
-
-        if (!is_numeric($realNumber)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        $parsedComplex = self::parseComplex($complexNumber);
-
-        $r = sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
-        $rPower = pow($r, $realNumber);
-        $theta = self::IMARGUMENT($complexNumber) * $realNumber;
-        if ($theta == 0) {
-            return 1;
-        } elseif ($parsedComplex['imaginary'] == 0.0) {
-            return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']);
-        } else {
-            return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']);
-        }
-    }
-
-
-    /**
-     * IMDIV
-     *
-     * Returns the quotient of two complex numbers in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMDIV(complexDividend,complexDivisor)
-     *
-     * @param    string        $complexDividend    The complex numerator or dividend.
-     * @param    string        $complexDivisor        The complex denominator or divisor.
-     * @return    string
-     */
-    public static function IMDIV($complexDividend, $complexDivisor)
-    {
-        $complexDividend    = PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
-        $complexDivisor    = PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
-
-        $parsedComplexDividend = self::parseComplex($complexDividend);
-        $parsedComplexDivisor = self::parseComplex($complexDivisor);
-
-        if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') &&
-            ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
-            $parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix'];
-        }
-
-        $d1 = ($parsedComplexDividend['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['imaginary']);
-        $d2 = ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['real']) - ($parsedComplexDividend['real'] * $parsedComplexDivisor['imaginary']);
-        $d3 = ($parsedComplexDivisor['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDivisor['imaginary'] * $parsedComplexDivisor['imaginary']);
-
-        $r = $d1 / $d3;
-        $i = $d2 / $d3;
-
-        if ($i > 0.0) {
-            return self::cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']);
-        } elseif ($i < 0.0) {
-            return self::cleanComplex($r.$i.$parsedComplexDivisor['suffix']);
-        } else {
-            return $r;
-        }
-    }
-
-
-    /**
-     * IMSUB
-     *
-     * Returns the difference of two complex numbers in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMSUB(complexNumber1,complexNumber2)
-     *
-     * @param    string        $complexNumber1        The complex number from which to subtract complexNumber2.
-     * @param    string        $complexNumber2        The complex number to subtract from complexNumber1.
-     * @return    string
-     */
-    public static function IMSUB($complexNumber1, $complexNumber2)
-    {
-        $complexNumber1    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1);
-        $complexNumber2    = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2);
-
-        $parsedComplex1 = self::parseComplex($complexNumber1);
-        $parsedComplex2 = self::parseComplex($complexNumber2);
-
-        if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) &&
-            ($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
-            $parsedComplex1['suffix'] = $parsedComplex2['suffix'];
-        }
-
-        $d1 = $parsedComplex1['real'] - $parsedComplex2['real'];
-        $d2 = $parsedComplex1['imaginary'] - $parsedComplex2['imaginary'];
-
-        return self::COMPLEX($d1, $d2, $parsedComplex1['suffix']);
-    }
-
-
-    /**
-     * IMSUM
-     *
-     * Returns the sum of two or more complex numbers in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMSUM(complexNumber[,complexNumber[,...]])
-     *
-     * @param    string        $complexNumber,...    Series of complex numbers to add
-     * @return    string
-     */
-    public static function IMSUM()
-    {
-        // Return value
-        $returnValue = self::parseComplex('0');
-        $activeSuffix = '';
-
-        // Loop through the arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            $parsedComplex = self::parseComplex($arg);
-
-            if ($activeSuffix == '') {
-                $activeSuffix = $parsedComplex['suffix'];
-            } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-
-            $returnValue['real'] += $parsedComplex['real'];
-            $returnValue['imaginary'] += $parsedComplex['imaginary'];
-        }
-
-        if ($returnValue['imaginary'] == 0.0) {
-            $activeSuffix = '';
-        }
-        return self::COMPLEX($returnValue['real'], $returnValue['imaginary'], $activeSuffix);
-    }
-
-
-    /**
-     * IMPRODUCT
-     *
-     * Returns the product of two or more complex numbers in x + yi or x + yj text format.
-     *
-     * Excel Function:
-     *        IMPRODUCT(complexNumber[,complexNumber[,...]])
-     *
-     * @param    string        $complexNumber,...    Series of complex numbers to multiply
-     * @return    string
-     */
-    public static function IMPRODUCT()
-    {
-        // Return value
-        $returnValue = self::parseComplex('1');
-        $activeSuffix = '';
-
-        // Loop through the arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            $parsedComplex = self::parseComplex($arg);
-
-            $workValue = $returnValue;
-            if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) {
-                $activeSuffix = $parsedComplex['suffix'];
-            } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']);
-            $returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']);
-        }
-
-        if ($returnValue['imaginary'] == 0.0) {
-            $activeSuffix = '';
-        }
-        return self::COMPLEX($returnValue['real'], $returnValue['imaginary'], $activeSuffix);
-    }
-
-
-    /**
-     *    DELTA
-     *
-     *    Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise.
-     *    Use this function to filter a set of values. For example, by summing several DELTA
-     *    functions you calculate the count of equal pairs. This function is also known as the
-     *    Kronecker Delta function.
-     *
-     *    Excel Function:
-     *        DELTA(a[,b])
-     *
-     *    @param    float        $a    The first number.
-     *    @param    float        $b    The second number. If omitted, b is assumed to be zero.
-     *    @return    int
-     */
-    public static function DELTA($a, $b = 0)
-    {
-        $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
-        $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
-
-        return (int) ($a == $b);
-    }
-
-
-    /**
-     *    GESTEP
-     *
-     *    Excel Function:
-     *        GESTEP(number[,step])
-     *
-     *    Returns 1 if number >= step; returns 0 (zero) otherwise
-     *    Use this function to filter a set of values. For example, by summing several GESTEP
-     *    functions you calculate the count of values that exceed a threshold.
-     *
-     *    @param    float        $number        The value to test against step.
-     *    @param    float        $step        The threshold value.
-     *                                    If you omit a value for step, GESTEP uses zero.
-     *    @return    int
-     */
-    public static function GESTEP($number, $step = 0)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $step    = PHPExcel_Calculation_Functions::flattenSingleValue($step);
-
-        return (int) ($number >= $step);
-    }
-
-
-    //
-    //    Private method to calculate the erf value
-    //
-    private static $twoSqrtPi = 1.128379167095512574;
-
-    public static function erfVal($x)
-    {
-        if (abs($x) > 2.2) {
-            return 1 - self::erfcVal($x);
-        }
-        $sum = $term = $x;
-        $xsqr = ($x * $x);
-        $j = 1;
-        do {
-            $term *= $xsqr / $j;
-            $sum -= $term / (2 * $j + 1);
-            ++$j;
-            $term *= $xsqr / $j;
-            $sum += $term / (2 * $j + 1);
-            ++$j;
-            if ($sum == 0.0) {
-                break;
-            }
-        } while (abs($term / $sum) > PRECISION);
-        return self::$twoSqrtPi * $sum;
-    }
-
-
-    /**
-     *    ERF
-     *
-     *    Returns the error function integrated between the lower and upper bound arguments.
-     *
-     *    Note: In Excel 2007 or earlier, if you input a negative value for the upper or lower bound arguments,
-     *            the function would return a #NUM! error. However, in Excel 2010, the function algorithm was
-     *            improved, so that it can now calculate the function for both positive and negative ranges.
-     *            PHPExcel follows Excel 2010 behaviour, and accepts nagative arguments.
-     *
-     *    Excel Function:
-     *        ERF(lower[,upper])
-     *
-     *    @param    float        $lower    lower bound for integrating ERF
-     *    @param    float        $upper    upper bound for integrating ERF.
-     *                                If omitted, ERF integrates between zero and lower_limit
-     *    @return    float
-     */
-    public static function ERF($lower, $upper = null)
-    {
-        $lower    = PHPExcel_Calculation_Functions::flattenSingleValue($lower);
-        $upper    = PHPExcel_Calculation_Functions::flattenSingleValue($upper);
-
-        if (is_numeric($lower)) {
-            if (is_null($upper)) {
-                return self::erfVal($lower);
-            }
-            if (is_numeric($upper)) {
-                return self::erfVal($upper) - self::erfVal($lower);
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    //
-    //    Private method to calculate the erfc value
-    //
-    private static $oneSqrtPi = 0.564189583547756287;
-
-    private static function erfcVal($x)
-    {
-        if (abs($x) < 2.2) {
-            return 1 - self::erfVal($x);
-        }
-        if ($x < 0) {
-            return 2 - self::ERFC(-$x);
-        }
-        $a = $n = 1;
-        $b = $c = $x;
-        $d = ($x * $x) + 0.5;
-        $q1 = $q2 = $b / $d;
-        $t = 0;
-        do {
-            $t = $a * $n + $b * $x;
-            $a = $b;
-            $b = $t;
-            $t = $c * $n + $d * $x;
-            $c = $d;
-            $d = $t;
-            $n += 0.5;
-            $q1 = $q2;
-            $q2 = $b / $d;
-        } while ((abs($q1 - $q2) / $q2) > PRECISION);
-        return self::$oneSqrtPi * exp(-$x * $x) * $q2;
-    }
-
-
-    /**
-     *    ERFC
-     *
-     *    Returns the complementary ERF function integrated between x and infinity
-     *
-     *    Note: In Excel 2007 or earlier, if you input a negative value for the lower bound argument,
-     *        the function would return a #NUM! error. However, in Excel 2010, the function algorithm was
-     *        improved, so that it can now calculate the function for both positive and negative x values.
-     *            PHPExcel follows Excel 2010 behaviour, and accepts nagative arguments.
-     *
-     *    Excel Function:
-     *        ERFC(x)
-     *
-     *    @param    float    $x    The lower bound for integrating ERFC
-     *    @return    float
-     */
-    public static function ERFC($x)
-    {
-        $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-
-        if (is_numeric($x)) {
-            return self::erfcVal($x);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     *    getConversionGroups
-     *    Returns a list of the different conversion groups for UOM conversions
-     *
-     *    @return    array
-     */
-    public static function getConversionGroups()
-    {
-        $conversionGroups = array();
-        foreach (self::$conversionUnits as $conversionUnit) {
-            $conversionGroups[] = $conversionUnit['Group'];
-        }
-        return array_merge(array_unique($conversionGroups));
-    }
-
-
-    /**
-     *    getConversionGroupUnits
-     *    Returns an array of units of measure, for a specified conversion group, or for all groups
-     *
-     *    @param    string    $group    The group whose units of measure you want to retrieve
-     *    @return    array
-     */
-    public static function getConversionGroupUnits($group = null)
-    {
-        $conversionGroups = array();
-        foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) {
-            if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
-                $conversionGroups[$conversionGroup['Group']][] = $conversionUnit;
-            }
-        }
-        return $conversionGroups;
-    }
-
-
-    /**
-     *    getConversionGroupUnitDetails
-     *
-     *    @param    string    $group    The group whose units of measure you want to retrieve
-     *    @return    array
-     */
-    public static function getConversionGroupUnitDetails($group = null)
-    {
-        $conversionGroups = array();
-        foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) {
-            if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
-                $conversionGroups[$conversionGroup['Group']][] = array(
-                    'unit'        => $conversionUnit,
-                    'description' => $conversionGroup['Unit Name']
-                );
-            }
-        }
-        return $conversionGroups;
-    }
-
-
-    /**
-     *    getConversionMultipliers
-     *    Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM()
-     *
-     *    @return    array of mixed
-     */
-    public static function getConversionMultipliers()
-    {
-        return self::$conversionMultipliers;
-    }
-
-
-    /**
-     *    CONVERTUOM
-     *
-     *    Converts a number from one measurement system to another.
-     *    For example, CONVERT can translate a table of distances in miles to a table of distances
-     *    in kilometers.
-     *
-     *    Excel Function:
-     *        CONVERT(value,fromUOM,toUOM)
-     *
-     *    @param    float        $value        The value in fromUOM to convert.
-     *    @param    string        $fromUOM    The units for value.
-     *    @param    string        $toUOM        The units for the result.
-     *
-     *    @return    float
-     */
-    public static function CONVERTUOM($value, $fromUOM, $toUOM)
-    {
-        $value   = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $fromUOM = PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM);
-        $toUOM   = PHPExcel_Calculation_Functions::flattenSingleValue($toUOM);
-
-        if (!is_numeric($value)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $fromMultiplier = 1.0;
-        if (isset(self::$conversionUnits[$fromUOM])) {
-            $unitGroup1 = self::$conversionUnits[$fromUOM]['Group'];
-        } else {
-            $fromMultiplier = substr($fromUOM, 0, 1);
-            $fromUOM = substr($fromUOM, 1);
-            if (isset(self::$conversionMultipliers[$fromMultiplier])) {
-                $fromMultiplier = self::$conversionMultipliers[$fromMultiplier]['multiplier'];
-            } else {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            if ((isset(self::$conversionUnits[$fromUOM])) && (self::$conversionUnits[$fromUOM]['AllowPrefix'])) {
-                $unitGroup1 = self::$conversionUnits[$fromUOM]['Group'];
-            } else {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-        }
-        $value *= $fromMultiplier;
-
-        $toMultiplier = 1.0;
-        if (isset(self::$conversionUnits[$toUOM])) {
-            $unitGroup2 = self::$conversionUnits[$toUOM]['Group'];
-        } else {
-            $toMultiplier = substr($toUOM, 0, 1);
-            $toUOM = substr($toUOM, 1);
-            if (isset(self::$conversionMultipliers[$toMultiplier])) {
-                $toMultiplier = self::$conversionMultipliers[$toMultiplier]['multiplier'];
-            } else {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            if ((isset(self::$conversionUnits[$toUOM])) && (self::$conversionUnits[$toUOM]['AllowPrefix'])) {
-                $unitGroup2 = self::$conversionUnits[$toUOM]['Group'];
-            } else {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-        }
-        if ($unitGroup1 != $unitGroup2) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) {
-            //    We've already factored $fromMultiplier into the value, so we need
-            //        to reverse it again
-            return $value / $fromMultiplier;
-        } elseif ($unitGroup1 == 'Temperature') {
-            if (($fromUOM == 'F') || ($fromUOM == 'fah')) {
-                if (($toUOM == 'F') || ($toUOM == 'fah')) {
-                    return $value;
-                } else {
-                    $value = (($value - 32) / 1.8);
-                    if (($toUOM == 'K') || ($toUOM == 'kel')) {
-                        $value += 273.15;
-                    }
-                    return $value;
-                }
-            } elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) &&
-                      (($toUOM == 'K') || ($toUOM == 'kel'))) {
-                        return $value;
-            } elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) &&
-                      (($toUOM == 'C') || ($toUOM == 'cel'))) {
-                    return $value;
-            }
-            if (($toUOM == 'F') || ($toUOM == 'fah')) {
-                if (($fromUOM == 'K') || ($fromUOM == 'kel')) {
-                    $value -= 273.15;
-                }
-                return ($value * 1.8) + 32;
-            }
-            if (($toUOM == 'C') || ($toUOM == 'cel')) {
-                return $value - 273.15;
-            }
-            return $value + 273.15;
-        }
-        return ($value * self::$unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier;
-    }
-}

+ 0 - 46
libs/PHPExcel/PHPExcel/Calculation/Exception.php

xqd
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Calculation_Exception
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Exception extends PHPExcel_Exception
-{
-    /**
-     * Error handler callback
-     *
-     * @param mixed $code
-     * @param mixed $string
-     * @param mixed $file
-     * @param mixed $line
-     * @param mixed $context
-     */
-    public static function errorHandlerCallback($code, $string, $file, $line, $context)
-    {
-        $e = new self($string, $code);
-        $e->line = $line;
-        $e->file = $file;
-        throw $e;
-    }
-}

+ 0 - 45
libs/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php

xqd
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Calculation_ExceptionHandler
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_ExceptionHandler
-{
-    /**
-     * Register errorhandler
-     */
-    public function __construct()
-    {
-        set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
-    }
-
-    /**
-     * Unregister errorhandler
-     */
-    public function __destruct()
-    {
-        restore_error_handler();
-    }
-}

+ 0 - 2359
libs/PHPExcel/PHPExcel/Calculation/Financial.php

xqd
@@ -1,2359 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/** FINANCIAL_MAX_ITERATIONS */
-define('FINANCIAL_MAX_ITERATIONS', 128);
-
-/** FINANCIAL_PRECISION */
-define('FINANCIAL_PRECISION', 1.0e-08);
-
-/**
- * PHPExcel_Calculation_Financial
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Financial
-{
-    /**
-     * isLastDayOfMonth
-     *
-     * Returns a boolean TRUE/FALSE indicating if this date is the last date of the month
-     *
-     * @param    DateTime    $testDate    The date for testing
-     * @return    boolean
-     */
-    private static function isLastDayOfMonth($testDate)
-    {
-        return ($testDate->format('d') == $testDate->format('t'));
-    }
-
-
-    /**
-     * isFirstDayOfMonth
-     *
-     * Returns a boolean TRUE/FALSE indicating if this date is the first date of the month
-     *
-     * @param    DateTime    $testDate    The date for testing
-     * @return    boolean
-     */
-    private static function isFirstDayOfMonth($testDate)
-    {
-        return ($testDate->format('d') == 1);
-    }
-
-
-    private static function couponFirstPeriodDate($settlement, $maturity, $frequency, $next)
-    {
-        $months = 12 / $frequency;
-
-        $result = PHPExcel_Shared_Date::ExcelToPHPObject($maturity);
-        $eom = self::isLastDayOfMonth($result);
-
-        while ($settlement < PHPExcel_Shared_Date::PHPToExcel($result)) {
-            $result->modify('-'.$months.' months');
-        }
-        if ($next) {
-            $result->modify('+'.$months.' months');
-        }
-
-        if ($eom) {
-            $result->modify('-1 day');
-        }
-
-        return PHPExcel_Shared_Date::PHPToExcel($result);
-    }
-
-
-    private static function isValidFrequency($frequency)
-    {
-        if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) {
-            return true;
-        }
-        if ((PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) &&
-            (($frequency == 6) || ($frequency == 12))) {
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * daysPerYear
-     *
-     * Returns the number of days in a specified year, as defined by the "basis" value
-     *
-     * @param    integer        $year    The year against which we're testing
-     * @param   integer        $basis    The type of day count:
-     *                                    0 or omitted US (NASD)    360
-     *                                    1                        Actual (365 or 366 in a leap year)
-     *                                    2                        360
-     *                                    3                        365
-     *                                    4                        European 360
-     * @return    integer
-     */
-    private static function daysPerYear($year, $basis = 0)
-    {
-        switch ($basis) {
-            case 0:
-            case 2:
-            case 4:
-                $daysPerYear = 360;
-                break;
-            case 3:
-                $daysPerYear = 365;
-                break;
-            case 1:
-                $daysPerYear = (PHPExcel_Calculation_DateTime::isLeapYear($year)) ? 366 : 365;
-                break;
-            default:
-                return PHPExcel_Calculation_Functions::NaN();
-        }
-        return $daysPerYear;
-    }
-
-
-    private static function interestAndPrincipal($rate = 0, $per = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
-    {
-        $pmt = self::PMT($rate, $nper, $pv, $fv, $type);
-        $capital = $pv;
-        for ($i = 1; $i<= $per; ++$i) {
-            $interest = ($type && $i == 1) ? 0 : -$capital * $rate;
-            $principal = $pmt - $interest;
-            $capital += $principal;
-        }
-        return array($interest, $principal);
-    }
-
-
-    /**
-     * ACCRINT
-     *
-     * Returns the accrued interest for a security that pays periodic interest.
-     *
-     * Excel Function:
-     *        ACCRINT(issue,firstinterest,settlement,rate,par,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    $issue            The security's issue date.
-     * @param    mixed    $firstinterest    The security's first interest date.
-     * @param    mixed    $settlement        The security's settlement date.
-     *                                    The security settlement date is the date after the issue date
-     *                                    when the security is traded to the buyer.
-     * @param    float    $rate            The security's annual coupon rate.
-     * @param    float    $par            The security's par value.
-     *                                    If you omit par, ACCRINT uses $1,000.
-     * @param    integer    $frequency        the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer    $basis            The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0)
-    {
-        $issue        = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
-        $firstinterest    = PHPExcel_Calculation_Functions::flattenSingleValue($firstinterest);
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $rate        = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $par        = (is_null($par))        ? 1000 :    PHPExcel_Calculation_Functions::flattenSingleValue($par);
-        $frequency    = (is_null($frequency))    ? 1    :         PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis        = (is_null($basis))        ? 0    :        PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($rate)) && (is_numeric($par))) {
-            $rate    = (float) $rate;
-            $par    = (float) $par;
-            if (($rate <= 0) || ($par <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
-            if (!is_numeric($daysBetweenIssueAndSettlement)) {
-                //    return date error
-                return $daysBetweenIssueAndSettlement;
-            }
-
-            return $par * $rate * $daysBetweenIssueAndSettlement;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * ACCRINTM
-     *
-     * Returns the accrued interest for a security that pays interest at maturity.
-     *
-     * Excel Function:
-     *        ACCRINTM(issue,settlement,rate[,par[,basis]])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    issue        The security's issue date.
-     * @param    mixed    settlement    The security's settlement (or maturity) date.
-     * @param    float    rate        The security's annual coupon rate.
-     * @param    float    par            The security's par value.
-     *                                    If you omit par, ACCRINT uses $1,000.
-     * @param    integer    basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0)
-    {
-        $issue        = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $rate        = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $par        = (is_null($par))    ? 1000 :    PHPExcel_Calculation_Functions::flattenSingleValue($par);
-        $basis        = (is_null($basis))    ? 0 :        PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($rate)) && (is_numeric($par))) {
-            $rate    = (float) $rate;
-            $par    = (float) $par;
-            if (($rate <= 0) || ($par <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
-            if (!is_numeric($daysBetweenIssueAndSettlement)) {
-                //    return date error
-                return $daysBetweenIssueAndSettlement;
-            }
-            return $par * $rate * $daysBetweenIssueAndSettlement;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * AMORDEGRC
-     *
-     * Returns the depreciation for each accounting period.
-     * This function is provided for the French accounting system. If an asset is purchased in
-     * the middle of the accounting period, the prorated depreciation is taken into account.
-     * The function is similar to AMORLINC, except that a depreciation coefficient is applied in
-     * the calculation depending on the life of the assets.
-     * This function will return the depreciation until the last period of the life of the assets
-     * or until the cumulated value of depreciation is greater than the cost of the assets minus
-     * the salvage value.
-     *
-     * Excel Function:
-     *        AMORDEGRC(cost,purchased,firstPeriod,salvage,period,rate[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    cost        The cost of the asset.
-     * @param    mixed    purchased    Date of the purchase of the asset.
-     * @param    mixed    firstPeriod    Date of the end of the first period.
-     * @param    mixed    salvage        The salvage value at the end of the life of the asset.
-     * @param    float    period        The period.
-     * @param    float    rate        Rate of depreciation.
-     * @param    integer    basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
-    {
-        $cost            = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $purchased        = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
-        $firstPeriod    = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
-        $salvage        = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $period            = floor(PHPExcel_Calculation_Functions::flattenSingleValue($period));
-        $rate            = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $basis            = (is_null($basis))    ? 0 :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    The depreciation coefficients are:
-        //    Life of assets (1/rate)        Depreciation coefficient
-        //    Less than 3 years            1
-        //    Between 3 and 4 years        1.5
-        //    Between 5 and 6 years        2
-        //    More than 6 years            2.5
-        $fUsePer = 1.0 / $rate;
-        if ($fUsePer < 3.0) {
-            $amortiseCoeff = 1.0;
-        } elseif ($fUsePer < 5.0) {
-            $amortiseCoeff = 1.5;
-        } elseif ($fUsePer <= 6.0) {
-            $amortiseCoeff = 2.0;
-        } else {
-            $amortiseCoeff = 2.5;
-        }
-
-        $rate *= $amortiseCoeff;
-        $fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost, 0);
-        $cost -= $fNRate;
-        $fRest = $cost - $salvage;
-
-        for ($n = 0; $n < $period; ++$n) {
-            $fNRate = round($rate * $cost, 0);
-            $fRest -= $fNRate;
-
-            if ($fRest < 0.0) {
-                switch ($period - $n) {
-                    case 0:
-                    case 1:
-                        return round($cost * 0.5, 0);
-                    default:
-                        return 0.0;
-                }
-            }
-            $cost -= $fNRate;
-        }
-        return $fNRate;
-    }
-
-
-    /**
-     * AMORLINC
-     *
-     * Returns the depreciation for each accounting period.
-     * This function is provided for the French accounting system. If an asset is purchased in
-     * the middle of the accounting period, the prorated depreciation is taken into account.
-     *
-     * Excel Function:
-     *        AMORLINC(cost,purchased,firstPeriod,salvage,period,rate[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    cost        The cost of the asset.
-     * @param    mixed    purchased    Date of the purchase of the asset.
-     * @param    mixed    firstPeriod    Date of the end of the first period.
-     * @param    mixed    salvage        The salvage value at the end of the life of the asset.
-     * @param    float    period        The period.
-     * @param    float    rate        Rate of depreciation.
-     * @param    integer    basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
-    {
-        $cost        = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $purchased   = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
-        $firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
-        $salvage     = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $period      = PHPExcel_Calculation_Functions::flattenSingleValue($period);
-        $rate        = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $basis       = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        $fOneRate = $cost * $rate;
-        $fCostDelta = $cost - $salvage;
-        //    Note, quirky variation for leap years on the YEARFRAC for this function
-        $purchasedYear = PHPExcel_Calculation_DateTime::YEAR($purchased);
-        $yearFrac = PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis);
-
-        if (($basis == 1) && ($yearFrac < 1) && (PHPExcel_Calculation_DateTime::isLeapYear($purchasedYear))) {
-            $yearFrac *= 365 / 366;
-        }
-
-        $f0Rate = $yearFrac * $rate * $cost;
-        $nNumOfFullPeriods = intval(($cost - $salvage - $f0Rate) / $fOneRate);
-
-        if ($period == 0) {
-            return $f0Rate;
-        } elseif ($period <= $nNumOfFullPeriods) {
-            return $fOneRate;
-        } elseif ($period == ($nNumOfFullPeriods + 1)) {
-            return ($fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate);
-        } else {
-            return 0.0;
-        }
-    }
-
-
-    /**
-     * COUPDAYBS
-     *
-     * Returns the number of days from the beginning of the coupon period to the settlement date.
-     *
-     * Excel Function:
-     *        COUPDAYBS(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity   = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency  = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis      = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
-        $prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
-
-        return PHPExcel_Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear;
-    }
-
-
-    /**
-     * COUPDAYS
-     *
-     * Returns the number of days in the coupon period that contains the settlement date.
-     *
-     * Excel Function:
-     *        COUPDAYS(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity   = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency  = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis      = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        switch ($basis) {
-            case 3:
-                // Actual/365
-                return 365 / $frequency;
-            case 1:
-                // Actual/actual
-                if ($frequency == 1) {
-                    $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity), $basis);
-                    return ($daysPerYear / $frequency);
-                }
-                $prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
-                $next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
-                return ($next - $prev);
-            default:
-                // US (NASD) 30/360, Actual/360 or European 30/360
-                return 360 / $frequency;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * COUPDAYSNC
-     *
-     * Returns the number of days from the settlement date to the next coupon date.
-     *
-     * Excel Function:
-     *        COUPDAYSNC(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity   = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency  = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis      = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
-        $next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
-
-        return PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear;
-    }
-
-
-    /**
-     * COUPNCD
-     *
-     * Returns the next coupon date after the settlement date.
-     *
-     * Excel Function:
-     *        COUPNCD(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis        = (is_null($basis))    ? 0 :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
-    }
-
-
-    /**
-     * COUPNUM
-     *
-     * Returns the number of coupons payable between the settlement date and maturity date,
-     * rounded up to the nearest whole coupon.
-     *
-     * Excel Function:
-     *        COUPNUM(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    integer
-     */
-    public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis        = (is_null($basis))    ? 0 :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $settlement = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
-        $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis) * 365;
-
-        switch ($frequency) {
-            case 1: // annual payments
-                return ceil($daysBetweenSettlementAndMaturity / 360);
-            case 2: // half-yearly
-                return ceil($daysBetweenSettlementAndMaturity / 180);
-            case 4: // quarterly
-                return ceil($daysBetweenSettlementAndMaturity / 90);
-            case 6: // bimonthly
-                return ceil($daysBetweenSettlementAndMaturity / 60);
-            case 12: // monthly
-                return ceil($daysBetweenSettlementAndMaturity / 30);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * COUPPCD
-     *
-     * Returns the previous coupon date before the settlement date.
-     *
-     * Excel Function:
-     *        COUPPCD(settlement,maturity,frequency[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    frequency    the number of coupon payments per year.
-     *                                    Valid frequency values are:
-     *                                        1    Annual
-     *                                        2    Semi-Annual
-     *                                        4    Quarterly
-     *                                    If working in Gnumeric Mode, the following frequency options are
-     *                                    also available
-     *                                        6    Bimonthly
-     *                                        12    Monthly
-     * @param    integer        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    mixed    Excel date/time serial value, PHP date/time serial value or PHP date/time object,
-     *                        depending on the value of the ReturnDateType flag
-     */
-    public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $frequency    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis        = (is_null($basis))    ? 0 :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
-    }
-
-
-    /**
-     * CUMIPMT
-     *
-     * Returns the cumulative interest paid on a loan between the start and end periods.
-     *
-     * Excel Function:
-     *        CUMIPMT(rate,nper,pv,start,end[,type])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $rate    The Interest rate
-     * @param    integer    $nper    The total number of payment periods
-     * @param    float    $pv        Present Value
-     * @param    integer    $start    The first period in the calculation.
-     *                            Payment periods are numbered beginning with 1.
-     * @param    integer    $end    The last period in the calculation.
-     * @param    integer    $type    A number 0 or 1 and indicates when payments are due:
-     *                                0 or omitted    At the end of the period.
-     *                                1                At the beginning of the period.
-     * @return    float
-     */
-    public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $nper    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $start    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
-        $end    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
-        $type    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($start < 1 || $start > $end) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Calculate
-        $interest = 0;
-        for ($per = $start; $per <= $end; ++$per) {
-            $interest += self::IPMT($rate, $per, $nper, $pv, 0, $type);
-        }
-
-        return $interest;
-    }
-
-
-    /**
-     * CUMPRINC
-     *
-     * Returns the cumulative principal paid on a loan between the start and end periods.
-     *
-     * Excel Function:
-     *        CUMPRINC(rate,nper,pv,start,end[,type])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $rate    The Interest rate
-     * @param    integer    $nper    The total number of payment periods
-     * @param    float    $pv        Present Value
-     * @param    integer    $start    The first period in the calculation.
-     *                            Payment periods are numbered beginning with 1.
-     * @param    integer    $end    The last period in the calculation.
-     * @param    integer    $type    A number 0 or 1 and indicates when payments are due:
-     *                                0 or omitted    At the end of the period.
-     *                                1                At the beginning of the period.
-     * @return    float
-     */
-    public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $nper    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $start    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
-        $end    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
-        $type    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($start < 1 || $start > $end) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Calculate
-        $principal = 0;
-        for ($per = $start; $per <= $end; ++$per) {
-            $principal += self::PPMT($rate, $per, $nper, $pv, 0, $type);
-        }
-
-        return $principal;
-    }
-
-
-    /**
-     * DB
-     *
-     * Returns the depreciation of an asset for a specified period using the
-     * fixed-declining balance method.
-     * This form of depreciation is used if you want to get a higher depreciation value
-     * at the beginning of the depreciation (as opposed to linear depreciation). The
-     * depreciation value is reduced with every depreciation period by the depreciation
-     * already deducted from the initial cost.
-     *
-     * Excel Function:
-     *        DB(cost,salvage,life,period[,month])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    cost        Initial cost of the asset.
-     * @param    float    salvage        Value at the end of the depreciation.
-     *                                (Sometimes called the salvage value of the asset)
-     * @param    integer    life        Number of periods over which the asset is depreciated.
-     *                                (Sometimes called the useful life of the asset)
-     * @param    integer    period        The period for which you want to calculate the
-     *                                depreciation. Period must use the same units as life.
-     * @param    integer    month        Number of months in the first year. If month is omitted,
-     *                                it defaults to 12.
-     * @return    float
-     */
-    public static function DB($cost, $salvage, $life, $period, $month = 12)
-    {
-        $cost        = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $salvage    = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $life        = PHPExcel_Calculation_Functions::flattenSingleValue($life);
-        $period        = PHPExcel_Calculation_Functions::flattenSingleValue($period);
-        $month        = PHPExcel_Calculation_Functions::flattenSingleValue($month);
-
-        //    Validate
-        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
-            $cost    = (float) $cost;
-            $salvage = (float) $salvage;
-            $life    = (int) $life;
-            $period  = (int) $period;
-            $month   = (int) $month;
-            if ($cost == 0) {
-                return 0.0;
-            } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            //    Set Fixed Depreciation Rate
-            $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
-            $fixedDepreciationRate = round($fixedDepreciationRate, 3);
-
-            //    Loop through each period calculating the depreciation
-            $previousDepreciation = 0;
-            for ($per = 1; $per <= $period; ++$per) {
-                if ($per == 1) {
-                    $depreciation = $cost * $fixedDepreciationRate * $month / 12;
-                } elseif ($per == ($life + 1)) {
-                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12;
-                } else {
-                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate;
-                }
-                $previousDepreciation += $depreciation;
-            }
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                $depreciation = round($depreciation, 2);
-            }
-            return $depreciation;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * DDB
-     *
-     * Returns the depreciation of an asset for a specified period using the
-     * double-declining balance method or some other method you specify.
-     *
-     * Excel Function:
-     *        DDB(cost,salvage,life,period[,factor])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    cost        Initial cost of the asset.
-     * @param    float    salvage        Value at the end of the depreciation.
-     *                                (Sometimes called the salvage value of the asset)
-     * @param    integer    life        Number of periods over which the asset is depreciated.
-     *                                (Sometimes called the useful life of the asset)
-     * @param    integer    period        The period for which you want to calculate the
-     *                                depreciation. Period must use the same units as life.
-     * @param    float    factor        The rate at which the balance declines.
-     *                                If factor is omitted, it is assumed to be 2 (the
-     *                                double-declining balance method).
-     * @return    float
-     */
-    public static function DDB($cost, $salvage, $life, $period, $factor = 2.0)
-    {
-        $cost        = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $salvage    = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $life        = PHPExcel_Calculation_Functions::flattenSingleValue($life);
-        $period        = PHPExcel_Calculation_Functions::flattenSingleValue($period);
-        $factor        = PHPExcel_Calculation_Functions::flattenSingleValue($factor);
-
-        //    Validate
-        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) {
-            $cost    = (float) $cost;
-            $salvage = (float) $salvage;
-            $life    = (int) $life;
-            $period  = (int) $period;
-            $factor  = (float) $factor;
-            if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            //    Set Fixed Depreciation Rate
-            $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
-            $fixedDepreciationRate = round($fixedDepreciationRate, 3);
-
-            //    Loop through each period calculating the depreciation
-            $previousDepreciation = 0;
-            for ($per = 1; $per <= $period; ++$per) {
-                $depreciation = min(($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation));
-                $previousDepreciation += $depreciation;
-            }
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                $depreciation = round($depreciation, 2);
-            }
-            return $depreciation;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * DISC
-     *
-     * Returns the discount rate for a security.
-     *
-     * Excel Function:
-     *        DISC(settlement,maturity,price,redemption[,basis])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue
-     *                                date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    integer    price        The security's price per $100 face value.
-     * @param    integer    redemption    The security's redemption value per $100 face value.
-     * @param    integer    basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $price        = PHPExcel_Calculation_Functions::flattenSingleValue($price);
-        $redemption    = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
-        $basis        = PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) {
-            $price        = (float) $price;
-            $redemption    = (float) $redemption;
-            $basis        = (int) $basis;
-            if (($price <= 0) || ($redemption <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-
-            return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * DOLLARDE
-     *
-     * Converts a dollar price expressed as an integer part and a fraction
-     *        part into a dollar price expressed as a decimal number.
-     * Fractional dollar numbers are sometimes used for security prices.
-     *
-     * Excel Function:
-     *        DOLLARDE(fractional_dollar,fraction)
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $fractional_dollar    Fractional Dollar
-     * @param    integer    $fraction            Fraction
-     * @return    float
-     */
-    public static function DOLLARDE($fractional_dollar = null, $fraction = 0)
-    {
-        $fractional_dollar    = PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar);
-        $fraction            = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
-
-        // Validate parameters
-        if (is_null($fractional_dollar) || $fraction < 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($fraction == 0) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $dollars = floor($fractional_dollar);
-        $cents = fmod($fractional_dollar, 1);
-        $cents /= $fraction;
-        $cents *= pow(10, ceil(log10($fraction)));
-        return $dollars + $cents;
-    }
-
-
-    /**
-     * DOLLARFR
-     *
-     * Converts a dollar price expressed as a decimal number into a dollar price
-     *        expressed as a fraction.
-     * Fractional dollar numbers are sometimes used for security prices.
-     *
-     * Excel Function:
-     *        DOLLARFR(decimal_dollar,fraction)
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $decimal_dollar        Decimal Dollar
-     * @param    integer    $fraction            Fraction
-     * @return    float
-     */
-    public static function DOLLARFR($decimal_dollar = null, $fraction = 0)
-    {
-        $decimal_dollar    = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
-        $fraction        = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
-
-        // Validate parameters
-        if (is_null($decimal_dollar) || $fraction < 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($fraction == 0) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $dollars = floor($decimal_dollar);
-        $cents = fmod($decimal_dollar, 1);
-        $cents *= $fraction;
-        $cents *= pow(10, -ceil(log10($fraction)));
-        return $dollars + $cents;
-    }
-
-
-    /**
-     * EFFECT
-     *
-     * Returns the effective interest rate given the nominal rate and the number of
-     *        compounding payments per year.
-     *
-     * Excel Function:
-     *        EFFECT(nominal_rate,npery)
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $nominal_rate        Nominal interest rate
-     * @param    integer    $npery                Number of compounding payments per year
-     * @return    float
-     */
-    public static function EFFECT($nominal_rate = 0, $npery = 0)
-    {
-        $nominal_rate    = PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate);
-        $npery            = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
-
-        // Validate parameters
-        if ($nominal_rate <= 0 || $npery < 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        return pow((1 + $nominal_rate / $npery), $npery) - 1;
-    }
-
-
-    /**
-     * FV
-     *
-     * Returns the Future Value of a cash flow with constant payments and interest rate (annuities).
-     *
-     * Excel Function:
-     *        FV(rate,nper,pmt[,pv[,type]])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    $rate    The interest rate per period
-     * @param    int        $nper    Total number of payment periods in an annuity
-     * @param    float    $pmt    The payment made each period: it cannot change over the
-     *                            life of the annuity. Typically, pmt contains principal
-     *                            and interest but no other fees or taxes.
-     * @param    float    $pv        Present Value, or the lump-sum amount that a series of
-     *                            future payments is worth right now.
-     * @param    integer    $type    A number 0 or 1 and indicates when payments are due:
-     *                                0 or omitted    At the end of the period.
-     *                                1                At the beginning of the period.
-     * @return    float
-     */
-    public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $nper    = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pmt    = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $type    = PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Calculate
-        if (!is_null($rate) && $rate != 0) {
-            return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate;
-        }
-        return -$pv - $pmt * $nper;
-    }
-
-
-    /**
-     * FVSCHEDULE
-     *
-     * Returns the future value of an initial principal after applying a series of compound interest rates.
-     * Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
-     *
-     * Excel Function:
-     *        FVSCHEDULE(principal,schedule)
-     *
-     * @param    float    $principal    The present value.
-     * @param    float[]    $schedule    An array of interest rates to apply.
-     * @return    float
-     */
-    public static function FVSCHEDULE($principal, $schedule)
-    {
-        $principal    = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
-        $schedule    = PHPExcel_Calculation_Functions::flattenArray($schedule);
-
-        foreach ($schedule as $rate) {
-            $principal *= 1 + $rate;
-        }
-
-        return $principal;
-    }
-
-
-    /**
-     * INTRATE
-     *
-     * Returns the interest rate for a fully invested security.
-     *
-     * Excel Function:
-     *        INTRATE(settlement,maturity,investment,redemption[,basis])
-     *
-     * @param    mixed    $settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    $maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    integer    $investment    The amount invested in the security.
-     * @param    integer    $redemption    The amount to be received at maturity.
-     * @param    integer    $basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $investment    = PHPExcel_Calculation_Functions::flattenSingleValue($investment);
-        $redemption    = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
-        $basis        = PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) {
-            $investment    = (float) $investment;
-            $redemption    = (float) $redemption;
-            $basis        = (int) $basis;
-            if (($investment <= 0) || ($redemption <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-
-            return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * IPMT
-     *
-     * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
-     *
-     * Excel Function:
-     *        IPMT(rate,per,nper,pv[,fv][,type])
-     *
-     * @param    float    $rate    Interest rate per period
-     * @param    int        $per    Period for which we want to find the interest
-     * @param    int        $nper    Number of periods
-     * @param    float    $pv        Present Value
-     * @param    float    $fv        Future Value
-     * @param    int        $type    Payment type: 0 = at the end of each period, 1 = at the beginning of each period
-     * @return    float
-     */
-    public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $per    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per);
-        $nper    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $fv        = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($per <= 0 || $per > $nper) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Calculate
-        $interestAndPrincipal = self::interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type);
-        return $interestAndPrincipal[0];
-    }
-
-    /**
-     * IRR
-     *
-     * Returns the internal rate of return for a series of cash flows represented by the numbers in values.
-     * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
-     * at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
-     * for an investment consisting of payments (negative values) and income (positive values) that occur at regular
-     * periods.
-     *
-     * Excel Function:
-     *        IRR(values[,guess])
-     *
-     * @param    float[]    $values        An array or a reference to cells that contain numbers for which you want
-     *                                    to calculate the internal rate of return.
-     *                                Values must contain at least one positive value and one negative value to
-     *                                    calculate the internal rate of return.
-     * @param    float    $guess        A number that you guess is close to the result of IRR
-     * @return    float
-     */
-    public static function IRR($values, $guess = 0.1)
-    {
-        if (!is_array($values)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $values = PHPExcel_Calculation_Functions::flattenArray($values);
-        $guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
-
-        // create an initial range, with a root somewhere between 0 and guess
-        $x1 = 0.0;
-        $x2 = $guess;
-        $f1 = self::NPV($x1, $values);
-        $f2 = self::NPV($x2, $values);
-        for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
-            if (($f1 * $f2) < 0.0) {
-                break;
-            }
-            if (abs($f1) < abs($f2)) {
-                $f1 = self::NPV($x1 += 1.6 * ($x1 - $x2), $values);
-            } else {
-                $f2 = self::NPV($x2 += 1.6 * ($x2 - $x1), $values);
-            }
-        }
-        if (($f1 * $f2) > 0.0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        $f = self::NPV($x1, $values);
-        if ($f < 0.0) {
-            $rtb = $x1;
-            $dx = $x2 - $x1;
-        } else {
-            $rtb = $x2;
-            $dx = $x1 - $x2;
-        }
-
-        for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
-            $dx *= 0.5;
-            $x_mid = $rtb + $dx;
-            $f_mid = self::NPV($x_mid, $values);
-            if ($f_mid <= 0.0) {
-                $rtb = $x_mid;
-            }
-            if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) {
-                return $x_mid;
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * ISPMT
-     *
-     * Returns the interest payment for an investment based on an interest rate and a constant payment schedule.
-     *
-     * Excel Function:
-     *     =ISPMT(interest_rate, period, number_payments, PV)
-     *
-     * interest_rate is the interest rate for the investment
-     *
-     * period is the period to calculate the interest rate.  It must be betweeen 1 and number_payments.
-     *
-     * number_payments is the number of payments for the annuity
-     *
-     * PV is the loan amount or present value of the payments
-     */
-    public static function ISPMT()
-    {
-        // Return value
-        $returnValue = 0;
-
-        // Get the parameters
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        $interestRate = array_shift($aArgs);
-        $period = array_shift($aArgs);
-        $numberPeriods = array_shift($aArgs);
-        $principleRemaining = array_shift($aArgs);
-
-        // Calculate
-        $principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0);
-        for ($i=0; $i <= $period; ++$i) {
-            $returnValue = $interestRate * $principleRemaining * -1;
-            $principleRemaining -= $principlePayment;
-            // principle needs to be 0 after the last payment, don't let floating point screw it up
-            if ($i == $numberPeriods) {
-                $returnValue = 0;
-            }
-        }
-        return($returnValue);
-    }
-
-
-    /**
-     * MIRR
-     *
-     * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
-     *        the cost of the investment and the interest received on reinvestment of cash.
-     *
-     * Excel Function:
-     *        MIRR(values,finance_rate, reinvestment_rate)
-     *
-     * @param    float[]    $values                An array or a reference to cells that contain a series of payments and
-     *                                            income occurring at regular intervals.
-     *                                        Payments are negative value, income is positive values.
-     * @param    float    $finance_rate        The interest rate you pay on the money used in the cash flows
-     * @param    float    $reinvestment_rate    The interest rate you receive on the cash flows as you reinvest them
-     * @return    float
-     */
-    public static function MIRR($values, $finance_rate, $reinvestment_rate)
-    {
-        if (!is_array($values)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $values                = PHPExcel_Calculation_Functions::flattenArray($values);
-        $finance_rate        = PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate);
-        $reinvestment_rate    = PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
-        $n = count($values);
-
-        $rr = 1.0 + $reinvestment_rate;
-        $fr = 1.0 + $finance_rate;
-
-        $npv_pos = $npv_neg = 0.0;
-        foreach ($values as $i => $v) {
-            if ($v >= 0) {
-                $npv_pos += $v / pow($rr, $i);
-            } else {
-                $npv_neg += $v / pow($fr, $i);
-            }
-        }
-
-        if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        $mirr = pow((-$npv_pos * pow($rr, $n))
-                / ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0;
-
-        return (is_finite($mirr) ? $mirr : PHPExcel_Calculation_Functions::VALUE());
-    }
-
-
-    /**
-     * NOMINAL
-     *
-     * Returns the nominal interest rate given the effective rate and the number of compounding payments per year.
-     *
-     * @param    float    $effect_rate    Effective interest rate
-     * @param    int        $npery            Number of compounding payments per year
-     * @return    float
-     */
-    public static function NOMINAL($effect_rate = 0, $npery = 0)
-    {
-        $effect_rate    = PHPExcel_Calculation_Functions::flattenSingleValue($effect_rate);
-        $npery            = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
-
-        // Validate parameters
-        if ($effect_rate <= 0 || $npery < 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Calculate
-        return $npery * (pow($effect_rate + 1, 1 / $npery) - 1);
-    }
-
-
-    /**
-     * NPER
-     *
-     * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate.
-     *
-     * @param    float    $rate    Interest rate per period
-     * @param    int        $pmt    Periodic payment (annuity)
-     * @param    float    $pv        Present Value
-     * @param    float    $fv        Future Value
-     * @param    int        $type    Payment type: 0 = at the end of each period, 1 = at the beginning of each period
-     * @return    float
-     */
-    public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $pmt    = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $fv        = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Calculate
-        if (!is_null($rate) && $rate != 0) {
-            if ($pmt == 0 && $pv == 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate);
-        }
-        if ($pmt == 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return (-$pv -$fv) / $pmt;
-    }
-
-    /**
-     * NPV
-     *
-     * Returns the Net Present Value of a cash flow series given a discount rate.
-     *
-     * @return    float
-     */
-    public static function NPV()
-    {
-        // Return value
-        $returnValue = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $rate = array_shift($aArgs);
-        for ($i = 1; $i <= count($aArgs); ++$i) {
-            // Is it a numeric value?
-            if (is_numeric($aArgs[$i - 1])) {
-                $returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i);
-            }
-        }
-
-        // Return
-        return $returnValue;
-    }
-
-    /**
-     * PMT
-     *
-     * Returns the constant payment (annuity) for a cash flow with a constant interest rate.
-     *
-     * @param    float    $rate    Interest rate per period
-     * @param    int        $nper    Number of periods
-     * @param    float    $pv        Present Value
-     * @param    float    $fv        Future Value
-     * @param    int        $type    Payment type: 0 = at the end of each period, 1 = at the beginning of each period
-     * @return    float
-     */
-    public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $nper    = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $fv        = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Calculate
-        if (!is_null($rate) && $rate != 0) {
-            return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate);
-        }
-        return (-$pv - $fv) / $nper;
-    }
-
-
-    /**
-     * PPMT
-     *
-     * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
-     *
-     * @param    float    $rate    Interest rate per period
-     * @param    int        $per    Period for which we want to find the interest
-     * @param    int        $nper    Number of periods
-     * @param    float    $pv        Present Value
-     * @param    float    $fv        Future Value
-     * @param    int        $type    Payment type: 0 = at the end of each period, 1 = at the beginning of each period
-     * @return    float
-     */
-    public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $per    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per);
-        $nper    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $fv        = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ($per <= 0 || $per > $nper) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // Calculate
-        $interestAndPrincipal = self::interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type);
-        return $interestAndPrincipal[1];
-    }
-
-
-    public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $rate        = (float) PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $yield        = (float) PHPExcel_Calculation_Functions::flattenSingleValue($yield);
-        $redemption    = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
-        $frequency    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
-        $basis        = (is_null($basis))    ? 0 :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (($settlement > $maturity) ||
-            (!self::isValidFrequency($frequency)) ||
-            (($basis < 0) || ($basis > 4))) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $dsc = self::COUPDAYSNC($settlement, $maturity, $frequency, $basis);
-        $e = self::COUPDAYS($settlement, $maturity, $frequency, $basis);
-        $n = self::COUPNUM($settlement, $maturity, $frequency, $basis);
-        $a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis);
-
-        $baseYF    = 1.0 + ($yield / $frequency);
-        $rfp    = 100 * ($rate / $frequency);
-        $de    = $dsc / $e;
-
-        $result = $redemption / pow($baseYF, (--$n + $de));
-        for ($k = 0; $k <= $n; ++$k) {
-            $result += $rfp / (pow($baseYF, ($k + $de)));
-        }
-        $result -= $rfp * ($a / $e);
-
-        return $result;
-    }
-
-
-    /**
-     * PRICEDISC
-     *
-     * Returns the price per $100 face value of a discounted security.
-     *
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    int        discount    The security's discount rate.
-     * @param    int        redemption    The security's redemption value per $100 face value.
-     * @param    int        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $discount    = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
-        $redemption    = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
-        $basis        = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) {
-            if (($discount <= 0) || ($redemption <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-
-            return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * PRICEMAT
-     *
-     * Returns the price per $100 face value of a security that pays interest at maturity.
-     *
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security's settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    mixed    issue        The security's issue date.
-     * @param    int        rate        The security's interest rate at date of issue.
-     * @param    int        yield        The security's annual yield.
-     * @param    int        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $issue        = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
-        $rate        = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $yield        = PHPExcel_Calculation_Functions::flattenSingleValue($yield);
-        $basis        = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if (is_numeric($rate) && is_numeric($yield)) {
-            if (($rate <= 0) || ($yield <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
-            if (!is_numeric($daysPerYear)) {
-                return $daysPerYear;
-            }
-            $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
-            if (!is_numeric($daysBetweenIssueAndSettlement)) {
-                //    return date error
-                return $daysBetweenIssueAndSettlement;
-            }
-            $daysBetweenIssueAndSettlement *= $daysPerYear;
-            $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
-            if (!is_numeric($daysBetweenIssueAndMaturity)) {
-                //    return date error
-                return $daysBetweenIssueAndMaturity;
-            }
-            $daysBetweenIssueAndMaturity *= $daysPerYear;
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-            $daysBetweenSettlementAndMaturity *= $daysPerYear;
-
-            return ((100 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate * 100)) /
-                   (1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) -
-                   (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * PV
-     *
-     * Returns the Present Value of a cash flow with constant payments and interest rate (annuities).
-     *
-     * @param    float    $rate    Interest rate per period
-     * @param    int        $nper    Number of periods
-     * @param    float    $pmt    Periodic payment (annuity)
-     * @param    float    $fv        Future Value
-     * @param    int        $type    Payment type: 0 = at the end of each period, 1 = at the beginning of each period
-     * @return    float
-     */
-    public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0)
-    {
-        $rate    = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $nper    = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pmt    = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
-        $fv        = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = PHPExcel_Calculation_Functions::flattenSingleValue($type);
-
-        // Validate parameters
-        if ($type != 0 && $type != 1) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // Calculate
-        if (!is_null($rate) && $rate != 0) {
-            return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper);
-        }
-        return -$fv - $pmt * $nper;
-    }
-
-
-    /**
-     * RATE
-     *
-     * Returns the interest rate per period of an annuity.
-     * RATE is calculated by iteration and can have zero or more solutions.
-     * If the successive results of RATE do not converge to within 0.0000001 after 20 iterations,
-     * RATE returns the #NUM! error value.
-     *
-     * Excel Function:
-     *        RATE(nper,pmt,pv[,fv[,type[,guess]]])
-     *
-     * @access    public
-     * @category Financial Functions
-     * @param    float    nper        The total number of payment periods in an annuity.
-     * @param    float    pmt            The payment made each period and cannot change over the life
-     *                                    of the annuity.
-     *                                Typically, pmt includes principal and interest but no other
-     *                                    fees or taxes.
-     * @param    float    pv            The present value - the total amount that a series of future
-     *                                    payments is worth now.
-     * @param    float    fv            The future value, or a cash balance you want to attain after
-     *                                    the last payment is made. If fv is omitted, it is assumed
-     *                                    to be 0 (the future value of a loan, for example, is 0).
-     * @param    integer    type        A number 0 or 1 and indicates when payments are due:
-     *                                        0 or omitted    At the end of the period.
-     *                                        1                At the beginning of the period.
-     * @param    float    guess        Your guess for what the rate will be.
-     *                                    If you omit guess, it is assumed to be 10 percent.
-     * @return    float
-     **/
-    public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1)
-    {
-        $nper    = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
-        $pmt    = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
-        $pv        = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
-        $fv        = (is_null($fv))    ? 0.0    :    PHPExcel_Calculation_Functions::flattenSingleValue($fv);
-        $type    = (is_null($type))    ? 0        :    (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
-        $guess    = (is_null($guess))    ? 0.1    :    PHPExcel_Calculation_Functions::flattenSingleValue($guess);
-
-        $rate = $guess;
-        if (abs($rate) < FINANCIAL_PRECISION) {
-            $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv;
-        } else {
-            $f = exp($nper * log(1 + $rate));
-            $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
-        }
-        $y0 = $pv + $pmt * $nper + $fv;
-        $y1 = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
-
-        // find root by secant method
-        $i  = $x0 = 0.0;
-        $x1 = $rate;
-        while ((abs($y0 - $y1) > FINANCIAL_PRECISION) && ($i < FINANCIAL_MAX_ITERATIONS)) {
-            $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0);
-            $x0 = $x1;
-            $x1 = $rate;
-            if (($nper * abs($pmt)) > ($pv - $fv)) {
-                $x1 = abs($x1);
-            }
-            if (abs($rate) < FINANCIAL_PRECISION) {
-                $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv;
-            } else {
-                $f = exp($nper * log(1 + $rate));
-                $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
-            }
-
-            $y0 = $y1;
-            $y1 = $y;
-            ++$i;
-        }
-        return $rate;
-    }
-
-
-    /**
-     * RECEIVED
-     *
-     * Returns the price per $100 face value of a discounted security.
-     *
-     * @param    mixed    settlement    The security's settlement date.
-     *                                The security settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    maturity    The security's maturity date.
-     *                                The maturity date is the date when the security expires.
-     * @param    int        investment    The amount invested in the security.
-     * @param    int        discount    The security's discount rate.
-     * @param    int        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $investment    = (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment);
-        $discount    = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
-        $basis        = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
-            if (($investment <= 0) || ($discount <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-
-            return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SLN
-     *
-     * Returns the straight-line depreciation of an asset for one period
-     *
-     * @param    cost        Initial cost of the asset
-     * @param    salvage        Value at the end of the depreciation
-     * @param    life        Number of periods over which the asset is depreciated
-     * @return    float
-     */
-    public static function SLN($cost, $salvage, $life)
-    {
-        $cost        = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $salvage    = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $life        = PHPExcel_Calculation_Functions::flattenSingleValue($life);
-
-        // Calculate
-        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) {
-            if ($life < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return ($cost - $salvage) / $life;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SYD
-     *
-     * Returns the sum-of-years' digits depreciation of an asset for a specified period.
-     *
-     * @param    cost        Initial cost of the asset
-     * @param    salvage        Value at the end of the depreciation
-     * @param    life        Number of periods over which the asset is depreciated
-     * @param    period        Period
-     * @return    float
-     */
-    public static function SYD($cost, $salvage, $life, $period)
-    {
-        $cost        = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
-        $salvage    = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
-        $life        = PHPExcel_Calculation_Functions::flattenSingleValue($life);
-        $period        = PHPExcel_Calculation_Functions::flattenSingleValue($period);
-
-        // Calculate
-        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) {
-            if (($life < 1) || ($period > $life)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * TBILLEQ
-     *
-     * Returns the bond-equivalent yield for a Treasury bill.
-     *
-     * @param    mixed    settlement    The Treasury bill's settlement date.
-     *                                The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
-     * @param    mixed    maturity    The Treasury bill's maturity date.
-     *                                The maturity date is the date when the Treasury bill expires.
-     * @param    int        discount    The Treasury bill's discount rate.
-     * @return    float
-     */
-    public static function TBILLEQ($settlement, $maturity, $discount)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $discount    = PHPExcel_Calculation_Functions::flattenSingleValue($discount);
-
-        //    Use TBILLPRICE for validation
-        $testValue = self::TBILLPRICE($settlement, $maturity, $discount);
-        if (is_string($testValue)) {
-            return $testValue;
-        }
-
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-            ++$maturity;
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
-        } else {
-            $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
-        }
-
-        return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity);
-    }
-
-
-    /**
-     * TBILLPRICE
-     *
-     * Returns the yield for a Treasury bill.
-     *
-     * @param    mixed    settlement    The Treasury bill's settlement date.
-     *                                The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
-     * @param    mixed    maturity    The Treasury bill's maturity date.
-     *                                The maturity date is the date when the Treasury bill expires.
-     * @param    int        discount    The Treasury bill's discount rate.
-     * @return    float
-     */
-    public static function TBILLPRICE($settlement, $maturity, $discount)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $discount    = PHPExcel_Calculation_Functions::flattenSingleValue($discount);
-
-        if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        //    Validate
-        if (is_numeric($discount)) {
-            if ($discount <= 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                ++$maturity;
-                $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
-                if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                    //    return date error
-                    return $daysBetweenSettlementAndMaturity;
-                }
-            } else {
-                $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
-            }
-
-            if ($daysBetweenSettlementAndMaturity > 360) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360));
-            if ($price <= 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return $price;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * TBILLYIELD
-     *
-     * Returns the yield for a Treasury bill.
-     *
-     * @param    mixed    settlement    The Treasury bill's settlement date.
-     *                                The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
-     * @param    mixed    maturity    The Treasury bill's maturity date.
-     *                                The maturity date is the date when the Treasury bill expires.
-     * @param    int        price        The Treasury bill's price per $100 face value.
-     * @return    float
-     */
-    public static function TBILLYIELD($settlement, $maturity, $price)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $price        = PHPExcel_Calculation_Functions::flattenSingleValue($price);
-
-        //    Validate
-        if (is_numeric($price)) {
-            if ($price <= 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                ++$maturity;
-                $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
-                if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                    //    return date error
-                    return $daysBetweenSettlementAndMaturity;
-                }
-            } else {
-                $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
-            }
-
-            if ($daysBetweenSettlementAndMaturity > 360) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    public static function XIRR($values, $dates, $guess = 0.1)
-    {
-        if ((!is_array($values)) && (!is_array($dates))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $values = PHPExcel_Calculation_Functions::flattenArray($values);
-        $dates  = PHPExcel_Calculation_Functions::flattenArray($dates);
-        $guess  = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
-        if (count($values) != count($dates)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        // create an initial range, with a root somewhere between 0 and guess
-        $x1 = 0.0;
-        $x2 = $guess;
-        $f1 = self::XNPV($x1, $values, $dates);
-        $f2 = self::XNPV($x2, $values, $dates);
-        for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
-            if (($f1 * $f2) < 0.0) {
-                break;
-            } elseif (abs($f1) < abs($f2)) {
-                $f1 = self::XNPV($x1 += 1.6 * ($x1 - $x2), $values, $dates);
-            } else {
-                $f2 = self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates);
-            }
-        }
-        if (($f1 * $f2) > 0.0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        $f = self::XNPV($x1, $values, $dates);
-        if ($f < 0.0) {
-            $rtb = $x1;
-            $dx = $x2 - $x1;
-        } else {
-            $rtb = $x2;
-            $dx = $x1 - $x2;
-        }
-
-        for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
-            $dx *= 0.5;
-            $x_mid = $rtb + $dx;
-            $f_mid = self::XNPV($x_mid, $values, $dates);
-            if ($f_mid <= 0.0) {
-                $rtb = $x_mid;
-            }
-            if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) {
-                return $x_mid;
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * XNPV
-     *
-     * Returns the net present value for a schedule of cash flows that is not necessarily periodic.
-     * To calculate the net present value for a series of cash flows that is periodic, use the NPV function.
-     *
-     * Excel Function:
-     *        =XNPV(rate,values,dates)
-     *
-     * @param    float            $rate        The discount rate to apply to the cash flows.
-     * @param    array of float    $values     A series of cash flows that corresponds to a schedule of payments in dates.
-     *                                         The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment.
-     *                                         If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year.
-     *                                         The series of values must contain at least one positive value and one negative value.
-     * @param    array of mixed    $dates      A schedule of payment dates that corresponds to the cash flow payments.
-     *                                         The first payment date indicates the beginning of the schedule of payments.
-     *                                         All other dates must be later than this date, but they may occur in any order.
-     * @return    float
-     */
-    public static function XNPV($rate, $values, $dates)
-    {
-        $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        if (!is_numeric($rate)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if ((!is_array($values)) || (!is_array($dates))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $values    = PHPExcel_Calculation_Functions::flattenArray($values);
-        $dates    = PHPExcel_Calculation_Functions::flattenArray($dates);
-        $valCount = count($values);
-        if ($valCount != count($dates)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        if ((min($values) > 0) || (max($values) < 0)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        $xnpv = 0.0;
-        for ($i = 0; $i < $valCount; ++$i) {
-            if (!is_numeric($values[$i])) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            $xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0], $dates[$i], 'd') / 365);
-        }
-        return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * YIELDDISC
-     *
-     * Returns the annual yield of a security that pays interest at maturity.
-     *
-     * @param    mixed    settlement      The security's settlement date.
-     *                                    The security's settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    maturity        The security's maturity date.
-     *                                    The maturity date is the date when the security expires.
-     * @param    int        price         The security's price per $100 face value.
-     * @param    int        redemption    The security's redemption value per $100 face value.
-     * @param    int        basis         The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $price        = PHPExcel_Calculation_Functions::flattenSingleValue($price);
-        $redemption    = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
-        $basis        = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if (is_numeric($price) && is_numeric($redemption)) {
-            if (($price <= 0) || ($redemption <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
-            if (!is_numeric($daysPerYear)) {
-                return $daysPerYear;
-            }
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-            $daysBetweenSettlementAndMaturity *= $daysPerYear;
-
-            return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * YIELDMAT
-     *
-     * Returns the annual yield of a security that pays interest at maturity.
-     *
-     * @param    mixed    settlement     The security's settlement date.
-     *                                   The security's settlement date is the date after the issue date when the security is traded to the buyer.
-     * @param    mixed    maturity       The security's maturity date.
-     *                                   The maturity date is the date when the security expires.
-     * @param    mixed    issue          The security's issue date.
-     * @param    int        rate         The security's interest rate at date of issue.
-     * @param    int        price        The security's price per $100 face value.
-     * @param    int        basis        The type of day count to use.
-     *                                        0 or omitted    US (NASD) 30/360
-     *                                        1                Actual/actual
-     *                                        2                Actual/360
-     *                                        3                Actual/365
-     *                                        4                European 30/360
-     * @return    float
-     */
-    public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
-    {
-        $settlement    = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
-        $maturity    = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
-        $issue        = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
-        $rate        = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
-        $price        = PHPExcel_Calculation_Functions::flattenSingleValue($price);
-        $basis        = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
-
-        //    Validate
-        if (is_numeric($rate) && is_numeric($price)) {
-            if (($rate <= 0) || ($price <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
-            if (!is_numeric($daysPerYear)) {
-                return $daysPerYear;
-            }
-            $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
-            if (!is_numeric($daysBetweenIssueAndSettlement)) {
-                //    return date error
-                return $daysBetweenIssueAndSettlement;
-            }
-            $daysBetweenIssueAndSettlement *= $daysPerYear;
-            $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
-            if (!is_numeric($daysBetweenIssueAndMaturity)) {
-                //    return date error
-                return $daysBetweenIssueAndMaturity;
-            }
-            $daysBetweenIssueAndMaturity *= $daysPerYear;
-            $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
-            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
-                //    return date error
-                return $daysBetweenSettlementAndMaturity;
-            }
-            $daysBetweenSettlementAndMaturity *= $daysPerYear;
-
-            return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) /
-                   (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
-                   ($daysPerYear / $daysBetweenSettlementAndMaturity);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-}

+ 0 - 622
libs/PHPExcel/PHPExcel/Calculation/FormulaParser.php

xqd
@@ -1,622 +0,0 @@
-<?php
-
-/*
-PARTLY BASED ON:
-    Copyright (c) 2007 E. W. Bachtal, Inc.
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-    and associated documentation files (the "Software"), to deal in the Software without restriction,
-    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-    subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial
-      portions of the Software.
-
-    The software is provided "as is", without warranty of any kind, express or implied, including but not
-    limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
-    no event shall the authors or copyright holders be liable for any claim, damages or other liability,
-    whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
-    software or the use or other dealings in the software.
-
-    http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
-    http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
-*/
-
-/**
- * PHPExcel_Calculation_FormulaParser
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-class PHPExcel_Calculation_FormulaParser
-{
-    /* Character constants */
-    const QUOTE_DOUBLE  = '"';
-    const QUOTE_SINGLE  = '\'';
-    const BRACKET_CLOSE = ']';
-    const BRACKET_OPEN  = '[';
-    const BRACE_OPEN    = '{';
-    const BRACE_CLOSE   = '}';
-    const PAREN_OPEN    = '(';
-    const PAREN_CLOSE   = ')';
-    const SEMICOLON     = ';';
-    const WHITESPACE    = ' ';
-    const COMMA         = ',';
-    const ERROR_START   = '#';
-
-    const OPERATORS_SN             = "+-";
-    const OPERATORS_INFIX         = "+-*/^&=><";
-    const OPERATORS_POSTFIX     = "%";
-
-    /**
-     * Formula
-     *
-     * @var string
-     */
-    private $formula;
-
-    /**
-     * Tokens
-     *
-     * @var PHPExcel_Calculation_FormulaToken[]
-     */
-    private $tokens = array();
-
-    /**
-     * Create a new PHPExcel_Calculation_FormulaParser
-     *
-     * @param     string        $pFormula    Formula to parse
-     * @throws     PHPExcel_Calculation_Exception
-     */
-    public function __construct($pFormula = '')
-    {
-        // Check parameters
-        if (is_null($pFormula)) {
-            throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
-        }
-
-        // Initialise values
-        $this->formula = trim($pFormula);
-        // Parse!
-        $this->parseToTokens();
-    }
-
-    /**
-     * Get Formula
-     *
-     * @return string
-     */
-    public function getFormula()
-    {
-        return $this->formula;
-    }
-
-    /**
-     * Get Token
-     *
-     * @param     int        $pId    Token id
-     * @return    string
-     * @throws  PHPExcel_Calculation_Exception
-     */
-    public function getToken($pId = 0)
-    {
-        if (isset($this->tokens[$pId])) {
-            return $this->tokens[$pId];
-        } else {
-            throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
-        }
-    }
-
-    /**
-     * Get Token count
-     *
-     * @return string
-     */
-    public function getTokenCount()
-    {
-        return count($this->tokens);
-    }
-
-    /**
-     * Get Tokens
-     *
-     * @return PHPExcel_Calculation_FormulaToken[]
-     */
-    public function getTokens()
-    {
-        return $this->tokens;
-    }
-
-    /**
-     * Parse to tokens
-     */
-    private function parseToTokens()
-    {
-        // No attempt is made to verify formulas; assumes formulas are derived from Excel, where
-        // they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
-
-        // Check if the formula has a valid starting =
-        $formulaLength = strlen($this->formula);
-        if ($formulaLength < 2 || $this->formula{0} != '=') {
-            return;
-        }
-
-        // Helper variables
-        $tokens1    = $tokens2     = $stack = array();
-        $inString    = $inPath     = $inRange     = $inError = false;
-        $token        = $previousToken    = $nextToken    = null;
-
-        $index    = 1;
-        $value    = '';
-
-        $ERRORS             = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
-        $COMPARATORS_MULTI     = array(">=", "<=", "<>");
-
-        while ($index < $formulaLength) {
-            // state-dependent character evaluation (order is important)
-
-            // double-quoted strings
-            // embeds are doubled
-            // end marks token
-            if ($inString) {
-                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
-                    if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
-                        $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
-                        ++$index;
-                    } else {
-                        $inString = false;
-                        $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT);
-                        $value = "";
-                    }
-                } else {
-                    $value .= $this->formula{$index};
-                }
-                ++$index;
-                continue;
-            }
-
-            // single-quoted strings (links)
-            // embeds are double
-            // end does not mark a token
-            if ($inPath) {
-                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
-                    if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
-                        $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
-                        ++$index;
-                    } else {
-                        $inPath = false;
-                    }
-                } else {
-                    $value .= $this->formula{$index};
-                }
-                ++$index;
-                continue;
-            }
-
-            // bracked strings (R1C1 range index or linked workbook name)
-            // no embeds (changed to "()" by Excel)
-            // end does not mark a token
-            if ($inRange) {
-                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
-                    $inRange = false;
-                }
-                $value .= $this->formula{$index};
-                ++$index;
-                continue;
-            }
-
-            // error values
-            // end marks a token, determined from absolute list of values
-            if ($inError) {
-                $value .= $this->formula{$index};
-                ++$index;
-                if (in_array($value, $ERRORS)) {
-                    $inError = false;
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR);
-                    $value = "";
-                }
-                continue;
-            }
-
-            // scientific notation check
-            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) {
-                if (strlen($value) > 1) {
-                    if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
-                        $value .= $this->formula{$index};
-                        ++$index;
-                        continue;
-                    }
-                }
-            }
-
-            // independent character evaluation (order not important)
-
-            // establish state-dependent character evaluations
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
-                if (strlen($value > 0)) {
-                    // unexpected
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
-                    $value = "";
-                }
-                $inString = true;
-                ++$index;
-                continue;
-            }
-
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
-                if (strlen($value) > 0) {
-                    // unexpected
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
-                    $value = "";
-                }
-                $inPath = true;
-                ++$index;
-                continue;
-            }
-
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
-                $inRange = true;
-                $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
-                ++$index;
-                continue;
-            }
-
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
-                if (strlen($value) > 0) {
-                    // unexpected
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
-                    $value = "";
-                }
-                $inError = true;
-                $value .= PHPExcel_Calculation_FormulaParser::ERROR_START;
-                ++$index;
-                continue;
-            }
-
-            // mark start and end of arrays and array rows
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
-                if (strlen($value) > 0) {
-                    // unexpected
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
-                    $value = "";
-                }
-
-                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
-                $tokens1[] = $tmp;
-                $stack[] = clone $tmp;
-
-                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
-                $tokens1[] = $tmp;
-                $stack[] = clone $tmp;
-
-                ++$index;
-                continue;
-            }
-
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-
-                $tmp = array_pop($stack);
-                $tmp->setValue("");
-                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
-                $tokens1[] = $tmp;
-
-                $tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
-                $tokens1[] = $tmp;
-
-                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
-                $tokens1[] = $tmp;
-                $stack[] = clone $tmp;
-
-                ++$index;
-                continue;
-            }
-
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-
-                $tmp = array_pop($stack);
-                $tmp->setValue("");
-                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
-                $tokens1[] = $tmp;
-
-                $tmp = array_pop($stack);
-                $tmp->setValue("");
-                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
-                $tokens1[] = $tmp;
-
-                ++$index;
-                continue;
-            }
-
-            // trim white-space
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-                $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
-                ++$index;
-                while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
-                    ++$index;
-                }
-                continue;
-            }
-
-            // multi-character comparators
-            if (($index + 2) <= $formulaLength) {
-                if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) {
-                    if (strlen($value) > 0) {
-                        $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                        $value = "";
-                    }
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
-                    $index += 2;
-                    continue;
-                }
-            }
-
-            // standard infix operators
-            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) {
-                if (strlen($value) > 0) {
-                    $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-                $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
-                ++$index;
-                continue;
-            }
-
-            // standard postfix operators (only one)
-            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-                $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
-                ++$index;
-                continue;
-            }
-
-            // start subexpression or function
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
-                if (strlen($value) > 0) {
-                    $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
-                    $tokens1[] = $tmp;
-                    $stack[] = clone $tmp;
-                    $value = "";
-                } else {
-                    $tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
-                    $tokens1[] = $tmp;
-                    $stack[] = clone $tmp;
-                }
-                ++$index;
-                continue;
-            }
-
-            // function, subexpression, or array parameters, or operand unions
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-
-                $tmp = array_pop($stack);
-                $tmp->setValue("");
-                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
-                $stack[] = $tmp;
-
-                if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION);
-                } else {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
-                }
-                ++$index;
-                continue;
-            }
-
-            // stop subexpression
-            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
-                if (strlen($value) > 0) {
-                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-                    $value = "";
-                }
-
-                $tmp = array_pop($stack);
-                $tmp->setValue("");
-                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
-                $tokens1[] = $tmp;
-
-                ++$index;
-                continue;
-            }
-
-            // token accumulation
-            $value .= $this->formula{$index};
-            ++$index;
-        }
-
-        // dump remaining accumulation
-        if (strlen($value) > 0) {
-            $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
-        }
-
-        // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections
-        $tokenCount = count($tokens1);
-        for ($i = 0; $i < $tokenCount; ++$i) {
-            $token = $tokens1[$i];
-            if (isset($tokens1[$i - 1])) {
-                $previousToken = $tokens1[$i - 1];
-            } else {
-                $previousToken = null;
-            }
-            if (isset($tokens1[$i + 1])) {
-                $nextToken = $tokens1[$i + 1];
-            } else {
-                $nextToken = null;
-            }
-
-            if (is_null($token)) {
-                continue;
-            }
-
-            if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) {
-                $tokens2[] = $token;
-                continue;
-            }
-
-            if (is_null($previousToken)) {
-                continue;
-            }
-
-            if (! (
-                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
-                  ) ) {
-                continue;
-            }
-
-            if (is_null($nextToken)) {
-                continue;
-            }
-
-            if (! (
-                    (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
-                    (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
-                    ($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
-                  ) ) {
-                continue;
-            }
-
-            $tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION);
-        }
-
-        // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators
-        // to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names
-        $this->tokens = array();
-
-        $tokenCount = count($tokens2);
-        for ($i = 0; $i < $tokenCount; ++$i) {
-            $token = $tokens2[$i];
-            if (isset($tokens2[$i - 1])) {
-                $previousToken = $tokens2[$i - 1];
-            } else {
-                $previousToken = null;
-            }
-            if (isset($tokens2[$i + 1])) {
-                $nextToken = $tokens2[$i + 1];
-            } else {
-                $nextToken = null;
-            }
-
-            if (is_null($token)) {
-                continue;
-            }
-
-            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
-                if ($i == 0) {
-                    $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
-                } elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
-                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
-                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
-                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
-                } else {
-                    $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
-                }
-
-                $this->tokens[] = $token;
-                continue;
-            }
-
-            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
-                if ($i == 0) {
-                    continue;
-                } elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
-                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
-                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
-                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
-                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
-                } else {
-                    continue;
-                }
-
-                $this->tokens[] = $token;
-                continue;
-            }
-
-            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
-                $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
-                if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
-                } elseif ($token->getValue() == "&") {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
-                } else {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
-                }
-
-                $this->tokens[] = $token;
-                continue;
-            }
-
-            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND &&
-                $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
-                if (!is_numeric($token->getValue())) {
-                    if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
-                        $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
-                    } else {
-                        $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE);
-                    }
-                } else {
-                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER);
-                }
-
-                $this->tokens[] = $token;
-                continue;
-            }
-
-            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
-                if (strlen($token->getValue() > 0)) {
-                    if (substr($token->getValue(), 0, 1) == "@") {
-                        $token->setValue(substr($token->getValue(), 1));
-                    }
-                }
-            }
-
-            $this->tokens[] = $token;
-        }
-    }
-}

+ 0 - 176
libs/PHPExcel/PHPExcel/Calculation/FormulaToken.php

xqd
@@ -1,176 +0,0 @@
-<?php
-
-/*
-PARTLY BASED ON:
-    Copyright (c) 2007 E. W. Bachtal, Inc.
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-    and associated documentation files (the "Software"), to deal in the Software without restriction,
-    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-    subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial
-      portions of the Software.
-
-    The software is provided "as is", without warranty of any kind, express or implied, including but not
-    limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
-    no event shall the authors or copyright holders be liable for any claim, damages or other liability,
-    whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
-    software or the use or other dealings in the software.
-
-    http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
-    http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
-*/
-
-/**
- * PHPExcel_Calculation_FormulaToken
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-class PHPExcel_Calculation_FormulaToken
-{
-    /* Token types */
-    const TOKEN_TYPE_NOOP            = 'Noop';
-    const TOKEN_TYPE_OPERAND         = 'Operand';
-    const TOKEN_TYPE_FUNCTION        = 'Function';
-    const TOKEN_TYPE_SUBEXPRESSION   = 'Subexpression';
-    const TOKEN_TYPE_ARGUMENT        = 'Argument';
-    const TOKEN_TYPE_OPERATORPREFIX  = 'OperatorPrefix';
-    const TOKEN_TYPE_OPERATORINFIX   = 'OperatorInfix';
-    const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
-    const TOKEN_TYPE_WHITESPACE      = 'Whitespace';
-    const TOKEN_TYPE_UNKNOWN         = 'Unknown';
-
-    /* Token subtypes */
-    const TOKEN_SUBTYPE_NOTHING       = 'Nothing';
-    const TOKEN_SUBTYPE_START         = 'Start';
-    const TOKEN_SUBTYPE_STOP          = 'Stop';
-    const TOKEN_SUBTYPE_TEXT          = 'Text';
-    const TOKEN_SUBTYPE_NUMBER        = 'Number';
-    const TOKEN_SUBTYPE_LOGICAL       = 'Logical';
-    const TOKEN_SUBTYPE_ERROR         = 'Error';
-    const TOKEN_SUBTYPE_RANGE         = 'Range';
-    const TOKEN_SUBTYPE_MATH          = 'Math';
-    const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
-    const TOKEN_SUBTYPE_INTERSECTION  = 'Intersection';
-    const TOKEN_SUBTYPE_UNION         = 'Union';
-
-    /**
-     * Value
-     *
-     * @var string
-     */
-    private $value;
-
-    /**
-     * Token Type (represented by TOKEN_TYPE_*)
-     *
-     * @var string
-     */
-    private $tokenType;
-
-    /**
-     * Token SubType (represented by TOKEN_SUBTYPE_*)
-     *
-     * @var string
-     */
-    private $tokenSubType;
-
-    /**
-     * Create a new PHPExcel_Calculation_FormulaToken
-     *
-     * @param string    $pValue
-     * @param string    $pTokenType     Token type (represented by TOKEN_TYPE_*)
-     * @param string    $pTokenSubType     Token Subtype (represented by TOKEN_SUBTYPE_*)
-     */
-    public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
-    {
-        // Initialise values
-        $this->value       = $pValue;
-        $this->tokenType    = $pTokenType;
-        $this->tokenSubType = $pTokenSubType;
-    }
-
-    /**
-     * Get Value
-     *
-     * @return string
-     */
-    public function getValue()
-    {
-        return $this->value;
-    }
-
-    /**
-     * Set Value
-     *
-     * @param string    $value
-     */
-    public function setValue($value)
-    {
-        $this->value = $value;
-    }
-
-    /**
-     * Get Token Type (represented by TOKEN_TYPE_*)
-     *
-     * @return string
-     */
-    public function getTokenType()
-    {
-        return $this->tokenType;
-    }
-
-    /**
-     * Set Token Type
-     *
-     * @param string    $value
-     */
-    public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN)
-    {
-        $this->tokenType = $value;
-    }
-
-    /**
-     * Get Token SubType (represented by TOKEN_SUBTYPE_*)
-     *
-     * @return string
-     */
-    public function getTokenSubType()
-    {
-        return $this->tokenSubType;
-    }
-
-    /**
-     * Set Token SubType
-     *
-     * @param string    $value
-     */
-    public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
-    {
-        $this->tokenSubType = $value;
-    }
-}

+ 0 - 148
libs/PHPExcel/PHPExcel/Calculation/Function.php

xqd
@@ -1,148 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Calculation_Function
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Function
-{
-    /* Function categories */
-    const CATEGORY_CUBE                 = 'Cube';
-    const CATEGORY_DATABASE             = 'Database';
-    const CATEGORY_DATE_AND_TIME        = 'Date and Time';
-    const CATEGORY_ENGINEERING          = 'Engineering';
-    const CATEGORY_FINANCIAL            = 'Financial';
-    const CATEGORY_INFORMATION          = 'Information';
-    const CATEGORY_LOGICAL              = 'Logical';
-    const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
-    const CATEGORY_MATH_AND_TRIG        = 'Math and Trig';
-    const CATEGORY_STATISTICAL          = 'Statistical';
-    const CATEGORY_TEXT_AND_DATA        = 'Text and Data';
-
-    /**
-     * Category (represented by CATEGORY_*)
-     *
-     * @var string
-     */
-    private $category;
-
-    /**
-     * Excel name
-     *
-     * @var string
-     */
-    private $excelName;
-
-    /**
-     * PHPExcel name
-     *
-     * @var string
-     */
-    private $phpExcelName;
-
-    /**
-     * Create a new PHPExcel_Calculation_Function
-     *
-     * @param     string        $pCategory         Category (represented by CATEGORY_*)
-     * @param     string        $pExcelName        Excel function name
-     * @param     string        $pPHPExcelName    PHPExcel function mapping
-     * @throws     PHPExcel_Calculation_Exception
-     */
-    public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null)
-    {
-        if (($pCategory !== null) && ($pExcelName !== null) && ($pPHPExcelName !== null)) {
-            // Initialise values
-            $this->category     = $pCategory;
-            $this->excelName    = $pExcelName;
-            $this->phpExcelName = $pPHPExcelName;
-        } else {
-            throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
-        }
-    }
-
-    /**
-     * Get Category (represented by CATEGORY_*)
-     *
-     * @return string
-     */
-    public function getCategory()
-    {
-        return $this->category;
-    }
-
-    /**
-     * Set Category (represented by CATEGORY_*)
-     *
-     * @param     string        $value
-     * @throws     PHPExcel_Calculation_Exception
-     */
-    public function setCategory($value = null)
-    {
-        if (!is_null($value)) {
-            $this->category = $value;
-        } else {
-            throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
-        }
-    }
-
-    /**
-     * Get Excel name
-     *
-     * @return string
-     */
-    public function getExcelName()
-    {
-        return $this->excelName;
-    }
-
-    /**
-     * Set Excel name
-     *
-     * @param string    $value
-     */
-    public function setExcelName($value)
-    {
-        $this->excelName = $value;
-    }
-
-    /**
-     * Get PHPExcel name
-     *
-     * @return string
-     */
-    public function getPHPExcelName()
-    {
-        return $this->phpExcelName;
-    }
-
-    /**
-     * Set PHPExcel name
-     *
-     * @param string    $value
-     */
-    public function setPHPExcelName($value)
-    {
-        $this->phpExcelName = $value;
-    }
-}

+ 0 - 760
libs/PHPExcel/PHPExcel/Calculation/Functions.php

xqd
@@ -1,760 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-
-/** MAX_VALUE */
-define('MAX_VALUE', 1.2e308);
-
-/** 2 / PI */
-define('M_2DIVPI', 0.63661977236758134307553505349006);
-
-/** MAX_ITERATIONS */
-define('MAX_ITERATIONS', 256);
-
-/** PRECISION */
-define('PRECISION', 8.88E-016);
-
-
-/**
- * PHPExcel_Calculation_Functions
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Functions
-{
-
-    /** constants */
-    const COMPATIBILITY_EXCEL      = 'Excel';
-    const COMPATIBILITY_GNUMERIC   = 'Gnumeric';
-    const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc';
-
-    const RETURNDATE_PHP_NUMERIC = 'P';
-    const RETURNDATE_PHP_OBJECT  = 'O';
-    const RETURNDATE_EXCEL       = 'E';
-
-
-    /**
-     * Compatibility mode to use for error checking and responses
-     *
-     * @access    private
-     * @var string
-     */
-    protected static $compatibilityMode = self::COMPATIBILITY_EXCEL;
-
-    /**
-     * Data Type to use when returning date values
-     *
-     * @access    private
-     * @var string
-     */
-    protected static $returnDateType = self::RETURNDATE_EXCEL;
-
-    /**
-     * List of error codes
-     *
-     * @access    private
-     * @var array
-     */
-    protected static $errorCodes = array(
-        'null'           => '#NULL!',
-        'divisionbyzero' => '#DIV/0!',
-        'value'          => '#VALUE!',
-        'reference'      => '#REF!',
-        'name'           => '#NAME?',
-        'num'            => '#NUM!',
-        'na'             => '#N/A',
-        'gettingdata'    => '#GETTING_DATA'
-    );
-
-
-    /**
-     * Set the Compatibility Mode
-     *
-     * @access    public
-     * @category Function Configuration
-     * @param     string        $compatibilityMode        Compatibility Mode
-     *                                                Permitted values are:
-     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL            'Excel'
-     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC        'Gnumeric'
-     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE    'OpenOfficeCalc'
-     * @return     boolean    (Success or Failure)
-     */
-    public static function setCompatibilityMode($compatibilityMode)
-    {
-        if (($compatibilityMode == self::COMPATIBILITY_EXCEL) ||
-            ($compatibilityMode == self::COMPATIBILITY_GNUMERIC) ||
-            ($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) {
-            self::$compatibilityMode = $compatibilityMode;
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Return the current Compatibility Mode
-     *
-     * @access    public
-     * @category Function Configuration
-     * @return     string        Compatibility Mode
-     *                            Possible Return values are:
-     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL            'Excel'
-     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC        'Gnumeric'
-     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE    'OpenOfficeCalc'
-     */
-    public static function getCompatibilityMode()
-    {
-        return self::$compatibilityMode;
-    }
-
-
-    /**
-     * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
-     *
-     * @access    public
-     * @category Function Configuration
-     * @param     string    $returnDateType            Return Date Format
-     *                                                Permitted values are:
-     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC        'P'
-     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT        'O'
-     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_EXCEL            'E'
-     * @return     boolean                            Success or failure
-     */
-    public static function setReturnDateType($returnDateType)
-    {
-        if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) ||
-            ($returnDateType == self::RETURNDATE_PHP_OBJECT) ||
-            ($returnDateType == self::RETURNDATE_EXCEL)) {
-            self::$returnDateType = $returnDateType;
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
-     *
-     * @access    public
-     * @category Function Configuration
-     * @return     string        Return Date Format
-     *                            Possible Return values are:
-     *                                PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC        'P'
-     *                                PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT        'O'
-     *                                PHPExcel_Calculation_Functions::RETURNDATE_EXCEL            'E'
-     */
-    public static function getReturnDateType()
-    {
-        return self::$returnDateType;
-    }
-
-
-    /**
-     * DUMMY
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #Not Yet Implemented
-     */
-    public static function DUMMY()
-    {
-        return '#Not Yet Implemented';
-    }
-
-
-    /**
-     * DIV0
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #Not Yet Implemented
-     */
-    public static function DIV0()
-    {
-        return self::$errorCodes['divisionbyzero'];
-    }
-
-
-    /**
-     * NA
-     *
-     * Excel Function:
-     *        =NA()
-     *
-     * Returns the error value #N/A
-     *        #N/A is the error value that means "no value is available."
-     *
-     * @access    public
-     * @category Logical Functions
-     * @return    string    #N/A!
-     */
-    public static function NA()
-    {
-        return self::$errorCodes['na'];
-    }
-
-
-    /**
-     * NaN
-     *
-     * Returns the error value #NUM!
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #NUM!
-     */
-    public static function NaN()
-    {
-        return self::$errorCodes['num'];
-    }
-
-
-    /**
-     * NAME
-     *
-     * Returns the error value #NAME?
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #NAME?
-     */
-    public static function NAME()
-    {
-        return self::$errorCodes['name'];
-    }
-
-
-    /**
-     * REF
-     *
-     * Returns the error value #REF!
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #REF!
-     */
-    public static function REF()
-    {
-        return self::$errorCodes['reference'];
-    }
-
-
-    /**
-     * NULL
-     *
-     * Returns the error value #NULL!
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #NULL!
-     */
-    public static function NULL()
-    {
-        return self::$errorCodes['null'];
-    }
-
-
-    /**
-     * VALUE
-     *
-     * Returns the error value #VALUE!
-     *
-     * @access    public
-     * @category Error Returns
-     * @return    string    #VALUE!
-     */
-    public static function VALUE()
-    {
-        return self::$errorCodes['value'];
-    }
-
-
-    public static function isMatrixValue($idx)
-    {
-        return ((substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0));
-    }
-
-
-    public static function isValue($idx)
-    {
-        return (substr_count($idx, '.') == 0);
-    }
-
-
-    public static function isCellValue($idx)
-    {
-        return (substr_count($idx, '.') > 1);
-    }
-
-
-    public static function ifCondition($condition)
-    {
-        $condition    = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
-        if (!isset($condition{0})) {
-            $condition = '=""';
-        }
-        if (!in_array($condition{0}, array('>', '<', '='))) {
-            if (!is_numeric($condition)) {
-                $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
-            }
-            return '=' . $condition;
-        } else {
-            preg_match('/([<>=]+)(.*)/', $condition, $matches);
-            list(, $operator, $operand) = $matches;
-
-            if (!is_numeric($operand)) {
-                $operand = str_replace('"', '""', $operand);
-                $operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
-            }
-
-            return $operator.$operand;
-        }
-    }
-
-    /**
-     * ERROR_TYPE
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function ERROR_TYPE($value = '')
-    {
-        $value = self::flattenSingleValue($value);
-
-        $i = 1;
-        foreach (self::$errorCodes as $errorCode) {
-            if ($value === $errorCode) {
-                return $i;
-            }
-            ++$i;
-        }
-        return self::NA();
-    }
-
-
-    /**
-     * IS_BLANK
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_BLANK($value = null)
-    {
-        if (!is_null($value)) {
-            $value    = self::flattenSingleValue($value);
-        }
-
-        return is_null($value);
-    }
-
-
-    /**
-     * IS_ERR
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_ERR($value = '')
-    {
-        $value = self::flattenSingleValue($value);
-
-        return self::IS_ERROR($value) && (!self::IS_NA($value));
-    }
-
-
-    /**
-     * IS_ERROR
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_ERROR($value = '')
-    {
-        $value = self::flattenSingleValue($value);
-
-        if (!is_string($value)) {
-            return false;
-        }
-        return in_array($value, array_values(self::$errorCodes));
-    }
-
-
-    /**
-     * IS_NA
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_NA($value = '')
-    {
-        $value = self::flattenSingleValue($value);
-
-        return ($value === self::NA());
-    }
-
-
-    /**
-     * IS_EVEN
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_EVEN($value = null)
-    {
-        $value = self::flattenSingleValue($value);
-
-        if ($value === null) {
-            return self::NAME();
-        } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
-            return self::VALUE();
-        }
-
-        return ($value % 2 == 0);
-    }
-
-
-    /**
-     * IS_ODD
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function IS_ODD($value = null)
-    {
-        $value = self::flattenSingleValue($value);
-
-        if ($value === null) {
-            return self::NAME();
-        } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
-            return self::VALUE();
-        }
-
-        return (abs($value) % 2 == 1);
-    }
-
-
-    /**
-     * IS_NUMBER
-     *
-     * @param    mixed    $value        Value to check
-     * @return    boolean
-     */
-    public static function IS_NUMBER($value = null)
-    {
-        $value = self::flattenSingleValue($value);
-
-        if (is_string($value)) {
-            return false;
-        }
-        return is_numeric($value);
-    }
-
-
-    /**
-     * IS_LOGICAL
-     *
-     * @param    mixed    $value        Value to check
-     * @return    boolean
-     */
-    public static function IS_LOGICAL($value = null)
-    {
-        $value = self::flattenSingleValue($value);
-
-        return is_bool($value);
-    }
-
-
-    /**
-     * IS_TEXT
-     *
-     * @param    mixed    $value        Value to check
-     * @return    boolean
-     */
-    public static function IS_TEXT($value = null)
-    {
-        $value = self::flattenSingleValue($value);
-
-        return (is_string($value) && !self::IS_ERROR($value));
-    }
-
-
-    /**
-     * IS_NONTEXT
-     *
-     * @param    mixed    $value        Value to check
-     * @return    boolean
-     */
-    public static function IS_NONTEXT($value = null)
-    {
-        return !self::IS_TEXT($value);
-    }
-
-
-    /**
-     * VERSION
-     *
-     * @return    string    Version information
-     */
-    public static function VERSION()
-    {
-        return 'PHPExcel ##VERSION##, ##DATE##';
-    }
-
-
-    /**
-     * N
-     *
-     * Returns a value converted to a number
-     *
-     * @param    value        The value you want converted
-     * @return    number        N converts values listed in the following table
-     *        If value is or refers to N returns
-     *        A number            That number
-     *        A date                The serial number of that date
-     *        TRUE                1
-     *        FALSE                0
-     *        An error value        The error value
-     *        Anything else        0
-     */
-    public static function N($value = null)
-    {
-        while (is_array($value)) {
-            $value = array_shift($value);
-        }
-
-        switch (gettype($value)) {
-            case 'double':
-            case 'float':
-            case 'integer':
-                return $value;
-            case 'boolean':
-                return (integer) $value;
-            case 'string':
-                //    Errors
-                if ((strlen($value) > 0) && ($value{0} == '#')) {
-                    return $value;
-                }
-                break;
-        }
-        return 0;
-    }
-
-
-    /**
-     * TYPE
-     *
-     * Returns a number that identifies the type of a value
-     *
-     * @param    value        The value you want tested
-     * @return    number        N converts values listed in the following table
-     *        If value is or refers to N returns
-     *        A number            1
-     *        Text                2
-     *        Logical Value        4
-     *        An error value        16
-     *        Array or Matrix        64
-     */
-    public static function TYPE($value = null)
-    {
-        $value = self::flattenArrayIndexed($value);
-        if (is_array($value) && (count($value) > 1)) {
-            end($value);
-            $a = key($value);
-            //    Range of cells is an error
-            if (self::isCellValue($a)) {
-                return 16;
-            //    Test for Matrix
-            } elseif (self::isMatrixValue($a)) {
-                return 64;
-            }
-        } elseif (empty($value)) {
-            //    Empty Cell
-            return 1;
-        }
-        $value = self::flattenSingleValue($value);
-
-        if (($value === null) || (is_float($value)) || (is_int($value))) {
-                return 1;
-        } elseif (is_bool($value)) {
-                return 4;
-        } elseif (is_array($value)) {
-                return 64;
-        } elseif (is_string($value)) {
-            //    Errors
-            if ((strlen($value) > 0) && ($value{0} == '#')) {
-                return 16;
-            }
-            return 2;
-        }
-        return 0;
-    }
-
-
-    /**
-     * Convert a multi-dimensional array to a simple 1-dimensional array
-     *
-     * @param    array    $array    Array to be flattened
-     * @return    array    Flattened array
-     */
-    public static function flattenArray($array)
-    {
-        if (!is_array($array)) {
-            return (array) $array;
-        }
-
-        $arrayValues = array();
-        foreach ($array as $value) {
-            if (is_array($value)) {
-                foreach ($value as $val) {
-                    if (is_array($val)) {
-                        foreach ($val as $v) {
-                            $arrayValues[] = $v;
-                        }
-                    } else {
-                        $arrayValues[] = $val;
-                    }
-                }
-            } else {
-                $arrayValues[] = $value;
-            }
-        }
-
-        return $arrayValues;
-    }
-
-
-    /**
-     * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing
-     *
-     * @param    array    $array    Array to be flattened
-     * @return    array    Flattened array
-     */
-    public static function flattenArrayIndexed($array)
-    {
-        if (!is_array($array)) {
-            return (array) $array;
-        }
-
-        $arrayValues = array();
-        foreach ($array as $k1 => $value) {
-            if (is_array($value)) {
-                foreach ($value as $k2 => $val) {
-                    if (is_array($val)) {
-                        foreach ($val as $k3 => $v) {
-                            $arrayValues[$k1.'.'.$k2.'.'.$k3] = $v;
-                        }
-                    } else {
-                        $arrayValues[$k1.'.'.$k2] = $val;
-                    }
-                }
-            } else {
-                $arrayValues[$k1] = $value;
-            }
-        }
-
-        return $arrayValues;
-    }
-
-
-    /**
-     * Convert an array to a single scalar value by extracting the first element
-     *
-     * @param    mixed        $value        Array or scalar value
-     * @return    mixed
-     */
-    public static function flattenSingleValue($value = '')
-    {
-        while (is_array($value)) {
-            $value = array_pop($value);
-        }
-
-        return $value;
-    }
-}
-
-
-//
-//    There are a few mathematical functions that aren't available on all versions of PHP for all platforms
-//    These functions aren't available in Windows implementations of PHP prior to version 5.3.0
-//    So we test if they do exist for this version of PHP/operating platform; and if not we create them
-//
-if (!function_exists('acosh')) {
-    function acosh($x)
-    {
-        return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2));
-    }    //    function acosh()
-}
-
-if (!function_exists('asinh')) {
-    function asinh($x)
-    {
-        return log($x + sqrt(1 + $x * $x));
-    }    //    function asinh()
-}
-
-if (!function_exists('atanh')) {
-    function atanh($x)
-    {
-        return (log(1 + $x) - log(1 - $x)) / 2;
-    }    //    function atanh()
-}
-
-
-//
-//    Strangely, PHP doesn't have a mb_str_replace multibyte function
-//    As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set
-//
-if ((!function_exists('mb_str_replace')) &&
-    (function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) {
-    function mb_str_replace($search, $replace, $subject)
-    {
-        if (is_array($subject)) {
-            $ret = array();
-            foreach ($subject as $key => $val) {
-                $ret[$key] = mb_str_replace($search, $replace, $val);
-            }
-            return $ret;
-        }
-
-        foreach ((array) $search as $key => $s) {
-            if ($s == '' && $s !== 0) {
-                continue;
-            }
-            $r = !is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : '');
-            $pos = mb_strpos($subject, $s, 0, 'UTF-8');
-            while ($pos !== false) {
-                $subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8');
-                $pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8');
-            }
-        }
-        return $subject;
-    }
-}

+ 0 - 285
libs/PHPExcel/PHPExcel/Calculation/Logical.php

xqd
@@ -1,285 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_Logical
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Logical
-{
-    /**
-     * TRUE
-     *
-     * Returns the boolean TRUE.
-     *
-     * Excel Function:
-     *        =TRUE()
-     *
-     * @access    public
-     * @category Logical Functions
-     * @return    boolean        True
-     */
-    public static function TRUE()
-    {
-        return true;
-    }
-
-
-    /**
-     * FALSE
-     *
-     * Returns the boolean FALSE.
-     *
-     * Excel Function:
-     *        =FALSE()
-     *
-     * @access    public
-     * @category Logical Functions
-     * @return    boolean        False
-     */
-    public static function FALSE()
-    {
-        return false;
-    }
-
-
-    /**
-     * LOGICAL_AND
-     *
-     * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
-     *
-     * Excel Function:
-     *        =AND(logical1[,logical2[, ...]])
-     *
-     *        The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
-     *            or references that contain logical values.
-     *
-     *        Boolean arguments are treated as True or False as appropriate
-     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
-     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
-     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    boolean        The logical AND of the arguments.
-     */
-    public static function LOGICAL_AND()
-    {
-        // Return value
-        $returnValue = true;
-
-        // Loop through the arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        $argCount = -1;
-        foreach ($aArgs as $argCount => $arg) {
-            // Is it a boolean value?
-            if (is_bool($arg)) {
-                $returnValue = $returnValue && $arg;
-            } elseif ((is_numeric($arg)) && (!is_string($arg))) {
-                $returnValue = $returnValue && ($arg != 0);
-            } elseif (is_string($arg)) {
-                $arg = strtoupper($arg);
-                if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
-                    $arg = true;
-                } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
-                    $arg = false;
-                } else {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-                $returnValue = $returnValue && ($arg != 0);
-            }
-        }
-
-        // Return
-        if ($argCount < 0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * LOGICAL_OR
-     *
-     * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
-     *
-     * Excel Function:
-     *        =OR(logical1[,logical2[, ...]])
-     *
-     *        The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
-     *            or references that contain logical values.
-     *
-     *        Boolean arguments are treated as True or False as appropriate
-     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
-     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
-     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    boolean        The logical OR of the arguments.
-     */
-    public static function LOGICAL_OR()
-    {
-        // Return value
-        $returnValue = false;
-
-        // Loop through the arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        $argCount = -1;
-        foreach ($aArgs as $argCount => $arg) {
-            // Is it a boolean value?
-            if (is_bool($arg)) {
-                $returnValue = $returnValue || $arg;
-            } elseif ((is_numeric($arg)) && (!is_string($arg))) {
-                $returnValue = $returnValue || ($arg != 0);
-            } elseif (is_string($arg)) {
-                $arg = strtoupper($arg);
-                if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
-                    $arg = true;
-                } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
-                    $arg = false;
-                } else {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-                $returnValue = $returnValue || ($arg != 0);
-            }
-        }
-
-        // Return
-        if ($argCount < 0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * NOT
-     *
-     * Returns the boolean inverse of the argument.
-     *
-     * Excel Function:
-     *        =NOT(logical)
-     *
-     *        The argument must evaluate to a logical value such as TRUE or FALSE
-     *
-     *        Boolean arguments are treated as True or False as appropriate
-     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
-     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
-     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    mixed        $logical    A value or expression that can be evaluated to TRUE or FALSE
-     * @return    boolean        The boolean inverse of the argument.
-     */
-    public static function NOT($logical = false)
-    {
-        $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
-        if (is_string($logical)) {
-            $logical = strtoupper($logical);
-            if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
-                return false;
-            } elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
-                return true;
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-
-        return !$logical;
-    }
-
-    /**
-     * STATEMENT_IF
-     *
-     * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
-     *
-     * Excel Function:
-     *        =IF(condition[,returnIfTrue[,returnIfFalse]])
-     *
-     *        Condition is any value or expression that can be evaluated to TRUE or FALSE.
-     *            For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
-     *            the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
-     *            This argument can use any comparison calculation operator.
-     *        ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
-     *            For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
-     *            then the IF function returns the text "Within budget"
-     *            If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
-     *            the logical value TRUE for this argument.
-     *            ReturnIfTrue can be another formula.
-     *        ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
-     *            For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
-     *            then the IF function returns the text "Over budget".
-     *            If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
-     *            If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
-     *            ReturnIfFalse can be another formula.
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    mixed    $condition        Condition to evaluate
-     * @param    mixed    $returnIfTrue    Value to return when condition is true
-     * @param    mixed    $returnIfFalse    Optional value to return when condition is false
-     * @return    mixed    The value of returnIfTrue or returnIfFalse determined by condition
-     */
-    public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
-    {
-        $condition     = (is_null($condition))     ? true :  (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
-        $returnIfTrue  = (is_null($returnIfTrue))  ? 0 :     PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
-        $returnIfFalse = (is_null($returnIfFalse)) ? false : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
-
-        return ($condition) ? $returnIfTrue : $returnIfFalse;
-    }
-
-
-    /**
-     * IFERROR
-     *
-     * Excel Function:
-     *        =IFERROR(testValue,errorpart)
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    mixed    $testValue    Value to check, is also the value returned when no error
-     * @param    mixed    $errorpart    Value to return when testValue is an error condition
-     * @return    mixed    The value of errorpart or testValue determined by error condition
-     */
-    public static function IFERROR($testValue = '', $errorpart = '')
-    {
-        $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
-        $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
-
-        return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
-    }
-}

+ 0 - 879
libs/PHPExcel/PHPExcel/Calculation/LookupRef.php

xqd
@@ -1,879 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_LookupRef
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_LookupRef
-{
-    /**
-     * CELL_ADDRESS
-     *
-     * Creates a cell address as text, given specified row and column numbers.
-     *
-     * Excel Function:
-     *        =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText])
-     *
-     * @param    row                Row number to use in the cell reference
-     * @param    column            Column number to use in the cell reference
-     * @param    relativity        Flag indicating the type of reference to return
-     *                                1 or omitted    Absolute
-     *                                2                Absolute row; relative column
-     *                                3                Relative row; absolute column
-     *                                4                Relative
-     * @param    referenceStyle    A logical value that specifies the A1 or R1C1 reference style.
-     *                                TRUE or omitted        CELL_ADDRESS returns an A1-style reference
-     *                                FALSE                CELL_ADDRESS returns an R1C1-style reference
-     * @param    sheetText        Optional Name of worksheet to use
-     * @return    string
-     */
-    public static function CELL_ADDRESS($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '')
-    {
-        $row        = PHPExcel_Calculation_Functions::flattenSingleValue($row);
-        $column     = PHPExcel_Calculation_Functions::flattenSingleValue($column);
-        $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
-        $sheetText  = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
-
-        if (($row < 1) || ($column < 1)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if ($sheetText > '') {
-            if (strpos($sheetText, ' ') !== false) {
-                $sheetText = "'".$sheetText."'";
-            }
-            $sheetText .='!';
-        }
-        if ((!is_bool($referenceStyle)) || $referenceStyle) {
-            $rowRelative = $columnRelative = '$';
-            $column = PHPExcel_Cell::stringFromColumnIndex($column-1);
-            if (($relativity == 2) || ($relativity == 4)) {
-                $columnRelative = '';
-            }
-            if (($relativity == 3) || ($relativity == 4)) {
-                $rowRelative = '';
-            }
-            return $sheetText.$columnRelative.$column.$rowRelative.$row;
-        } else {
-            if (($relativity == 2) || ($relativity == 4)) {
-                $column = '['.$column.']';
-            }
-            if (($relativity == 3) || ($relativity == 4)) {
-                $row = '['.$row.']';
-            }
-            return $sheetText.'R'.$row.'C'.$column;
-        }
-    }
-
-
-    /**
-     * COLUMN
-     *
-     * Returns the column number of the given cell reference
-     * If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
-     * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
-     *        reference of the cell in which the COLUMN function appears; otherwise this function returns 0.
-     *
-     * Excel Function:
-     *        =COLUMN([cellAddress])
-     *
-     * @param    cellAddress        A reference to a range of cells for which you want the column numbers
-     * @return    integer or array of integer
-     */
-    public static function COLUMN($cellAddress = null)
-    {
-        if (is_null($cellAddress) || trim($cellAddress) === '') {
-            return 0;
-        }
-
-        if (is_array($cellAddress)) {
-            foreach ($cellAddress as $columnKey => $value) {
-                $columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
-                return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
-            }
-        } else {
-            if (strpos($cellAddress, '!') !== false) {
-                list($sheet, $cellAddress) = explode('!', $cellAddress);
-            }
-            if (strpos($cellAddress, ':') !== false) {
-                list($startAddress, $endAddress) = explode(':', $cellAddress);
-                $startAddress = preg_replace('/[^a-z]/i', '', $startAddress);
-                $endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
-                $returnValue = array();
-                do {
-                    $returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
-                } while ($startAddress++ != $endAddress);
-                return $returnValue;
-            } else {
-                $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress);
-                return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress);
-            }
-        }
-    }
-
-
-    /**
-     * COLUMNS
-     *
-     * Returns the number of columns in an array or reference.
-     *
-     * Excel Function:
-     *        =COLUMNS(cellAddress)
-     *
-     * @param    cellAddress        An array or array formula, or a reference to a range of cells for which you want the number of columns
-     * @return    integer            The number of columns in cellAddress
-     */
-    public static function COLUMNS($cellAddress = null)
-    {
-        if (is_null($cellAddress) || $cellAddress === '') {
-            return 1;
-        } elseif (!is_array($cellAddress)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        reset($cellAddress);
-        $isMatrix = (is_numeric(key($cellAddress)));
-        list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
-
-        if ($isMatrix) {
-            return $rows;
-        } else {
-            return $columns;
-        }
-    }
-
-
-    /**
-     * ROW
-     *
-     * Returns the row number of the given cell reference
-     * If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
-     * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
-     *        reference of the cell in which the ROW function appears; otherwise this function returns 0.
-     *
-     * Excel Function:
-     *        =ROW([cellAddress])
-     *
-     * @param    cellAddress        A reference to a range of cells for which you want the row numbers
-     * @return    integer or array of integer
-     */
-    public static function ROW($cellAddress = null)
-    {
-        if (is_null($cellAddress) || trim($cellAddress) === '') {
-            return 0;
-        }
-
-        if (is_array($cellAddress)) {
-            foreach ($cellAddress as $columnKey => $rowValue) {
-                foreach ($rowValue as $rowKey => $cellValue) {
-                    return (integer) preg_replace('/[^0-9]/i', '', $rowKey);
-                }
-            }
-        } else {
-            if (strpos($cellAddress, '!') !== false) {
-                list($sheet, $cellAddress) = explode('!', $cellAddress);
-            }
-            if (strpos($cellAddress, ':') !== false) {
-                list($startAddress, $endAddress) = explode(':', $cellAddress);
-                $startAddress = preg_replace('/[^0-9]/', '', $startAddress);
-                $endAddress = preg_replace('/[^0-9]/', '', $endAddress);
-                $returnValue = array();
-                do {
-                    $returnValue[][] = (integer) $startAddress;
-                } while ($startAddress++ != $endAddress);
-                return $returnValue;
-            } else {
-                list($cellAddress) = explode(':', $cellAddress);
-                return (integer) preg_replace('/[^0-9]/', '', $cellAddress);
-            }
-        }
-    }
-
-
-    /**
-     * ROWS
-     *
-     * Returns the number of rows in an array or reference.
-     *
-     * Excel Function:
-     *        =ROWS(cellAddress)
-     *
-     * @param    cellAddress        An array or array formula, or a reference to a range of cells for which you want the number of rows
-     * @return    integer            The number of rows in cellAddress
-     */
-    public static function ROWS($cellAddress = null)
-    {
-        if (is_null($cellAddress) || $cellAddress === '') {
-            return 1;
-        } elseif (!is_array($cellAddress)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        reset($cellAddress);
-        $isMatrix = (is_numeric(key($cellAddress)));
-        list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
-
-        if ($isMatrix) {
-            return $columns;
-        } else {
-            return $rows;
-        }
-    }
-
-
-    /**
-     * HYPERLINK
-     *
-     * Excel Function:
-     *        =HYPERLINK(linkURL,displayName)
-     *
-     * @access    public
-     * @category Logical Functions
-     * @param    string            $linkURL        Value to check, is also the value returned when no error
-     * @param    string            $displayName    Value to return when testValue is an error condition
-     * @param    PHPExcel_Cell    $pCell            The cell to set the hyperlink in
-     * @return    mixed    The value of $displayName (or $linkURL if $displayName was blank)
-     */
-    public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null)
-    {
-        $args = func_get_args();
-        $pCell = array_pop($args);
-
-        $linkURL     = (is_null($linkURL))     ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
-        $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
-
-        if ((!is_object($pCell)) || (trim($linkURL) == '')) {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-
-        if ((is_object($displayName)) || trim($displayName) == '') {
-            $displayName = $linkURL;
-        }
-
-        $pCell->getHyperlink()->setUrl($linkURL);
-        $pCell->getHyperlink()->setTooltip($displayName);
-
-        return $displayName;
-    }
-
-
-    /**
-     * INDIRECT
-     *
-     * Returns the reference specified by a text string.
-     * References are immediately evaluated to display their contents.
-     *
-     * Excel Function:
-     *        =INDIRECT(cellAddress)
-     *
-     * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
-     *
-     * @param    cellAddress        $cellAddress    The cell address of the current cell (containing this formula)
-     * @param    PHPExcel_Cell    $pCell            The current cell (containing this formula)
-     * @return    mixed            The cells referenced by cellAddress
-     *
-     * @todo    Support for the optional a1 parameter introduced in Excel 2010
-     *
-     */
-    public static function INDIRECT($cellAddress = null, PHPExcel_Cell $pCell = null)
-    {
-        $cellAddress    = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
-        if (is_null($cellAddress) || $cellAddress === '') {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-
-        $cellAddress1 = $cellAddress;
-        $cellAddress2 = null;
-        if (strpos($cellAddress, ':') !== false) {
-            list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
-        }
-
-        if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
-            ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
-            if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
-                return PHPExcel_Calculation_Functions::REF();
-            }
-
-            if (strpos($cellAddress, '!') !== false) {
-                list($sheetName, $cellAddress) = explode('!', $cellAddress);
-                $sheetName = trim($sheetName, "'");
-                $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
-            } else {
-                $pSheet = $pCell->getWorksheet();
-            }
-
-            return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
-        }
-
-        if (strpos($cellAddress, '!') !== false) {
-            list($sheetName, $cellAddress) = explode('!', $cellAddress);
-            $sheetName = trim($sheetName, "'");
-            $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
-        } else {
-            $pSheet = $pCell->getWorksheet();
-        }
-
-        return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
-    }
-
-
-    /**
-     * OFFSET
-     *
-     * Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
-     * The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
-     * the number of columns to be returned.
-     *
-     * Excel Function:
-     *        =OFFSET(cellAddress, rows, cols, [height], [width])
-     *
-     * @param    cellAddress        The reference from which you want to base the offset. Reference must refer to a cell or
-     *                                range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
-     * @param    rows            The number of rows, up or down, that you want the upper-left cell to refer to.
-     *                                Using 5 as the rows argument specifies that the upper-left cell in the reference is
-     *                                five rows below reference. Rows can be positive (which means below the starting reference)
-     *                                or negative (which means above the starting reference).
-     * @param    cols            The number of columns, to the left or right, that you want the upper-left cell of the result
-     *                                to refer to. Using 5 as the cols argument specifies that the upper-left cell in the
-     *                                reference is five columns to the right of reference. Cols can be positive (which means
-     *                                to the right of the starting reference) or negative (which means to the left of the
-     *                                starting reference).
-     * @param    height            The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
-     * @param    width            The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
-     * @return    string            A reference to a cell or range of cells
-     */
-    public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null)
-    {
-        $rows    = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
-        $columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
-        $height  = PHPExcel_Calculation_Functions::flattenSingleValue($height);
-        $width   = PHPExcel_Calculation_Functions::flattenSingleValue($width);
-        if ($cellAddress == null) {
-            return 0;
-        }
-
-        $args = func_get_args();
-        $pCell = array_pop($args);
-        if (!is_object($pCell)) {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-
-        $sheetName = null;
-        if (strpos($cellAddress, "!")) {
-            list($sheetName, $cellAddress) = explode("!", $cellAddress);
-            $sheetName = trim($sheetName, "'");
-        }
-        if (strpos($cellAddress, ":")) {
-            list($startCell, $endCell) = explode(":", $cellAddress);
-        } else {
-            $startCell = $endCell = $cellAddress;
-        }
-        list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
-        list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
-
-        $startCellRow += $rows;
-        $startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
-        $startCellColumn += $columns;
-
-        if (($startCellRow <= 0) || ($startCellColumn < 0)) {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-        $endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
-        if (($width != null) && (!is_object($width))) {
-            $endCellColumn = $startCellColumn + $width - 1;
-        } else {
-            $endCellColumn += $columns;
-        }
-        $startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
-
-        if (($height != null) && (!is_object($height))) {
-            $endCellRow = $startCellRow + $height - 1;
-        } else {
-            $endCellRow += $rows;
-        }
-
-        if (($endCellRow <= 0) || ($endCellColumn < 0)) {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-        $endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
-
-        $cellAddress = $startCellColumn.$startCellRow;
-        if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
-            $cellAddress .= ':'.$endCellColumn.$endCellRow;
-        }
-
-        if ($sheetName !== null) {
-            $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
-        } else {
-            $pSheet = $pCell->getWorksheet();
-        }
-
-        return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
-    }
-
-
-    /**
-     * CHOOSE
-     *
-     * Uses lookup_value to return a value from the list of value arguments.
-     * Use CHOOSE to select one of up to 254 values based on the lookup_value.
-     *
-     * Excel Function:
-     *        =CHOOSE(index_num, value1, [value2], ...)
-     *
-     * @param    index_num        Specifies which value argument is selected.
-     *                            Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number
-     *                                between 1 and 254.
-     * @param    value1...        Value1 is required, subsequent values are optional.
-     *                            Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
-     *                                index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
-     *                                text.
-     * @return    mixed            The selected value
-     */
-    public static function CHOOSE()
-    {
-        $chooseArgs = func_get_args();
-        $chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
-        $entryCount = count($chooseArgs) - 1;
-
-        if (is_array($chosenEntry)) {
-            $chosenEntry = array_shift($chosenEntry);
-        }
-        if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
-            --$chosenEntry;
-        } else {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $chosenEntry = floor($chosenEntry);
-        if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (is_array($chooseArgs[$chosenEntry])) {
-            return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
-        } else {
-            return $chooseArgs[$chosenEntry];
-        }
-    }
-
-
-    /**
-     * MATCH
-     *
-     * The MATCH function searches for a specified item in a range of cells
-     *
-     * Excel Function:
-     *        =MATCH(lookup_value, lookup_array, [match_type])
-     *
-     * @param    lookup_value    The value that you want to match in lookup_array
-     * @param    lookup_array    The range of cells being searched
-     * @param    match_type        The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
-     * @return    integer            The relative position of the found item
-     */
-    public static function MATCH($lookup_value, $lookup_array, $match_type = 1)
-    {
-        $lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
-        $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
-        $match_type    = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
-        //    MATCH is not case sensitive
-        $lookup_value = strtolower($lookup_value);
-
-        //    lookup_value type has to be number, text, or logical values
-        if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        //    match_type is 0, 1 or -1
-        if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        //    lookup_array should not be empty
-        $lookupArraySize = count($lookup_array);
-        if ($lookupArraySize <= 0) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        //    lookup_array should contain only number, text, or logical values, or empty (null) cells
-        foreach ($lookup_array as $i => $lookupArrayValue) {
-            //    check the type of the value
-            if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
-                (!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            //    convert strings to lowercase for case-insensitive testing
-            if (is_string($lookupArrayValue)) {
-                $lookup_array[$i] = strtolower($lookupArrayValue);
-            }
-            if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
-                $lookup_array = array_slice($lookup_array, 0, $i-1);
-            }
-        }
-
-        // if match_type is 1 or -1, the list has to be ordered
-        if ($match_type == 1) {
-            asort($lookup_array);
-            $keySet = array_keys($lookup_array);
-        } elseif ($match_type == -1) {
-            arsort($lookup_array);
-            $keySet = array_keys($lookup_array);
-        }
-
-        // **
-        // find the match
-        // **
-        foreach ($lookup_array as $i => $lookupArrayValue) {
-            if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) {
-                //    exact match
-                return ++$i;
-            } elseif (($match_type == -1) && ($lookupArrayValue <= $lookup_value)) {
-                $i = array_search($i, $keySet);
-                // if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value
-                if ($i < 1) {
-                    // 1st cell was already smaller than the lookup_value
-                    break;
-                } else {
-                    // the previous cell was the match
-                    return $keySet[$i-1]+1;
-                }
-            } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
-                $i = array_search($i, $keySet);
-                // if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
-                if ($i < 1) {
-                    // 1st cell was already bigger than the lookup_value
-                    break;
-                } else {
-                    // the previous cell was the match
-                    return $keySet[$i-1]+1;
-                }
-            }
-        }
-
-        //    unsuccessful in finding a match, return #N/A error value
-        return PHPExcel_Calculation_Functions::NA();
-    }
-
-
-    /**
-     * INDEX
-     *
-     * Uses an index to choose a value from a reference or array
-     *
-     * Excel Function:
-     *        =INDEX(range_array, row_num, [column_num])
-     *
-     * @param    range_array        A range of cells or an array constant
-     * @param    row_num            The row in array from which to return a value. If row_num is omitted, column_num is required.
-     * @param    column_num        The column in array from which to return a value. If column_num is omitted, row_num is required.
-     * @return    mixed            the value of a specified cell or array of cells
-     */
-    public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
-    {
-        if (($rowNum < 0) || ($columnNum < 0)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (!is_array($arrayValues)) {
-            return PHPExcel_Calculation_Functions::REF();
-        }
-
-        $rowKeys = array_keys($arrayValues);
-        $columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
-
-        if ($columnNum > count($columnKeys)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($columnNum == 0) {
-            if ($rowNum == 0) {
-                return $arrayValues;
-            }
-            $rowNum = $rowKeys[--$rowNum];
-            $returnArray = array();
-            foreach ($arrayValues as $arrayColumn) {
-                if (is_array($arrayColumn)) {
-                    if (isset($arrayColumn[$rowNum])) {
-                        $returnArray[] = $arrayColumn[$rowNum];
-                    } else {
-                        return $arrayValues[$rowNum];
-                    }
-                } else {
-                    return $arrayValues[$rowNum];
-                }
-            }
-            return $returnArray;
-        }
-        $columnNum = $columnKeys[--$columnNum];
-        if ($rowNum > count($rowKeys)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif ($rowNum == 0) {
-            return $arrayValues[$columnNum];
-        }
-        $rowNum = $rowKeys[--$rowNum];
-
-        return $arrayValues[$rowNum][$columnNum];
-    }
-
-
-    /**
-     * TRANSPOSE
-     *
-     * @param    array    $matrixData    A matrix of values
-     * @return    array
-     *
-     * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
-     */
-    public static function TRANSPOSE($matrixData)
-    {
-        $returnMatrix = array();
-        if (!is_array($matrixData)) {
-            $matrixData = array(array($matrixData));
-        }
-
-        $column = 0;
-        foreach ($matrixData as $matrixRow) {
-            $row = 0;
-            foreach ($matrixRow as $matrixCell) {
-                $returnMatrix[$row][$column] = $matrixCell;
-                ++$row;
-            }
-            ++$column;
-        }
-        return $returnMatrix;
-    }
-
-
-    private static function vlookupSort($a, $b)
-    {
-        reset($a);
-        $firstColumn = key($a);
-        if (($aLower = strtolower($a[$firstColumn])) == ($bLower = strtolower($b[$firstColumn]))) {
-            return 0;
-        }
-        return ($aLower < $bLower) ? -1 : 1;
-    }
-
-
-    /**
-     * VLOOKUP
-     * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
-     * @param    lookup_value    The value that you want to match in lookup_array
-     * @param    lookup_array    The range of cells being searched
-     * @param    index_number    The column number in table_array from which the matching value must be returned. The first column is 1.
-     * @param    not_exact_match    Determines if you are looking for an exact match based on lookup_value.
-     * @return    mixed            The value of the found cell
-     */
-    public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
-    {
-        $lookup_value    = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
-        $index_number    = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
-        $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
-
-        // index_number must be greater than or equal to 1
-        if ($index_number < 1) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // index_number must be less than or equal to the number of columns in lookup_array
-        if ((!is_array($lookup_array)) || (empty($lookup_array))) {
-            return PHPExcel_Calculation_Functions::REF();
-        } else {
-            $f = array_keys($lookup_array);
-            $firstRow = array_pop($f);
-            if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
-                return PHPExcel_Calculation_Functions::REF();
-            } else {
-                $columnKeys = array_keys($lookup_array[$firstRow]);
-                $returnColumn = $columnKeys[--$index_number];
-                $firstColumn = array_shift($columnKeys);
-            }
-        }
-
-        if (!$not_exact_match) {
-            uasort($lookup_array, array('self', 'vlookupSort'));
-        }
-
-        $rowNumber = $rowValue = false;
-        foreach ($lookup_array as $rowKey => $rowData) {
-            if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
-                (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
-                break;
-            }
-            $rowNumber = $rowKey;
-            $rowValue = $rowData[$firstColumn];
-        }
-
-        if ($rowNumber !== false) {
-            if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
-                //    if an exact match is required, we have what we need to return an appropriate response
-                return PHPExcel_Calculation_Functions::NA();
-            } else {
-                //    otherwise return the appropriate value
-                return $lookup_array[$rowNumber][$returnColumn];
-            }
-        }
-
-        return PHPExcel_Calculation_Functions::NA();
-    }
-
-
-    /**
-     * HLOOKUP
-     * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
-     * @param    lookup_value    The value that you want to match in lookup_array
-     * @param    lookup_array    The range of cells being searched
-     * @param    index_number    The row number in table_array from which the matching value must be returned. The first row is 1.
-     * @param    not_exact_match Determines if you are looking for an exact match based on lookup_value.
-     * @return   mixed           The value of the found cell
-     */
-    public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
-    {
-        $lookup_value   = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
-        $index_number   = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
-        $not_exact_match    = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
-
-        // index_number must be greater than or equal to 1
-        if ($index_number < 1) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        // index_number must be less than or equal to the number of columns in lookup_array
-        if ((!is_array($lookup_array)) || (empty($lookup_array))) {
-            return PHPExcel_Calculation_Functions::REF();
-        } else {
-            $f = array_keys($lookup_array);
-            $firstRow = array_pop($f);
-            if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
-                return PHPExcel_Calculation_Functions::REF();
-            } else {
-                $columnKeys = array_keys($lookup_array[$firstRow]);
-                                $firstkey = $f[0] - 1;
-                $returnColumn = $firstkey + $index_number;
-                $firstColumn = array_shift($f);
-            }
-        }
-
-        if (!$not_exact_match) {
-            $firstRowH = asort($lookup_array[$firstColumn]);
-        }
-
-        $rowNumber = $rowValue = false;
-        foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) {
-            if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
-                (!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
-                break;
-            }
-            $rowNumber = $rowKey;
-            $rowValue = $rowData;
-        }
-
-        if ($rowNumber !== false) {
-            if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
-                //  if an exact match is required, we have what we need to return an appropriate response
-                return PHPExcel_Calculation_Functions::NA();
-            } else {
-                //  otherwise return the appropriate value
-                return $lookup_array[$returnColumn][$rowNumber];
-            }
-        }
-
-        return PHPExcel_Calculation_Functions::NA();
-    }
-
-
-    /**
-     * LOOKUP
-     * The LOOKUP function searches for value either from a one-row or one-column range or from an array.
-     * @param    lookup_value    The value that you want to match in lookup_array
-     * @param    lookup_vector    The range of cells being searched
-     * @param    result_vector    The column from which the matching value must be returned
-     * @return    mixed            The value of the found cell
-     */
-    public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null)
-    {
-        $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
-
-        if (!is_array($lookup_vector)) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-        $lookupRows = count($lookup_vector);
-        $l = array_keys($lookup_vector);
-        $l = array_shift($l);
-        $lookupColumns = count($lookup_vector[$l]);
-        if ((($lookupRows == 1) && ($lookupColumns > 1)) || (($lookupRows == 2) && ($lookupColumns != 2))) {
-            $lookup_vector = self::TRANSPOSE($lookup_vector);
-            $lookupRows = count($lookup_vector);
-            $l = array_keys($lookup_vector);
-            $lookupColumns = count($lookup_vector[array_shift($l)]);
-        }
-
-        if (is_null($result_vector)) {
-            $result_vector = $lookup_vector;
-        }
-        $resultRows = count($result_vector);
-        $l = array_keys($result_vector);
-        $l = array_shift($l);
-        $resultColumns = count($result_vector[$l]);
-        if ((($resultRows == 1) && ($resultColumns > 1)) || (($resultRows == 2) && ($resultColumns != 2))) {
-            $result_vector = self::TRANSPOSE($result_vector);
-            $resultRows = count($result_vector);
-            $r = array_keys($result_vector);
-            $resultColumns = count($result_vector[array_shift($r)]);
-        }
-
-        if ($lookupRows == 2) {
-            $result_vector = array_pop($lookup_vector);
-            $lookup_vector = array_shift($lookup_vector);
-        }
-        if ($lookupColumns != 2) {
-            foreach ($lookup_vector as &$value) {
-                if (is_array($value)) {
-                    $k = array_keys($value);
-                    $key1 = $key2 = array_shift($k);
-                    $key2++;
-                    $dataValue1 = $value[$key1];
-                } else {
-                    $key1 = 0;
-                    $key2 = 1;
-                    $dataValue1 = $value;
-                }
-                $dataValue2 = array_shift($result_vector);
-                if (is_array($dataValue2)) {
-                    $dataValue2 = array_shift($dataValue2);
-                }
-                $value = array($key1 => $dataValue1, $key2 => $dataValue2);
-            }
-            unset($value);
-        }
-
-        return self::VLOOKUP($lookup_value, $lookup_vector, 2);
-    }
-}

+ 0 - 1459
libs/PHPExcel/PHPExcel/Calculation/MathTrig.php

xqd
@@ -1,1459 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_MathTrig
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_MathTrig
-{
-    //
-    //    Private method to return an array of the factors of the input value
-    //
-    private static function factors($value)
-    {
-        $startVal = floor(sqrt($value));
-
-        $factorArray = array();
-        for ($i = $startVal; $i > 1; --$i) {
-            if (($value % $i) == 0) {
-                $factorArray = array_merge($factorArray, self::factors($value / $i));
-                $factorArray = array_merge($factorArray, self::factors($i));
-                if ($i <= sqrt($value)) {
-                    break;
-                }
-            }
-        }
-        if (!empty($factorArray)) {
-            rsort($factorArray);
-            return $factorArray;
-        } else {
-            return array((integer) $value);
-        }
-    }
-
-
-    private static function romanCut($num, $n)
-    {
-        return ($num - ($num % $n ) ) / $n;
-    }
-
-
-    /**
-     * ATAN2
-     *
-     * This function calculates the arc tangent of the two variables x and y. It is similar to
-     *        calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
-     *        to determine the quadrant of the result.
-     * The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
-     *        point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
-     *        -pi and pi, excluding -pi.
-     *
-     * Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
-     *        PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.
-     *
-     * Excel Function:
-     *        ATAN2(xCoordinate,yCoordinate)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $xCoordinate        The x-coordinate of the point.
-     * @param    float    $yCoordinate        The y-coordinate of the point.
-     * @return    float    The inverse tangent of the specified x- and y-coordinates.
-     */
-    public static function ATAN2($xCoordinate = null, $yCoordinate = null)
-    {
-        $xCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($xCoordinate);
-        $yCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($yCoordinate);
-
-        $xCoordinate = ($xCoordinate !== null) ? $xCoordinate : 0.0;
-        $yCoordinate = ($yCoordinate !== null) ? $yCoordinate : 0.0;
-
-        if (((is_numeric($xCoordinate)) || (is_bool($xCoordinate))) &&
-            ((is_numeric($yCoordinate)))  || (is_bool($yCoordinate))) {
-            $xCoordinate    = (float) $xCoordinate;
-            $yCoordinate    = (float) $yCoordinate;
-
-            if (($xCoordinate == 0) && ($yCoordinate == 0)) {
-                return PHPExcel_Calculation_Functions::DIV0();
-            }
-
-            return atan2($yCoordinate, $xCoordinate);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * CEILING
-     *
-     * Returns number rounded up, away from zero, to the nearest multiple of significance.
-     *        For example, if you want to avoid using pennies in your prices and your product is
-     *        priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the
-     *        nearest nickel.
-     *
-     * Excel Function:
-     *        CEILING(number[,significance])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $number            The number you want to round.
-     * @param    float    $significance    The multiple to which you want to round.
-     * @return    float    Rounded Number
-     */
-    public static function CEILING($number, $significance = null)
-    {
-        $number       = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance);
-
-        if ((is_null($significance)) &&
-            (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
-            $significance = $number / abs($number);
-        }
-
-        if ((is_numeric($number)) && (is_numeric($significance))) {
-            if (($number == 0.0 ) || ($significance == 0.0)) {
-                return 0.0;
-            } elseif (self::SIGN($number) == self::SIGN($significance)) {
-                return ceil($number / $significance) * $significance;
-            } else {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * COMBIN
-     *
-     * Returns the number of combinations for a given number of items. Use COMBIN to
-     *        determine the total possible number of groups for a given number of items.
-     *
-     * Excel Function:
-     *        COMBIN(numObjs,numInSet)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    int        $numObjs    Number of different objects
-     * @param    int        $numInSet    Number of objects in each combination
-     * @return    int        Number of combinations
-     */
-    public static function COMBIN($numObjs, $numInSet)
-    {
-        $numObjs    = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs);
-        $numInSet    = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet);
-
-        if ((is_numeric($numObjs)) && (is_numeric($numInSet))) {
-            if ($numObjs < $numInSet) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } elseif ($numInSet < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * EVEN
-     *
-     * Returns number rounded up to the nearest even integer.
-     * You can use this function for processing items that come in twos. For example,
-     *        a packing crate accepts rows of one or two items. The crate is full when
-     *        the number of items, rounded up to the nearest two, matches the crate's
-     *        capacity.
-     *
-     * Excel Function:
-     *        EVEN(number)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $number            Number to round
-     * @return    int        Rounded Number
-     */
-    public static function EVEN($number)
-    {
-        $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-
-        if (is_null($number)) {
-            return 0;
-        } elseif (is_bool($number)) {
-            $number = (int) $number;
-        }
-
-        if (is_numeric($number)) {
-            $significance = 2 * self::SIGN($number);
-            return (int) self::CEILING($number, $significance);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FACT
-     *
-     * Returns the factorial of a number.
-     * The factorial of a number is equal to 1*2*3*...* number.
-     *
-     * Excel Function:
-     *        FACT(factVal)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $factVal    Factorial Value
-     * @return    int        Factorial
-     */
-    public static function FACT($factVal)
-    {
-        $factVal    = PHPExcel_Calculation_Functions::flattenSingleValue($factVal);
-
-        if (is_numeric($factVal)) {
-            if ($factVal < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $factLoop = floor($factVal);
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                if ($factVal > $factLoop) {
-                    return PHPExcel_Calculation_Functions::NaN();
-                }
-            }
-
-            $factorial = 1;
-            while ($factLoop > 1) {
-                $factorial *= $factLoop--;
-            }
-            return $factorial ;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FACTDOUBLE
-     *
-     * Returns the double factorial of a number.
-     *
-     * Excel Function:
-     *        FACTDOUBLE(factVal)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $factVal    Factorial Value
-     * @return    int        Double Factorial
-     */
-    public static function FACTDOUBLE($factVal)
-    {
-        $factLoop    = PHPExcel_Calculation_Functions::flattenSingleValue($factVal);
-
-        if (is_numeric($factLoop)) {
-            $factLoop    = floor($factLoop);
-            if ($factVal < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $factorial = 1;
-            while ($factLoop > 1) {
-                $factorial *= $factLoop--;
-                --$factLoop;
-            }
-            return $factorial ;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FLOOR
-     *
-     * Rounds number down, toward zero, to the nearest multiple of significance.
-     *
-     * Excel Function:
-     *        FLOOR(number[,significance])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $number            Number to round
-     * @param    float    $significance    Significance
-     * @return    float    Rounded Number
-     */
-    public static function FLOOR($number, $significance = null)
-    {
-        $number            = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $significance    = PHPExcel_Calculation_Functions::flattenSingleValue($significance);
-
-        if ((is_null($significance)) &&
-            (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
-            $significance = $number/abs($number);
-        }
-
-        if ((is_numeric($number)) && (is_numeric($significance))) {
-            if ($significance == 0.0) {
-                return PHPExcel_Calculation_Functions::DIV0();
-            } elseif ($number == 0.0) {
-                return 0.0;
-            } elseif (self::SIGN($number) == self::SIGN($significance)) {
-                return floor($number / $significance) * $significance;
-            } else {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-        }
-
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * GCD
-     *
-     * Returns the greatest common divisor of a series of numbers.
-     * The greatest common divisor is the largest integer that divides both
-     *        number1 and number2 without a remainder.
-     *
-     * Excel Function:
-     *        GCD(number1[,number2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed    $arg,...        Data values
-     * @return    integer                    Greatest Common Divisor
-     */
-    public static function GCD()
-    {
-        $returnValue = 1;
-        $allValuesFactors = array();
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
-            if (!is_numeric($value)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            } elseif ($value == 0) {
-                continue;
-            } elseif ($value < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $myFactors = self::factors($value);
-            $myCountedFactors = array_count_values($myFactors);
-            $allValuesFactors[] = $myCountedFactors;
-        }
-        $allValuesCount = count($allValuesFactors);
-        if ($allValuesCount == 0) {
-            return 0;
-        }
-
-        $mergedArray = $allValuesFactors[0];
-        for ($i=1; $i < $allValuesCount; ++$i) {
-            $mergedArray = array_intersect_key($mergedArray, $allValuesFactors[$i]);
-        }
-        $mergedArrayValues = count($mergedArray);
-        if ($mergedArrayValues == 0) {
-            return $returnValue;
-        } elseif ($mergedArrayValues > 1) {
-            foreach ($mergedArray as $mergedKey => $mergedValue) {
-                foreach ($allValuesFactors as $highestPowerTest) {
-                    foreach ($highestPowerTest as $testKey => $testValue) {
-                        if (($testKey == $mergedKey) && ($testValue < $mergedValue)) {
-                            $mergedArray[$mergedKey] = $testValue;
-                            $mergedValue = $testValue;
-                        }
-                    }
-                }
-            }
-
-            $returnValue = 1;
-            foreach ($mergedArray as $key => $value) {
-                $returnValue *= pow($key, $value);
-            }
-            return $returnValue;
-        } else {
-            $keys = array_keys($mergedArray);
-            $key = $keys[0];
-            $value = $mergedArray[$key];
-            foreach ($allValuesFactors as $testValue) {
-                foreach ($testValue as $mergedKey => $mergedValue) {
-                    if (($mergedKey == $key) && ($mergedValue < $value)) {
-                        $value = $mergedValue;
-                    }
-                }
-            }
-            return pow($key, $value);
-        }
-    }
-
-
-    /**
-     * INT
-     *
-     * Casts a floating point value to an integer
-     *
-     * Excel Function:
-     *        INT(number)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $number            Number to cast to an integer
-     * @return    integer    Integer value
-     */
-    public static function INT($number)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-
-        if (is_null($number)) {
-            return 0;
-        } elseif (is_bool($number)) {
-            return (int) $number;
-        }
-        if (is_numeric($number)) {
-            return (int) floor($number);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * LCM
-     *
-     * Returns the lowest common multiplier of a series of numbers
-     * The least common multiple is the smallest positive integer that is a multiple
-     * of all integer arguments number1, number2, and so on. Use LCM to add fractions
-     * with different denominators.
-     *
-     * Excel Function:
-     *        LCM(number1[,number2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed    $arg,...        Data values
-     * @return    int        Lowest Common Multiplier
-     */
-    public static function LCM()
-    {
-        $returnValue = 1;
-        $allPoweredFactors = array();
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
-            if (!is_numeric($value)) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-            if ($value == 0) {
-                return 0;
-            } elseif ($value < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $myFactors = self::factors(floor($value));
-            $myCountedFactors = array_count_values($myFactors);
-            $myPoweredFactors = array();
-            foreach ($myCountedFactors as $myCountedFactor => $myCountedPower) {
-                $myPoweredFactors[$myCountedFactor] = pow($myCountedFactor, $myCountedPower);
-            }
-            foreach ($myPoweredFactors as $myPoweredValue => $myPoweredFactor) {
-                if (array_key_exists($myPoweredValue, $allPoweredFactors)) {
-                    if ($allPoweredFactors[$myPoweredValue] < $myPoweredFactor) {
-                        $allPoweredFactors[$myPoweredValue] = $myPoweredFactor;
-                    }
-                } else {
-                    $allPoweredFactors[$myPoweredValue] = $myPoweredFactor;
-                }
-            }
-        }
-        foreach ($allPoweredFactors as $allPoweredFactor) {
-            $returnValue *= (integer) $allPoweredFactor;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * LOG_BASE
-     *
-     * Returns the logarithm of a number to a specified base. The default base is 10.
-     *
-     * Excel Function:
-     *        LOG(number[,base])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    float    $number        The positive real number for which you want the logarithm
-     * @param    float    $base        The base of the logarithm. If base is omitted, it is assumed to be 10.
-     * @return    float
-     */
-    public static function LOG_BASE($number = null, $base = 10)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $base    = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base);
-
-        if ((!is_numeric($base)) || (!is_numeric($number))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (($base <= 0) || ($number <= 0)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return log($number, $base);
-    }
-
-
-    /**
-     * MDETERM
-     *
-     * Returns the matrix determinant of an array.
-     *
-     * Excel Function:
-     *        MDETERM(array)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    array    $matrixValues    A matrix of values
-     * @return    float
-     */
-    public static function MDETERM($matrixValues)
-    {
-        $matrixData = array();
-        if (!is_array($matrixValues)) {
-            $matrixValues = array(array($matrixValues));
-        }
-
-        $row = $maxColumn = 0;
-        foreach ($matrixValues as $matrixRow) {
-            if (!is_array($matrixRow)) {
-                $matrixRow = array($matrixRow);
-            }
-            $column = 0;
-            foreach ($matrixRow as $matrixCell) {
-                if ((is_string($matrixCell)) || ($matrixCell === null)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-                $matrixData[$column][$row] = $matrixCell;
-                ++$column;
-            }
-            if ($column > $maxColumn) {
-                $maxColumn = $column;
-            }
-            ++$row;
-        }
-        if ($row != $maxColumn) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        try {
-            $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
-            return $matrix->det();
-        } catch (PHPExcel_Exception $ex) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-    }
-
-
-    /**
-     * MINVERSE
-     *
-     * Returns the inverse matrix for the matrix stored in an array.
-     *
-     * Excel Function:
-     *        MINVERSE(array)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    array    $matrixValues    A matrix of values
-     * @return    array
-     */
-    public static function MINVERSE($matrixValues)
-    {
-        $matrixData = array();
-        if (!is_array($matrixValues)) {
-            $matrixValues = array(array($matrixValues));
-        }
-
-        $row = $maxColumn = 0;
-        foreach ($matrixValues as $matrixRow) {
-            if (!is_array($matrixRow)) {
-                $matrixRow = array($matrixRow);
-            }
-            $column = 0;
-            foreach ($matrixRow as $matrixCell) {
-                if ((is_string($matrixCell)) || ($matrixCell === null)) {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-                $matrixData[$column][$row] = $matrixCell;
-                ++$column;
-            }
-            if ($column > $maxColumn) {
-                $maxColumn = $column;
-            }
-            ++$row;
-        }
-        if ($row != $maxColumn) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        try {
-            $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
-            return $matrix->inverse()->getArray();
-        } catch (PHPExcel_Exception $ex) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-    }
-
-
-    /**
-     * MMULT
-     *
-     * @param    array    $matrixData1    A matrix of values
-     * @param    array    $matrixData2    A matrix of values
-     * @return    array
-     */
-    public static function MMULT($matrixData1, $matrixData2)
-    {
-        $matrixAData = $matrixBData = array();
-        if (!is_array($matrixData1)) {
-            $matrixData1 = array(array($matrixData1));
-        }
-        if (!is_array($matrixData2)) {
-            $matrixData2 = array(array($matrixData2));
-        }
-
-        try {
-            $rowA = 0;
-            foreach ($matrixData1 as $matrixRow) {
-                if (!is_array($matrixRow)) {
-                    $matrixRow = array($matrixRow);
-                }
-                $columnA = 0;
-                foreach ($matrixRow as $matrixCell) {
-                    if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
-                        return PHPExcel_Calculation_Functions::VALUE();
-                    }
-                    $matrixAData[$rowA][$columnA] = $matrixCell;
-                    ++$columnA;
-                }
-                ++$rowA;
-            }
-            $matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
-            $rowB = 0;
-            foreach ($matrixData2 as $matrixRow) {
-                if (!is_array($matrixRow)) {
-                    $matrixRow = array($matrixRow);
-                }
-                $columnB = 0;
-                foreach ($matrixRow as $matrixCell) {
-                    if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
-                        return PHPExcel_Calculation_Functions::VALUE();
-                    }
-                    $matrixBData[$rowB][$columnB] = $matrixCell;
-                    ++$columnB;
-                }
-                ++$rowB;
-            }
-            $matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
-
-            if ($columnA != $rowB) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-
-            return $matrixA->times($matrixB)->getArray();
-        } catch (PHPExcel_Exception $ex) {
-            var_dump($ex->getMessage());
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-    }
-
-
-    /**
-     * MOD
-     *
-     * @param    int        $a        Dividend
-     * @param    int        $b        Divisor
-     * @return    int        Remainder
-     */
-    public static function MOD($a = 1, $b = 1)
-    {
-        $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
-        $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
-
-        if ($b == 0.0) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        } elseif (($a < 0.0) && ($b > 0.0)) {
-            return $b - fmod(abs($a), $b);
-        } elseif (($a > 0.0) && ($b < 0.0)) {
-            return $b + fmod($a, abs($b));
-        }
-
-        return fmod($a, $b);
-    }
-
-
-    /**
-     * MROUND
-     *
-     * Rounds a number to the nearest multiple of a specified value
-     *
-     * @param    float    $number            Number to round
-     * @param    int        $multiple        Multiple to which you want to round $number
-     * @return    float    Rounded Number
-     */
-    public static function MROUND($number, $multiple)
-    {
-        $number   = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $multiple = PHPExcel_Calculation_Functions::flattenSingleValue($multiple);
-
-        if ((is_numeric($number)) && (is_numeric($multiple))) {
-            if ($multiple == 0) {
-                return 0;
-            }
-            if ((self::SIGN($number)) == (self::SIGN($multiple))) {
-                $multiplier = 1 / $multiple;
-                return round($number * $multiplier) / $multiplier;
-            }
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * MULTINOMIAL
-     *
-     * Returns the ratio of the factorial of a sum of values to the product of factorials.
-     *
-     * @param    array of mixed        Data Series
-     * @return    float
-     */
-    public static function MULTINOMIAL()
-    {
-        $summer = 0;
-        $divisor = 1;
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
-            // Is it a numeric value?
-            if (is_numeric($arg)) {
-                if ($arg < 1) {
-                    return PHPExcel_Calculation_Functions::NaN();
-                }
-                $summer += floor($arg);
-                $divisor *= self::FACT($arg);
-            } else {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-        }
-
-        // Return
-        if ($summer > 0) {
-            $summer = self::FACT($summer);
-            return $summer / $divisor;
-        }
-        return 0;
-    }
-
-
-    /**
-     * ODD
-     *
-     * Returns number rounded up to the nearest odd integer.
-     *
-     * @param    float    $number            Number to round
-     * @return    int        Rounded Number
-     */
-    public static function ODD($number)
-    {
-        $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-
-        if (is_null($number)) {
-            return 1;
-        } elseif (is_bool($number)) {
-            return 1;
-        } elseif (is_numeric($number)) {
-            $significance = self::SIGN($number);
-            if ($significance == 0) {
-                return 1;
-            }
-
-            $result = self::CEILING($number, $significance);
-            if ($result == self::EVEN($result)) {
-                $result += $significance;
-            }
-
-            return (int) $result;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * POWER
-     *
-     * Computes x raised to the power y.
-     *
-     * @param    float        $x
-     * @param    float        $y
-     * @return    float
-     */
-    public static function POWER($x = 0, $y = 2)
-    {
-        $x    = PHPExcel_Calculation_Functions::flattenSingleValue($x);
-        $y    = PHPExcel_Calculation_Functions::flattenSingleValue($y);
-
-        // Validate parameters
-        if ($x == 0.0 && $y == 0.0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        } elseif ($x == 0.0 && $y < 0.0) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        // Return
-        $result = pow($x, $y);
-        return (!is_nan($result) && !is_infinite($result)) ? $result : PHPExcel_Calculation_Functions::NaN();
-    }
-
-
-    /**
-     * PRODUCT
-     *
-     * PRODUCT returns the product of all the values and cells referenced in the argument list.
-     *
-     * Excel Function:
-     *        PRODUCT(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function PRODUCT()
-    {
-        // Return value
-        $returnValue = null;
-
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if (is_null($returnValue)) {
-                    $returnValue = $arg;
-                } else {
-                    $returnValue *= $arg;
-                }
-            }
-        }
-
-        // Return
-        if (is_null($returnValue)) {
-            return 0;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * QUOTIENT
-     *
-     * QUOTIENT function returns the integer portion of a division. Numerator is the divided number
-     *        and denominator is the divisor.
-     *
-     * Excel Function:
-     *        QUOTIENT(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function QUOTIENT()
-    {
-        // Return value
-        $returnValue = null;
-
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if (is_null($returnValue)) {
-                    $returnValue = ($arg == 0) ? 0 : $arg;
-                } else {
-                    if (($returnValue == 0) || ($arg == 0)) {
-                        $returnValue = 0;
-                    } else {
-                        $returnValue /= $arg;
-                    }
-                }
-            }
-        }
-
-        // Return
-        return intval($returnValue);
-    }
-
-
-    /**
-     * RAND
-     *
-     * @param    int        $min    Minimal value
-     * @param    int        $max    Maximal value
-     * @return    int        Random number
-     */
-    public static function RAND($min = 0, $max = 0)
-    {
-        $min = PHPExcel_Calculation_Functions::flattenSingleValue($min);
-        $max = PHPExcel_Calculation_Functions::flattenSingleValue($max);
-
-        if ($min == 0 && $max == 0) {
-            return (mt_rand(0, 10000000)) / 10000000;
-        } else {
-            return mt_rand($min, $max);
-        }
-    }
-
-
-    public static function ROMAN($aValue, $style = 0)
-    {
-        $aValue    = PHPExcel_Calculation_Functions::flattenSingleValue($aValue);
-        $style    = (is_null($style))    ? 0 :    (integer) PHPExcel_Calculation_Functions::flattenSingleValue($style);
-        if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $aValue = (integer) $aValue;
-        if ($aValue == 0) {
-            return '';
-        }
-
-        $mill = array('', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM');
-        $cent = array('', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM');
-        $tens = array('', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC');
-        $ones = array('', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX');
-
-        $roman = '';
-        while ($aValue > 5999) {
-            $roman .= 'M';
-            $aValue -= 1000;
-        }
-        $m = self::romanCut($aValue, 1000);
-        $aValue %= 1000;
-        $c = self::romanCut($aValue, 100);
-        $aValue %= 100;
-        $t = self::romanCut($aValue, 10);
-        $aValue %= 10;
-
-        return $roman.$mill[$m].$cent[$c].$tens[$t].$ones[$aValue];
-    }
-
-
-    /**
-     * ROUNDUP
-     *
-     * Rounds a number up to a specified number of decimal places
-     *
-     * @param    float    $number            Number to round
-     * @param    int        $digits            Number of digits to which you want to round $number
-     * @return    float    Rounded Number
-     */
-    public static function ROUNDUP($number, $digits)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $digits    = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
-
-        if ((is_numeric($number)) && (is_numeric($digits))) {
-            $significance = pow(10, (int) $digits);
-            if ($number < 0.0) {
-                return floor($number * $significance) / $significance;
-            } else {
-                return ceil($number * $significance) / $significance;
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * ROUNDDOWN
-     *
-     * Rounds a number down to a specified number of decimal places
-     *
-     * @param    float    $number            Number to round
-     * @param    int        $digits            Number of digits to which you want to round $number
-     * @return    float    Rounded Number
-     */
-    public static function ROUNDDOWN($number, $digits)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-        $digits    = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
-
-        if ((is_numeric($number)) && (is_numeric($digits))) {
-            $significance = pow(10, (int) $digits);
-            if ($number < 0.0) {
-                return ceil($number * $significance) / $significance;
-            } else {
-                return floor($number * $significance) / $significance;
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SERIESSUM
-     *
-     * Returns the sum of a power series
-     *
-     * @param    float            $x    Input value to the power series
-     * @param    float            $n    Initial power to which you want to raise $x
-     * @param    float            $m    Step by which to increase $n for each term in the series
-     * @param    array of mixed        Data Series
-     * @return    float
-     */
-    public static function SERIESSUM()
-    {
-        $returnValue = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        $x = array_shift($aArgs);
-        $n = array_shift($aArgs);
-        $m = array_shift($aArgs);
-
-        if ((is_numeric($x)) && (is_numeric($n)) && (is_numeric($m))) {
-            // Calculate
-            $i = 0;
-            foreach ($aArgs as $arg) {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $returnValue += $arg * pow($x, $n + ($m * $i++));
-                } else {
-                    return PHPExcel_Calculation_Functions::VALUE();
-                }
-            }
-            return $returnValue;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SIGN
-     *
-     * Determines the sign of a number. Returns 1 if the number is positive, zero (0)
-     *        if the number is 0, and -1 if the number is negative.
-     *
-     * @param    float    $number            Number to round
-     * @return    int        sign value
-     */
-    public static function SIGN($number)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-
-        if (is_bool($number)) {
-            return (int) $number;
-        }
-        if (is_numeric($number)) {
-            if ($number == 0.0) {
-                return 0;
-            }
-            return $number / abs($number);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SQRTPI
-     *
-     * Returns the square root of (number * pi).
-     *
-     * @param    float    $number        Number
-     * @return    float    Square Root of Number * Pi
-     */
-    public static function SQRTPI($number)
-    {
-        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);
-
-        if (is_numeric($number)) {
-            if ($number < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return sqrt($number * M_PI) ;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SUBTOTAL
-     *
-     * Returns a subtotal in a list or database.
-     *
-     * @param    int        the number 1 to 11 that specifies which function to
-     *                    use in calculating subtotals within a list.
-     * @param    array of mixed        Data Series
-     * @return    float
-     */
-    public static function SUBTOTAL()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $subtotal = array_shift($aArgs);
-
-        if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
-            switch ($subtotal) {
-                case 1:
-                    return PHPExcel_Calculation_Statistical::AVERAGE($aArgs);
-                case 2:
-                    return PHPExcel_Calculation_Statistical::COUNT($aArgs);
-                case 3:
-                    return PHPExcel_Calculation_Statistical::COUNTA($aArgs);
-                case 4:
-                    return PHPExcel_Calculation_Statistical::MAX($aArgs);
-                case 5:
-                    return PHPExcel_Calculation_Statistical::MIN($aArgs);
-                case 6:
-                    return self::PRODUCT($aArgs);
-                case 7:
-                    return PHPExcel_Calculation_Statistical::STDEV($aArgs);
-                case 8:
-                    return PHPExcel_Calculation_Statistical::STDEVP($aArgs);
-                case 9:
-                    return self::SUM($aArgs);
-                case 10:
-                    return PHPExcel_Calculation_Statistical::VARFunc($aArgs);
-                case 11:
-                    return PHPExcel_Calculation_Statistical::VARP($aArgs);
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SUM
-     *
-     * SUM computes the sum of all the values and cells referenced in the argument list.
-     *
-     * Excel Function:
-     *        SUM(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function SUM()
-    {
-        $returnValue = 0;
-
-        // Loop through the arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $returnValue += $arg;
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * SUMIF
-     *
-     * Counts the number of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        SUMIF(value1[,value2[, ...]],condition)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    string        $condition        The criteria that defines which cells will be summed.
-     * @return    float
-     */
-    public static function SUMIF($aArgs, $condition, $sumArgs = array())
-    {
-        $returnValue = 0;
-
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
-        $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
-        if (empty($sumArgs)) {
-            $sumArgs = $aArgs;
-        }
-        $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
-        // Loop through arguments
-        foreach ($aArgs as $key => $arg) {
-            if (!is_numeric($arg)) {
-                $arg = str_replace('"', '""', $arg);
-                $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-            }
-
-            $testCondition = '='.$arg.$condition;
-            if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                // Is it a value within our criteria
-                $returnValue += $sumArgs[$key];
-            }
-        }
-
-        return $returnValue;
-    }
-
-
- 	/**
-	 *	SUMIFS
-	 *
-	 *	Counts the number of cells that contain numbers within the list of arguments
-	 *
-	 *	Excel Function:
-	 *		SUMIFS(value1[,value2[, ...]],condition)
-	 *
-	 *	@access	public
-	 *	@category Mathematical and Trigonometric Functions
-	 *	@param	mixed		$arg,...		Data values
-	 *	@param	string		$condition		The criteria that defines which cells will be summed.
-	 *	@return	float
-	 */
-	public static function SUMIFS() {
-		$arrayList = func_get_args();
-
-		$sumArgs = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
-
-        while (count($arrayList) > 0) {
-            $aArgsArray[] = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
-            $conditions[] = PHPExcel_Calculation_Functions::ifCondition(array_shift($arrayList));
-        }
-
-        // Loop through each set of arguments and conditions
-        foreach ($conditions as $index => $condition) {
-            $aArgs = $aArgsArray[$index];
-            $wildcard = false;
-            if ((strpos($condition, '*') !== false) || (strpos($condition, '?') !== false)) {
-                // * and ? are wildcard characters.
-                // Use ~* and ~? for literal star and question mark
-                // Code logic doesn't yet handle escaping
-                $condition = trim(ltrim($condition, '=<>'), '"');
-                $wildcard = true;
-            }
-            // Loop through arguments
-            foreach ($aArgs as $key => $arg) {
-                if ($wildcard) {
-                    if (!fnmatch($condition, $arg, FNM_CASEFOLD)) {
-                        // Is it a value within our criteria
-                        $sumArgs[$key] = 0.0;
-                    }
-                } else {
-                    if (!is_numeric($arg)) {
-                        $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-                    }
-                    $testCondition = '='.$arg.$condition;
-                    if (!PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                        // Is it a value within our criteria
-                        $sumArgs[$key] = 0.0;
-                    }
-                }
-            }
-        }
-
-		// Return
-		return array_sum($sumArgs);
-	}
-
-
-    /**
-     * SUMPRODUCT
-     *
-     * Excel Function:
-     *        SUMPRODUCT(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function SUMPRODUCT()
-    {
-        $arrayList = func_get_args();
-
-        $wrkArray = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
-        $wrkCellCount = count($wrkArray);
-
-        for ($i=0; $i< $wrkCellCount; ++$i) {
-            if ((!is_numeric($wrkArray[$i])) || (is_string($wrkArray[$i]))) {
-                $wrkArray[$i] = 0;
-            }
-        }
-
-        foreach ($arrayList as $matrixData) {
-            $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData);
-            $count = count($array2);
-            if ($wrkCellCount != $count) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            }
-
-            foreach ($array2 as $i => $val) {
-                if ((!is_numeric($val)) || (is_string($val))) {
-                    $val = 0;
-                }
-                $wrkArray[$i] *= $val;
-            }
-        }
-
-        return array_sum($wrkArray);
-    }
-
-
-    /**
-     * SUMSQ
-     *
-     * SUMSQ returns the sum of the squares of the arguments
-     *
-     * Excel Function:
-     *        SUMSQ(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function SUMSQ()
-    {
-        $returnValue = 0;
-
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $returnValue += ($arg * $arg);
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * SUMX2MY2
-     *
-     * @param    mixed[]    $matrixData1    Matrix #1
-     * @param    mixed[]    $matrixData2    Matrix #2
-     * @return    float
-     */
-    public static function SUMX2MY2($matrixData1, $matrixData2)
-    {
-        $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
-        $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
-        $count = min(count($array1), count($array2));
-
-        $result = 0;
-        for ($i = 0; $i < $count; ++$i) {
-            if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
-                ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
-                $result += ($array1[$i] * $array1[$i]) - ($array2[$i] * $array2[$i]);
-            }
-        }
-
-        return $result;
-    }
-
-
-    /**
-     * SUMX2PY2
-     *
-     * @param    mixed[]    $matrixData1    Matrix #1
-     * @param    mixed[]    $matrixData2    Matrix #2
-     * @return    float
-     */
-    public static function SUMX2PY2($matrixData1, $matrixData2)
-    {
-        $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
-        $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
-        $count = min(count($array1), count($array2));
-
-        $result = 0;
-        for ($i = 0; $i < $count; ++$i) {
-            if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
-                ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
-                $result += ($array1[$i] * $array1[$i]) + ($array2[$i] * $array2[$i]);
-            }
-        }
-
-        return $result;
-    }
-
-
-    /**
-     * SUMXMY2
-     *
-     * @param    mixed[]    $matrixData1    Matrix #1
-     * @param    mixed[]    $matrixData2    Matrix #2
-     * @return    float
-     */
-    public static function SUMXMY2($matrixData1, $matrixData2)
-    {
-        $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
-        $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
-        $count = min(count($array1), count($array2));
-
-        $result = 0;
-        for ($i = 0; $i < $count; ++$i) {
-            if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
-                ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
-                $result += ($array1[$i] - $array2[$i]) * ($array1[$i] - $array2[$i]);
-            }
-        }
-
-        return $result;
-    }
-
-
-    /**
-     * TRUNC
-     *
-     * Truncates value to the number of fractional digits by number_digits.
-     *
-     * @param    float        $value
-     * @param    int            $digits
-     * @return    float        Truncated value
-     */
-    public static function TRUNC($value = 0, $digits = 0)
-    {
-        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $digits    = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
-
-        // Validate parameters
-        if ((!is_numeric($value)) || (!is_numeric($digits))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $digits = floor($digits);
-
-        // Truncate
-        $adjust = pow(10, $digits);
-
-        if (($digits > 0) && (rtrim(intval((abs($value) - abs(intval($value))) * $adjust), '0') < $adjust/10)) {
-            return $value;
-        }
-
-        return (intval($value * $adjust)) / $adjust;
-    }
-}

+ 0 - 3745
libs/PHPExcel/PHPExcel/Calculation/Statistical.php

xqd
@@ -1,3745 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-
-require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/trendClass.php';
-
-
-/** LOG_GAMMA_X_MAX_VALUE */
-define('LOG_GAMMA_X_MAX_VALUE', 2.55e305);
-
-/** XMININ */
-define('XMININ', 2.23e-308);
-
-/** EPS */
-define('EPS', 2.22e-16);
-
-/** SQRT2PI */
-define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099);
-
-/**
- * PHPExcel_Calculation_Statistical
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Statistical
-{
-    private static function checkTrendArrays(&$array1, &$array2)
-    {
-        if (!is_array($array1)) {
-            $array1 = array($array1);
-        }
-        if (!is_array($array2)) {
-            $array2 = array($array2);
-        }
-
-        $array1 = PHPExcel_Calculation_Functions::flattenArray($array1);
-        $array2 = PHPExcel_Calculation_Functions::flattenArray($array2);
-        foreach ($array1 as $key => $value) {
-            if ((is_bool($value)) || (is_string($value)) || (is_null($value))) {
-                unset($array1[$key]);
-                unset($array2[$key]);
-            }
-        }
-        foreach ($array2 as $key => $value) {
-            if ((is_bool($value)) || (is_string($value)) || (is_null($value))) {
-                unset($array1[$key]);
-                unset($array2[$key]);
-            }
-        }
-        $array1 = array_merge($array1);
-        $array2 = array_merge($array2);
-
-        return true;
-    }
-
-
-    /**
-     * Beta function.
-     *
-     * @author Jaco van Kooten
-     *
-     * @param p require p>0
-     * @param q require q>0
-     * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow
-     */
-    private static function beta($p, $q)
-    {
-        if ($p <= 0.0 || $q <= 0.0 || ($p + $q) > LOG_GAMMA_X_MAX_VALUE) {
-            return 0.0;
-        } else {
-            return exp(self::logBeta($p, $q));
-        }
-    }
-
-
-    /**
-     * Incomplete beta function
-     *
-     * @author Jaco van Kooten
-     * @author Paul Meagher
-     *
-     * The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992).
-     * @param x require 0<=x<=1
-     * @param p require p>0
-     * @param q require q>0
-     * @return 0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow
-     */
-    private static function incompleteBeta($x, $p, $q)
-    {
-        if ($x <= 0.0) {
-            return 0.0;
-        } elseif ($x >= 1.0) {
-            return 1.0;
-        } elseif (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) {
-            return 0.0;
-        }
-        $beta_gam = exp((0 - self::logBeta($p, $q)) + $p * log($x) + $q * log(1.0 - $x));
-        if ($x < ($p + 1.0) / ($p + $q + 2.0)) {
-            return $beta_gam * self::betaFraction($x, $p, $q) / $p;
-        } else {
-            return 1.0 - ($beta_gam * self::betaFraction(1 - $x, $q, $p) / $q);
-        }
-    }
-
-
-    // Function cache for logBeta function
-    private static $logBetaCacheP      = 0.0;
-    private static $logBetaCacheQ      = 0.0;
-    private static $logBetaCacheResult = 0.0;
-
-    /**
-     * The natural logarithm of the beta function.
-     *
-     * @param p require p>0
-     * @param q require q>0
-     * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow
-     * @author Jaco van Kooten
-     */
-    private static function logBeta($p, $q)
-    {
-        if ($p != self::$logBetaCacheP || $q != self::$logBetaCacheQ) {
-            self::$logBetaCacheP = $p;
-            self::$logBetaCacheQ = $q;
-            if (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) {
-                self::$logBetaCacheResult = 0.0;
-            } else {
-                self::$logBetaCacheResult = self::logGamma($p) + self::logGamma($q) - self::logGamma($p + $q);
-            }
-        }
-        return self::$logBetaCacheResult;
-    }
-
-
-    /**
-     * Evaluates of continued fraction part of incomplete beta function.
-     * Based on an idea from Numerical Recipes (W.H. Press et al, 1992).
-     * @author Jaco van Kooten
-     */
-    private static function betaFraction($x, $p, $q)
-    {
-        $c = 1.0;
-        $sum_pq = $p + $q;
-        $p_plus = $p + 1.0;
-        $p_minus = $p - 1.0;
-        $h = 1.0 - $sum_pq * $x / $p_plus;
-        if (abs($h) < XMININ) {
-            $h = XMININ;
-        }
-        $h = 1.0 / $h;
-        $frac = $h;
-        $m     = 1;
-        $delta = 0.0;
-        while ($m <= MAX_ITERATIONS && abs($delta-1.0) > PRECISION) {
-            $m2 = 2 * $m;
-            // even index for d
-            $d = $m * ($q - $m) * $x / ( ($p_minus + $m2) * ($p + $m2));
-            $h = 1.0 + $d * $h;
-            if (abs($h) < XMININ) {
-                $h = XMININ;
-            }
-            $h = 1.0 / $h;
-            $c = 1.0 + $d / $c;
-            if (abs($c) < XMININ) {
-                $c = XMININ;
-            }
-            $frac *= $h * $c;
-            // odd index for d
-            $d = -($p + $m) * ($sum_pq + $m) * $x / (($p + $m2) * ($p_plus + $m2));
-            $h = 1.0 + $d * $h;
-            if (abs($h) < XMININ) {
-                $h = XMININ;
-            }
-            $h = 1.0 / $h;
-            $c = 1.0 + $d / $c;
-            if (abs($c) < XMININ) {
-                $c = XMININ;
-            }
-            $delta = $h * $c;
-            $frac *= $delta;
-            ++$m;
-        }
-        return $frac;
-    }
-
-
-    /**
-     * logGamma function
-     *
-     * @version 1.1
-     * @author Jaco van Kooten
-     *
-     * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher.
-     *
-     * The natural logarithm of the gamma function. <br />
-     * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz <br />
-     * Applied Mathematics Division <br />
-     * Argonne National Laboratory <br />
-     * Argonne, IL 60439 <br />
-     * <p>
-     * References:
-     * <ol>
-     * <li>W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural
-     *     Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.</li>
-     * <li>K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.</li>
-     * <li>Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.</li>
-     * </ol>
-     * </p>
-     * <p>
-     * From the original documentation:
-     * </p>
-     * <p>
-     * This routine calculates the LOG(GAMMA) function for a positive real argument X.
-     * Computation is based on an algorithm outlined in references 1 and 2.
-     * The program uses rational functions that theoretically approximate LOG(GAMMA)
-     * to at least 18 significant decimal digits. The approximation for X > 12 is from
-     * reference 3, while approximations for X < 12.0 are similar to those in reference
-     * 1, but are unpublished. The accuracy achieved depends on the arithmetic system,
-     * the compiler, the intrinsic functions, and proper selection of the
-     * machine-dependent constants.
-     * </p>
-     * <p>
-     * Error returns: <br />
-     * The program returns the value XINF for X .LE. 0.0 or when overflow would occur.
-     * The computation is believed to be free of underflow and overflow.
-     * </p>
-     * @return MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305
-     */
-
-    // Function cache for logGamma
-    private static $logGammaCacheResult = 0.0;
-    private static $logGammaCacheX      = 0.0;
-
-    private static function logGamma($x)
-    {
-        // Log Gamma related constants
-        static $lg_d1 = -0.5772156649015328605195174;
-        static $lg_d2 = 0.4227843350984671393993777;
-        static $lg_d4 = 1.791759469228055000094023;
-
-        static $lg_p1 = array(
-            4.945235359296727046734888,
-            201.8112620856775083915565,
-            2290.838373831346393026739,
-            11319.67205903380828685045,
-            28557.24635671635335736389,
-            38484.96228443793359990269,
-            26377.48787624195437963534,
-            7225.813979700288197698961
-        );
-        static $lg_p2 = array(
-            4.974607845568932035012064,
-            542.4138599891070494101986,
-            15506.93864978364947665077,
-            184793.2904445632425417223,
-            1088204.76946882876749847,
-            3338152.967987029735917223,
-            5106661.678927352456275255,
-            3074109.054850539556250927
-        );
-        static $lg_p4 = array(
-            14745.02166059939948905062,
-            2426813.369486704502836312,
-            121475557.4045093227939592,
-            2663432449.630976949898078,
-            29403789566.34553899906876,
-            170266573776.5398868392998,
-            492612579337.743088758812,
-            560625185622.3951465078242
-        );
-        static $lg_q1 = array(
-            67.48212550303777196073036,
-            1113.332393857199323513008,
-            7738.757056935398733233834,
-            27639.87074403340708898585,
-            54993.10206226157329794414,
-            61611.22180066002127833352,
-            36351.27591501940507276287,
-            8785.536302431013170870835
-        );
-        static $lg_q2 = array(
-            183.0328399370592604055942,
-            7765.049321445005871323047,
-            133190.3827966074194402448,
-            1136705.821321969608938755,
-            5267964.117437946917577538,
-            13467014.54311101692290052,
-            17827365.30353274213975932,
-            9533095.591844353613395747
-        );
-        static $lg_q4 = array(
-            2690.530175870899333379843,
-            639388.5654300092398984238,
-            41355999.30241388052042842,
-            1120872109.61614794137657,
-            14886137286.78813811542398,
-            101680358627.2438228077304,
-            341747634550.7377132798597,
-            446315818741.9713286462081
-        );
-        static $lg_c  = array(
-            -0.001910444077728,
-            8.4171387781295e-4,
-            -5.952379913043012e-4,
-            7.93650793500350248e-4,
-            -0.002777777777777681622553,
-            0.08333333333333333331554247,
-            0.0057083835261
-        );
-
-        // Rough estimate of the fourth root of logGamma_xBig
-        static $lg_frtbig = 2.25e76;
-        static $pnt68     = 0.6796875;
-
-
-        if ($x == self::$logGammaCacheX) {
-            return self::$logGammaCacheResult;
-        }
-        $y = $x;
-        if ($y > 0.0 && $y <= LOG_GAMMA_X_MAX_VALUE) {
-            if ($y <= EPS) {
-                $res = -log(y);
-            } elseif ($y <= 1.5) {
-                // ---------------------
-                //    EPS .LT. X .LE. 1.5
-                // ---------------------
-                if ($y < $pnt68) {
-                    $corr = -log($y);
-                    $xm1 = $y;
-                } else {
-                    $corr = 0.0;
-                    $xm1 = $y - 1.0;
-                }
-                if ($y <= 0.5 || $y >= $pnt68) {
-                    $xden = 1.0;
-                    $xnum = 0.0;
-                    for ($i = 0; $i < 8; ++$i) {
-                        $xnum = $xnum * $xm1 + $lg_p1[$i];
-                        $xden = $xden * $xm1 + $lg_q1[$i];
-                    }
-                    $res = $corr + $xm1 * ($lg_d1 + $xm1 * ($xnum / $xden));
-                } else {
-                    $xm2 = $y - 1.0;
-                    $xden = 1.0;
-                    $xnum = 0.0;
-                    for ($i = 0; $i < 8; ++$i) {
-                        $xnum = $xnum * $xm2 + $lg_p2[$i];
-                        $xden = $xden * $xm2 + $lg_q2[$i];
-                    }
-                    $res = $corr + $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden));
-                }
-            } elseif ($y <= 4.0) {
-                // ---------------------
-                //    1.5 .LT. X .LE. 4.0
-                // ---------------------
-                $xm2 = $y - 2.0;
-                $xden = 1.0;
-                $xnum = 0.0;
-                for ($i = 0; $i < 8; ++$i) {
-                    $xnum = $xnum * $xm2 + $lg_p2[$i];
-                    $xden = $xden * $xm2 + $lg_q2[$i];
-                }
-                $res = $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden));
-            } elseif ($y <= 12.0) {
-                // ----------------------
-                //    4.0 .LT. X .LE. 12.0
-                // ----------------------
-                $xm4 = $y - 4.0;
-                $xden = -1.0;
-                $xnum = 0.0;
-                for ($i = 0; $i < 8; ++$i) {
-                    $xnum = $xnum * $xm4 + $lg_p4[$i];
-                    $xden = $xden * $xm4 + $lg_q4[$i];
-                }
-                $res = $lg_d4 + $xm4 * ($xnum / $xden);
-            } else {
-                // ---------------------------------
-                //    Evaluate for argument .GE. 12.0
-                // ---------------------------------
-                $res = 0.0;
-                if ($y <= $lg_frtbig) {
-                    $res = $lg_c[6];
-                    $ysq = $y * $y;
-                    for ($i = 0; $i < 6; ++$i) {
-                        $res = $res / $ysq + $lg_c[$i];
-                    }
-                    $res /= $y;
-                    $corr = log($y);
-                    $res = $res + log(SQRT2PI) - 0.5 * $corr;
-                    $res += $y * ($corr - 1.0);
-                }
-            }
-        } else {
-            // --------------------------
-            //    Return for bad arguments
-            // --------------------------
-            $res = MAX_VALUE;
-        }
-        // ------------------------------
-        //    Final adjustments and return
-        // ------------------------------
-        self::$logGammaCacheX = $x;
-        self::$logGammaCacheResult = $res;
-        return $res;
-    }
-
-
-    //
-    //    Private implementation of the incomplete Gamma function
-    //
-    private static function incompleteGamma($a, $x)
-    {
-        static $max = 32;
-        $summer = 0;
-        for ($n=0; $n<=$max; ++$n) {
-            $divisor = $a;
-            for ($i=1; $i<=$n; ++$i) {
-                $divisor *= ($a + $i);
-            }
-            $summer += (pow($x, $n) / $divisor);
-        }
-        return pow($x, $a) * exp(0-$x) * $summer;
-    }
-
-
-    //
-    //    Private implementation of the Gamma function
-    //
-    private static function gamma($data)
-    {
-        if ($data == 0.0) {
-            return 0;
-        }
-
-        static $p0 = 1.000000000190015;
-        static $p = array(
-            1 => 76.18009172947146,
-            2 => -86.50532032941677,
-            3 => 24.01409824083091,
-            4 => -1.231739572450155,
-            5 => 1.208650973866179e-3,
-            6 => -5.395239384953e-6
-        );
-
-        $y = $x = $data;
-        $tmp = $x + 5.5;
-        $tmp -= ($x + 0.5) * log($tmp);
-
-        $summer = $p0;
-        for ($j=1; $j<=6; ++$j) {
-            $summer += ($p[$j] / ++$y);
-        }
-        return exp(0 - $tmp + log(SQRT2PI * $summer / $x));
-    }
-
-
-    /***************************************************************************
-     *                                inverse_ncdf.php
-     *                            -------------------
-     *    begin                : Friday, January 16, 2004
-     *    copyright            : (C) 2004 Michael Nickerson
-     *    email                : nickersonm@yahoo.com
-     *
-     ***************************************************************************/
-    private static function inverseNcdf($p)
-    {
-        //    Inverse ncdf approximation by Peter J. Acklam, implementation adapted to
-        //    PHP by Michael Nickerson, using Dr. Thomas Ziegler's C implementation as
-        //    a guide. http://home.online.no/~pjacklam/notes/invnorm/index.html
-        //    I have not checked the accuracy of this implementation. Be aware that PHP
-        //    will truncate the coeficcients to 14 digits.
-
-        //    You have permission to use and distribute this function freely for
-        //    whatever purpose you want, but please show common courtesy and give credit
-        //    where credit is due.
-
-        //    Input paramater is $p - probability - where 0 < p < 1.
-
-        //    Coefficients in rational approximations
-        static $a = array(
-            1 => -3.969683028665376e+01,
-            2 => 2.209460984245205e+02,
-            3 => -2.759285104469687e+02,
-            4 => 1.383577518672690e+02,
-            5 => -3.066479806614716e+01,
-            6 => 2.506628277459239e+00
-        );
-
-        static $b = array(
-            1 => -5.447609879822406e+01,
-            2 => 1.615858368580409e+02,
-            3 => -1.556989798598866e+02,
-            4 => 6.680131188771972e+01,
-            5 => -1.328068155288572e+01
-        );
-
-        static $c = array(
-            1 => -7.784894002430293e-03,
-            2 => -3.223964580411365e-01,
-            3 => -2.400758277161838e+00,
-            4 => -2.549732539343734e+00,
-            5 => 4.374664141464968e+00,
-            6 => 2.938163982698783e+00
-        );
-
-        static $d = array(
-            1 => 7.784695709041462e-03,
-            2 => 3.224671290700398e-01,
-            3 => 2.445134137142996e+00,
-            4 => 3.754408661907416e+00
-        );
-
-        //    Define lower and upper region break-points.
-        $p_low = 0.02425;            //Use lower region approx. below this
-        $p_high = 1 - $p_low;        //Use upper region approx. above this
-
-        if (0 < $p && $p < $p_low) {
-            //    Rational approximation for lower region.
-            $q = sqrt(-2 * log($p));
-            return ((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) /
-                    (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1);
-        } elseif ($p_low <= $p && $p <= $p_high) {
-            //    Rational approximation for central region.
-            $q = $p - 0.5;
-            $r = $q * $q;
-            return ((((($a[1] * $r + $a[2]) * $r + $a[3]) * $r + $a[4]) * $r + $a[5]) * $r + $a[6]) * $q /
-                   ((((($b[1] * $r + $b[2]) * $r + $b[3]) * $r + $b[4]) * $r + $b[5]) * $r + 1);
-        } elseif ($p_high < $p && $p < 1) {
-            //    Rational approximation for upper region.
-            $q = sqrt(-2 * log(1 - $p));
-            return -((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) /
-                     (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1);
-        }
-        //    If 0 < p < 1, return a null value
-        return PHPExcel_Calculation_Functions::NULL();
-    }
-
-
-    private static function inverseNcdf2($prob)
-    {
-        //    Approximation of inverse standard normal CDF developed by
-        //    B. Moro, "The Full Monte," Risk 8(2), Feb 1995, 57-58.
-
-        $a1 = 2.50662823884;
-        $a2 = -18.61500062529;
-        $a3 = 41.39119773534;
-        $a4 = -25.44106049637;
-
-        $b1 = -8.4735109309;
-        $b2 = 23.08336743743;
-        $b3 = -21.06224101826;
-        $b4 = 3.13082909833;
-
-        $c1 = 0.337475482272615;
-        $c2 = 0.976169019091719;
-        $c3 = 0.160797971491821;
-        $c4 = 2.76438810333863E-02;
-        $c5 = 3.8405729373609E-03;
-        $c6 = 3.951896511919E-04;
-        $c7 = 3.21767881768E-05;
-        $c8 = 2.888167364E-07;
-        $c9 = 3.960315187E-07;
-
-        $y = $prob - 0.5;
-        if (abs($y) < 0.42) {
-            $z = ($y * $y);
-            $z = $y * ((($a4 * $z + $a3) * $z + $a2) * $z + $a1) / (((($b4 * $z + $b3) * $z + $b2) * $z + $b1) * $z + 1);
-        } else {
-            if ($y > 0) {
-                $z = log(-log(1 - $prob));
-            } else {
-                $z = log(-log($prob));
-            }
-            $z = $c1 + $z * ($c2 + $z * ($c3 + $z * ($c4 + $z * ($c5 + $z * ($c6 + $z * ($c7 + $z * ($c8 + $z * $c9)))))));
-            if ($y < 0) {
-                $z = -$z;
-            }
-        }
-        return $z;
-    }    //    function inverseNcdf2()
-
-
-    private static function inverseNcdf3($p)
-    {
-        //    ALGORITHM AS241 APPL. STATIST. (1988) VOL. 37, NO. 3.
-        //    Produces the normal deviate Z corresponding to a given lower
-        //    tail area of P; Z is accurate to about 1 part in 10**16.
-        //
-        //    This is a PHP version of the original FORTRAN code that can
-        //    be found at http://lib.stat.cmu.edu/apstat/
-        $split1 = 0.425;
-        $split2 = 5;
-        $const1 = 0.180625;
-        $const2 = 1.6;
-
-        //    coefficients for p close to 0.5
-        $a0 = 3.3871328727963666080;
-        $a1 = 1.3314166789178437745E+2;
-        $a2 = 1.9715909503065514427E+3;
-        $a3 = 1.3731693765509461125E+4;
-        $a4 = 4.5921953931549871457E+4;
-        $a5 = 6.7265770927008700853E+4;
-        $a6 = 3.3430575583588128105E+4;
-        $a7 = 2.5090809287301226727E+3;
-
-        $b1 = 4.2313330701600911252E+1;
-        $b2 = 6.8718700749205790830E+2;
-        $b3 = 5.3941960214247511077E+3;
-        $b4 = 2.1213794301586595867E+4;
-        $b5 = 3.9307895800092710610E+4;
-        $b6 = 2.8729085735721942674E+4;
-        $b7 = 5.2264952788528545610E+3;
-
-        //    coefficients for p not close to 0, 0.5 or 1.
-        $c0 = 1.42343711074968357734;
-        $c1 = 4.63033784615654529590;
-        $c2 = 5.76949722146069140550;
-        $c3 = 3.64784832476320460504;
-        $c4 = 1.27045825245236838258;
-        $c5 = 2.41780725177450611770E-1;
-        $c6 = 2.27238449892691845833E-2;
-        $c7 = 7.74545014278341407640E-4;
-
-        $d1 = 2.05319162663775882187;
-        $d2 = 1.67638483018380384940;
-        $d3 = 6.89767334985100004550E-1;
-        $d4 = 1.48103976427480074590E-1;
-        $d5 = 1.51986665636164571966E-2;
-        $d6 = 5.47593808499534494600E-4;
-        $d7 = 1.05075007164441684324E-9;
-
-        //    coefficients for p near 0 or 1.
-        $e0 = 6.65790464350110377720;
-        $e1 = 5.46378491116411436990;
-        $e2 = 1.78482653991729133580;
-        $e3 = 2.96560571828504891230E-1;
-        $e4 = 2.65321895265761230930E-2;
-        $e5 = 1.24266094738807843860E-3;
-        $e6 = 2.71155556874348757815E-5;
-        $e7 = 2.01033439929228813265E-7;
-
-        $f1 = 5.99832206555887937690E-1;
-        $f2 = 1.36929880922735805310E-1;
-        $f3 = 1.48753612908506148525E-2;
-        $f4 = 7.86869131145613259100E-4;
-        $f5 = 1.84631831751005468180E-5;
-        $f6 = 1.42151175831644588870E-7;
-        $f7 = 2.04426310338993978564E-15;
-
-        $q = $p - 0.5;
-
-        //    computation for p close to 0.5
-        if (abs($q) <= split1) {
-            $R = $const1 - $q * $q;
-            $z = $q * ((((((($a7 * $R + $a6) * $R + $a5) * $R + $a4) * $R + $a3) * $R + $a2) * $R + $a1) * $R + $a0) /
-                      ((((((($b7 * $R + $b6) * $R + $b5) * $R + $b4) * $R + $b3) * $R + $b2) * $R + $b1) * $R + 1);
-        } else {
-            if ($q < 0) {
-                $R = $p;
-            } else {
-                $R = 1 - $p;
-            }
-            $R = pow(-log($R), 2);
-
-            //    computation for p not close to 0, 0.5 or 1.
-            if ($R <= $split2) {
-                $R = $R - $const2;
-                $z = ((((((($c7 * $R + $c6) * $R + $c5) * $R + $c4) * $R + $c3) * $R + $c2) * $R + $c1) * $R + $c0) /
-                     ((((((($d7 * $R + $d6) * $R + $d5) * $R + $d4) * $R + $d3) * $R + $d2) * $R + $d1) * $R + 1);
-            } else {
-            //    computation for p near 0 or 1.
-                $R = $R - $split2;
-                $z = ((((((($e7 * $R + $e6) * $R + $e5) * $R + $e4) * $R + $e3) * $R + $e2) * $R + $e1) * $R + $e0) /
-                     ((((((($f7 * $R + $f6) * $R + $f5) * $R + $f4) * $R + $f3) * $R + $f2) * $R + $f1) * $R + 1);
-            }
-            if ($q < 0) {
-                $z = -$z;
-            }
-        }
-        return $z;
-    }
-
-
-    /**
-     * AVEDEV
-     *
-     * Returns the average of the absolute deviations of data points from their mean.
-     * AVEDEV is a measure of the variability in a data set.
-     *
-     * Excel Function:
-     *        AVEDEV(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function AVEDEV()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        // Return value
-        $returnValue = null;
-
-        $aMean = self::AVERAGE($aArgs);
-        if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
-            $aCount = 0;
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                    $arg = (integer) $arg;
-                }
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    if (is_null($returnValue)) {
-                        $returnValue = abs($arg - $aMean);
-                    } else {
-                        $returnValue += abs($arg - $aMean);
-                    }
-                    ++$aCount;
-                }
-            }
-
-            // Return
-            if ($aCount == 0) {
-                return PHPExcel_Calculation_Functions::DIV0();
-            }
-            return $returnValue / $aCount;
-        }
-        return PHPExcel_Calculation_Functions::NaN();
-    }
-
-
-    /**
-     * AVERAGE
-     *
-     * Returns the average (arithmetic mean) of the arguments
-     *
-     * Excel Function:
-     *        AVERAGE(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function AVERAGE()
-    {
-        $returnValue = $aCount = 0;
-
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
-            if ((is_bool($arg)) &&
-                ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                $arg = (integer) $arg;
-            }
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if (is_null($returnValue)) {
-                    $returnValue = $arg;
-                } else {
-                    $returnValue += $arg;
-                }
-                ++$aCount;
-            }
-        }
-
-        // Return
-        if ($aCount > 0) {
-            return $returnValue / $aCount;
-        } else {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-    }
-
-
-    /**
-     * AVERAGEA
-     *
-     * Returns the average of its arguments, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        AVERAGEA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function AVERAGEA()
-    {
-        $returnValue = null;
-
-        $aCount = 0;
-        // Loop through arguments
-        foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
-            if ((is_bool($arg)) &&
-                (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-            } else {
-                if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
-                    if (is_bool($arg)) {
-                        $arg = (integer) $arg;
-                    } elseif (is_string($arg)) {
-                        $arg = 0;
-                    }
-                    if (is_null($returnValue)) {
-                        $returnValue = $arg;
-                    } else {
-                        $returnValue += $arg;
-                    }
-                    ++$aCount;
-                }
-            }
-        }
-
-        if ($aCount > 0) {
-            return $returnValue / $aCount;
-        } else {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-    }
-
-
-    /**
-     * AVERAGEIF
-     *
-     * Returns the average value from a range of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        AVERAGEIF(value1[,value2[, ...]],condition)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    string        $condition        The criteria that defines which cells will be checked.
-     * @param    mixed[]        $averageArgs    Data values
-     * @return    float
-     */
-    public static function AVERAGEIF($aArgs, $condition, $averageArgs = array())
-    {
-        $returnValue = 0;
-
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
-        $averageArgs = PHPExcel_Calculation_Functions::flattenArray($averageArgs);
-        if (empty($averageArgs)) {
-            $averageArgs = $aArgs;
-        }
-        $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
-        // Loop through arguments
-        $aCount = 0;
-        foreach ($aArgs as $key => $arg) {
-            if (!is_numeric($arg)) {
-                $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-            }
-            $testCondition = '='.$arg.$condition;
-            if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                if ((is_null($returnValue)) || ($arg > $returnValue)) {
-                    $returnValue += $arg;
-                    ++$aCount;
-                }
-            }
-        }
-
-        if ($aCount > 0) {
-            return $returnValue / $aCount;
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * BETADIST
-     *
-     * Returns the beta distribution.
-     *
-     * @param    float        $value            Value at which you want to evaluate the distribution
-     * @param    float        $alpha            Parameter to the distribution
-     * @param    float        $beta            Parameter to the distribution
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-        $beta  = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
-        $rMin  = PHPExcel_Calculation_Functions::flattenSingleValue($rMin);
-        $rMax  = PHPExcel_Calculation_Functions::flattenSingleValue($rMax);
-
-        if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) {
-            if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ($rMin > $rMax) {
-                $tmp = $rMin;
-                $rMin = $rMax;
-                $rMax = $tmp;
-            }
-            $value -= $rMin;
-            $value /= ($rMax - $rMin);
-            return self::incompleteBeta($value, $alpha, $beta);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * BETAINV
-     *
-     * Returns the inverse of the beta distribution.
-     *
-     * @param    float        $probability    Probability at which you want to evaluate the distribution
-     * @param    float        $alpha            Parameter to the distribution
-     * @param    float        $beta            Parameter to the distribution
-     * @param    float        $rMin            Minimum value
-     * @param    float        $rMax            Maximum value
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $alpha       = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-        $beta        = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
-        $rMin        = PHPExcel_Calculation_Functions::flattenSingleValue($rMin);
-        $rMax        = PHPExcel_Calculation_Functions::flattenSingleValue($rMax);
-
-        if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) {
-            if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ($rMin > $rMax) {
-                $tmp = $rMin;
-                $rMin = $rMax;
-                $rMax = $tmp;
-            }
-            $a = 0;
-            $b = 2;
-
-            $i = 0;
-            while ((($b - $a) > PRECISION) && ($i++ < MAX_ITERATIONS)) {
-                $guess = ($a + $b) / 2;
-                $result = self::BETADIST($guess, $alpha, $beta);
-                if (($result == $probability) || ($result == 0)) {
-                    $b = $a;
-                } elseif ($result > $probability) {
-                    $b = $guess;
-                } else {
-                    $a = $guess;
-                }
-            }
-            if ($i == MAX_ITERATIONS) {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            return round($rMin + $guess * ($rMax - $rMin), 12);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * BINOMDIST
-     *
-     * Returns the individual term binomial distribution probability. Use BINOMDIST in problems with
-     *        a fixed number of tests or trials, when the outcomes of any trial are only success or failure,
-     *        when trials are independent, and when the probability of success is constant throughout the
-     *        experiment. For example, BINOMDIST can calculate the probability that two of the next three
-     *        babies born are male.
-     *
-     * @param    float        $value            Number of successes in trials
-     * @param    float        $trials            Number of trials
-     * @param    float        $probability    Probability of success on each trial
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     * @todo    Cumulative distribution function
-     *
-     */
-    public static function BINOMDIST($value, $trials, $probability, $cumulative)
-    {
-        $value       = floor(PHPExcel_Calculation_Functions::flattenSingleValue($value));
-        $trials      = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials));
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-
-        if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) {
-            if (($value < 0) || ($value > $trials)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if (($probability < 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    $summer = 0;
-                    for ($i = 0; $i <= $value; ++$i) {
-                        $summer += PHPExcel_Calculation_MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i);
-                    }
-                    return $summer;
-                } else {
-                    return PHPExcel_Calculation_MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value) ;
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * CHIDIST
-     *
-     * Returns the one-tailed probability of the chi-squared distribution.
-     *
-     * @param    float        $value            Value for the function
-     * @param    float        $degrees        degrees of freedom
-     * @return    float
-     */
-    public static function CHIDIST($value, $degrees)
-    {
-        $value   = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
-
-        if ((is_numeric($value)) && (is_numeric($degrees))) {
-            if ($degrees < 1) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ($value < 0) {
-                if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                    return 1;
-                }
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return 1 - (self::incompleteGamma($degrees/2, $value/2) / self::gamma($degrees/2));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * CHIINV
-     *
-     * Returns the one-tailed probability of the chi-squared distribution.
-     *
-     * @param    float        $probability    Probability for the function
-     * @param    float        $degrees        degrees of freedom
-     * @return    float
-     */
-    public static function CHIINV($probability, $degrees)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $degrees     = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
-
-        if ((is_numeric($probability)) && (is_numeric($degrees))) {
-            $xLo = 100;
-            $xHi = 0;
-
-            $x = $xNew = 1;
-            $dx    = 1;
-            $i = 0;
-
-            while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) {
-                // Apply Newton-Raphson step
-                $result = self::CHIDIST($x, $degrees);
-                $error = $result - $probability;
-                if ($error == 0.0) {
-                    $dx = 0;
-                } elseif ($error < 0.0) {
-                    $xLo = $x;
-                } else {
-                    $xHi = $x;
-                }
-                // Avoid division by zero
-                if ($result != 0.0) {
-                    $dx = $error / $result;
-                    $xNew = $x - $dx;
-                }
-                // If the NR fails to converge (which for example may be the
-                // case if the initial guess is too rough) we apply a bisection
-                // step to determine a more narrow interval around the root.
-                if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) {
-                    $xNew = ($xLo + $xHi) / 2;
-                    $dx = $xNew - $x;
-                }
-                $x = $xNew;
-            }
-            if ($i == MAX_ITERATIONS) {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            return round($x, 12);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * CONFIDENCE
-     *
-     * Returns the confidence interval for a population mean
-     *
-     * @param    float        $alpha
-     * @param    float        $stdDev        Standard Deviation
-     * @param    float        $size
-     * @return    float
-     *
-     */
-    public static function CONFIDENCE($alpha, $stdDev, $size)
-    {
-        $alpha  = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-        $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-        $size   = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size));
-
-        if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) {
-            if (($alpha <= 0) || ($alpha >= 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if (($stdDev <= 0) || ($size < 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * CORREL
-     *
-     * Returns covariance, the average of the products of deviations for each data point pair.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function CORREL($yValues, $xValues = null)
-    {
-        if ((is_null($xValues)) || (!is_array($yValues)) || (!is_array($xValues))) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getCorrelation();
-    }
-
-
-    /**
-     * COUNT
-     *
-     * Counts the number of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        COUNT(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    int
-     */
-    public static function COUNT()
-    {
-        $returnValue = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-        foreach ($aArgs as $k => $arg) {
-            if ((is_bool($arg)) &&
-                ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                $arg = (integer) $arg;
-            }
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                ++$returnValue;
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * COUNTA
-     *
-     * Counts the number of cells that are not empty within the list of arguments
-     *
-     * Excel Function:
-     *        COUNTA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    int
-     */
-    public static function COUNTA()
-    {
-        $returnValue = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric, boolean or string value?
-            if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
-                ++$returnValue;
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * COUNTBLANK
-     *
-     * Counts the number of empty cells within the list of arguments
-     *
-     * Excel Function:
-     *        COUNTBLANK(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    int
-     */
-    public static function COUNTBLANK()
-    {
-        $returnValue = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a blank cell?
-            if ((is_null($arg)) || ((is_string($arg)) && ($arg == ''))) {
-                ++$returnValue;
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * COUNTIF
-     *
-     * Counts the number of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        COUNTIF(value1[,value2[, ...]],condition)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    string        $condition        The criteria that defines which cells will be counted.
-     * @return    int
-     */
-    public static function COUNTIF($aArgs, $condition)
-    {
-        $returnValue = 0;
-
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
-        $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
-        // Loop through arguments
-        foreach ($aArgs as $arg) {
-            if (!is_numeric($arg)) {
-                $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-            }
-            $testCondition = '='.$arg.$condition;
-            if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                // Is it a value within our criteria
-                ++$returnValue;
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * COVAR
-     *
-     * Returns covariance, the average of the products of deviations for each data point pair.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function COVAR($yValues, $xValues)
-    {
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getCovariance();
-    }
-
-
-    /**
-     * CRITBINOM
-     *
-     * Returns the smallest value for which the cumulative binomial distribution is greater
-     *        than or equal to a criterion value
-     *
-     * See http://support.microsoft.com/kb/828117/ for details of the algorithm used
-     *
-     * @param    float        $trials            number of Bernoulli trials
-     * @param    float        $probability    probability of a success on each trial
-     * @param    float        $alpha            criterion value
-     * @return    int
-     *
-     * @todo    Warning. This implementation differs from the algorithm detailed on the MS
-     *            web site in that $CumPGuessMinus1 = $CumPGuess - 1 rather than $CumPGuess - $PGuess
-     *            This eliminates a potential endless loop error, but may have an adverse affect on the
-     *            accuracy of the function (although all my tests have so far returned correct results).
-     *
-     */
-    public static function CRITBINOM($trials, $probability, $alpha)
-    {
-        $trials      = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials));
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $alpha       = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-
-        if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) {
-            if ($trials < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } elseif (($probability < 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } elseif (($alpha < 0) || ($alpha > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } elseif ($alpha <= 0.5) {
-                $t = sqrt(log(1 / ($alpha * $alpha)));
-                $trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t));
-            } else {
-                $t = sqrt(log(1 / pow(1 - $alpha, 2)));
-                $trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t);
-            }
-            $Guess = floor($trials * $probability + $trialsApprox * sqrt($trials * $probability * (1 - $probability)));
-            if ($Guess < 0) {
-                $Guess = 0;
-            } elseif ($Guess > $trials) {
-                $Guess = $trials;
-            }
-
-            $TotalUnscaledProbability = $UnscaledPGuess = $UnscaledCumPGuess = 0.0;
-            $EssentiallyZero = 10e-12;
-
-            $m = floor($trials * $probability);
-            ++$TotalUnscaledProbability;
-            if ($m == $Guess) {
-                ++$UnscaledPGuess;
-            }
-            if ($m <= $Guess) {
-                ++$UnscaledCumPGuess;
-            }
-
-            $PreviousValue = 1;
-            $Done = false;
-            $k = $m + 1;
-            while ((!$Done) && ($k <= $trials)) {
-                $CurrentValue = $PreviousValue * ($trials - $k + 1) * $probability / ($k * (1 - $probability));
-                $TotalUnscaledProbability += $CurrentValue;
-                if ($k == $Guess) {
-                    $UnscaledPGuess += $CurrentValue;
-                }
-                if ($k <= $Guess) {
-                    $UnscaledCumPGuess += $CurrentValue;
-                }
-                if ($CurrentValue <= $EssentiallyZero) {
-                    $Done = true;
-                }
-                $PreviousValue = $CurrentValue;
-                ++$k;
-            }
-
-            $PreviousValue = 1;
-            $Done = false;
-            $k = $m - 1;
-            while ((!$Done) && ($k >= 0)) {
-                $CurrentValue = $PreviousValue * $k + 1 * (1 - $probability) / (($trials - $k) * $probability);
-                $TotalUnscaledProbability += $CurrentValue;
-                if ($k == $Guess) {
-                    $UnscaledPGuess += $CurrentValue;
-                }
-                if ($k <= $Guess) {
-                    $UnscaledCumPGuess += $CurrentValue;
-                }
-                if ($CurrentValue <= $EssentiallyZero) {
-                    $Done = true;
-                }
-                $PreviousValue = $CurrentValue;
-                --$k;
-            }
-
-            $PGuess = $UnscaledPGuess / $TotalUnscaledProbability;
-            $CumPGuess = $UnscaledCumPGuess / $TotalUnscaledProbability;
-
-//            $CumPGuessMinus1 = $CumPGuess - $PGuess;
-            $CumPGuessMinus1 = $CumPGuess - 1;
-
-            while (true) {
-                if (($CumPGuessMinus1 < $alpha) && ($CumPGuess >= $alpha)) {
-                    return $Guess;
-                } elseif (($CumPGuessMinus1 < $alpha) && ($CumPGuess < $alpha)) {
-                    $PGuessPlus1 = $PGuess * ($trials - $Guess) * $probability / $Guess / (1 - $probability);
-                    $CumPGuessMinus1 = $CumPGuess;
-                    $CumPGuess = $CumPGuess + $PGuessPlus1;
-                    $PGuess = $PGuessPlus1;
-                    ++$Guess;
-                } elseif (($CumPGuessMinus1 >= $alpha) && ($CumPGuess >= $alpha)) {
-                    $PGuessMinus1 = $PGuess * $Guess * (1 - $probability) / ($trials - $Guess + 1) / $probability;
-                    $CumPGuess = $CumPGuessMinus1;
-                    $CumPGuessMinus1 = $CumPGuessMinus1 - $PGuess;
-                    $PGuess = $PGuessMinus1;
-                    --$Guess;
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * DEVSQ
-     *
-     * Returns the sum of squares of deviations of data points from their sample mean.
-     *
-     * Excel Function:
-     *        DEVSQ(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function DEVSQ()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        // Return value
-        $returnValue = null;
-
-        $aMean = self::AVERAGE($aArgs);
-        if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
-            $aCount = -1;
-            foreach ($aArgs as $k => $arg) {
-                // Is it a numeric value?
-                if ((is_bool($arg)) &&
-                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) ||
-                    (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                    $arg = (integer) $arg;
-                }
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    if (is_null($returnValue)) {
-                        $returnValue = pow(($arg - $aMean), 2);
-                    } else {
-                        $returnValue += pow(($arg - $aMean), 2);
-                    }
-                    ++$aCount;
-                }
-            }
-
-            // Return
-            if (is_null($returnValue)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } else {
-                return $returnValue;
-            }
-        }
-        return self::NA();
-    }
-
-
-    /**
-     * EXPONDIST
-     *
-     *    Returns the exponential distribution. Use EXPONDIST to model the time between events,
-     *        such as how long an automated bank teller takes to deliver cash. For example, you can
-     *        use EXPONDIST to determine the probability that the process takes at most 1 minute.
-     *
-     * @param    float        $value            Value of the function
-     * @param    float        $lambda            The parameter value
-     * @param    boolean        $cumulative
-     * @return    float
-     */
-    public static function EXPONDIST($value, $lambda, $cumulative)
-    {
-        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $lambda    = PHPExcel_Calculation_Functions::flattenSingleValue($lambda);
-        $cumulative    = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative);
-
-        if ((is_numeric($value)) && (is_numeric($lambda))) {
-            if (($value < 0) || ($lambda < 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    return 1 - exp(0-$value*$lambda);
-                } else {
-                    return $lambda * exp(0-$value*$lambda);
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FISHER
-     *
-     * Returns the Fisher transformation at x. This transformation produces a function that
-     *        is normally distributed rather than skewed. Use this function to perform hypothesis
-     *        testing on the correlation coefficient.
-     *
-     * @param    float        $value
-     * @return    float
-     */
-    public static function FISHER($value)
-    {
-        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        if (is_numeric($value)) {
-            if (($value <= -1) || ($value >= 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return 0.5 * log((1+$value)/(1-$value));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FISHERINV
-     *
-     * Returns the inverse of the Fisher transformation. Use this transformation when
-     *        analyzing correlations between ranges or arrays of data. If y = FISHER(x), then
-     *        FISHERINV(y) = x.
-     *
-     * @param    float        $value
-     * @return    float
-     */
-    public static function FISHERINV($value)
-    {
-        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        if (is_numeric($value)) {
-            return (exp(2 * $value) - 1) / (exp(2 * $value) + 1);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FORECAST
-     *
-     * Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value.
-     *
-     * @param    float                Value of X for which we want to find Y
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function FORECAST($xValue, $yValues, $xValues)
-    {
-        $xValue    = PHPExcel_Calculation_Functions::flattenSingleValue($xValue);
-        if (!is_numeric($xValue)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        } elseif (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getValueOfYForX($xValue);
-    }
-
-
-    /**
-     * GAMMADIST
-     *
-     * Returns the gamma distribution.
-     *
-     * @param    float        $value            Value at which you want to evaluate the distribution
-     * @param    float        $a                Parameter to the distribution
-     * @param    float        $b                Parameter to the distribution
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function GAMMADIST($value, $a, $b, $cumulative)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $a     = PHPExcel_Calculation_Functions::flattenSingleValue($a);
-        $b     = PHPExcel_Calculation_Functions::flattenSingleValue($b);
-
-        if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) {
-            if (($value < 0) || ($a <= 0) || ($b <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    return self::incompleteGamma($a, $value / $b) / self::gamma($a);
-                } else {
-                    return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a-1) * exp(0-($value / $b));
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * GAMMAINV
-     *
-     * Returns the inverse of the beta distribution.
-     *
-     * @param    float        $probability    Probability at which you want to evaluate the distribution
-     * @param    float        $alpha            Parameter to the distribution
-     * @param    float        $beta            Parameter to the distribution
-     * @return    float
-     *
-     */
-    public static function GAMMAINV($probability, $alpha, $beta)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $alpha       = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-        $beta        = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
-
-        if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) {
-            if (($alpha <= 0) || ($beta <= 0) || ($probability < 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-
-            $xLo = 0;
-            $xHi = $alpha * $beta * 5;
-
-            $x = $xNew = 1;
-            $error = $pdf = 0;
-            $dx    = 1024;
-            $i = 0;
-
-            while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) {
-                // Apply Newton-Raphson step
-                $error = self::GAMMADIST($x, $alpha, $beta, true) - $probability;
-                if ($error < 0.0) {
-                    $xLo = $x;
-                } else {
-                    $xHi = $x;
-                }
-                $pdf = self::GAMMADIST($x, $alpha, $beta, false);
-                // Avoid division by zero
-                if ($pdf != 0.0) {
-                    $dx = $error / $pdf;
-                    $xNew = $x - $dx;
-                }
-                // If the NR fails to converge (which for example may be the
-                // case if the initial guess is too rough) we apply a bisection
-                // step to determine a more narrow interval around the root.
-                if (($xNew < $xLo) || ($xNew > $xHi) || ($pdf == 0.0)) {
-                    $xNew = ($xLo + $xHi) / 2;
-                    $dx = $xNew - $x;
-                }
-                $x = $xNew;
-            }
-            if ($i == MAX_ITERATIONS) {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            return $x;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * GAMMALN
-     *
-     * Returns the natural logarithm of the gamma function.
-     *
-     * @param    float        $value
-     * @return    float
-     */
-    public static function GAMMALN($value)
-    {
-        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        if (is_numeric($value)) {
-            if ($value <= 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return log(self::gamma($value));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * GEOMEAN
-     *
-     * Returns the geometric mean of an array or range of positive data. For example, you
-     *        can use GEOMEAN to calculate average growth rate given compound interest with
-     *        variable rates.
-     *
-     * Excel Function:
-     *        GEOMEAN(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function GEOMEAN()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        $aMean = PHPExcel_Calculation_MathTrig::PRODUCT($aArgs);
-        if (is_numeric($aMean) && ($aMean > 0)) {
-            $aCount = self::COUNT($aArgs) ;
-            if (self::MIN($aArgs) > 0) {
-                return pow($aMean, (1 / $aCount));
-            }
-        }
-        return PHPExcel_Calculation_Functions::NaN();
-    }
-
-
-    /**
-     * GROWTH
-     *
-     * Returns values along a predicted emponential trend
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @param    array of mixed        Values of X for which we want to find Y
-     * @param    boolean                A logical value specifying whether to force the intersect to equal 0.
-     * @return    array of float
-     */
-    public static function GROWTH($yValues, $xValues = array(), $newValues = array(), $const = true)
-    {
-        $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues);
-        $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues);
-        $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues);
-        $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
-
-        $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
-        if (empty($newValues)) {
-            $newValues = $bestFitExponential->getXValues();
-        }
-
-        $returnArray = array();
-        foreach ($newValues as $xValue) {
-            $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue);
-        }
-
-        return $returnArray;
-    }
-
-
-    /**
-     * HARMEAN
-     *
-     * Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the
-     *        arithmetic mean of reciprocals.
-     *
-     * Excel Function:
-     *        HARMEAN(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function HARMEAN()
-    {
-        // Return value
-        $returnValue = PHPExcel_Calculation_Functions::NA();
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        if (self::MIN($aArgs) < 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $aCount = 0;
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if ($arg <= 0) {
-                    return PHPExcel_Calculation_Functions::NaN();
-                }
-                if (is_null($returnValue)) {
-                    $returnValue = (1 / $arg);
-                } else {
-                    $returnValue += (1 / $arg);
-                }
-                ++$aCount;
-            }
-        }
-
-        // Return
-        if ($aCount > 0) {
-            return 1 / ($returnValue / $aCount);
-        } else {
-            return $returnValue;
-        }
-    }
-
-
-    /**
-     * HYPGEOMDIST
-     *
-     * Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of
-     * sample successes, given the sample size, population successes, and population size.
-     *
-     * @param    float        $sampleSuccesses        Number of successes in the sample
-     * @param    float        $sampleNumber            Size of the sample
-     * @param    float        $populationSuccesses    Number of successes in the population
-     * @param    float        $populationNumber        Population size
-     * @return    float
-     *
-     */
-    public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber)
-    {
-        $sampleSuccesses     = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleSuccesses));
-        $sampleNumber        = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleNumber));
-        $populationSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationSuccesses));
-        $populationNumber    = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationNumber));
-
-        if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) {
-            if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return PHPExcel_Calculation_MathTrig::COMBIN($populationSuccesses, $sampleSuccesses) *
-                   PHPExcel_Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses, $sampleNumber - $sampleSuccesses) /
-                   PHPExcel_Calculation_MathTrig::COMBIN($populationNumber, $sampleNumber);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * INTERCEPT
-     *
-     * Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function INTERCEPT($yValues, $xValues)
-    {
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getIntersect();
-    }
-
-
-    /**
-     * KURT
-     *
-     * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness
-     * or flatness of a distribution compared with the normal distribution. Positive
-     * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a
-     * relatively flat distribution.
-     *
-     * @param    array    Data Series
-     * @return    float
-     */
-    public static function KURT()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-        $mean = self::AVERAGE($aArgs);
-        $stdDev = self::STDEV($aArgs);
-
-        if ($stdDev > 0) {
-            $count = $summer = 0;
-            // Loop through arguments
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-                } else {
-                    // Is it a numeric value?
-                    if ((is_numeric($arg)) && (!is_string($arg))) {
-                        $summer += pow((($arg - $mean) / $stdDev), 4);
-                        ++$count;
-                    }
-                }
-            }
-
-            // Return
-            if ($count > 3) {
-                return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1, 2) / (($count-2) * ($count-3)));
-            }
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * LARGE
-     *
-     * Returns the nth largest value in a data set. You can use this function to
-     *        select a value based on its relative standing.
-     *
-     * Excel Function:
-     *        LARGE(value1[,value2[, ...]],entry)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    int            $entry            Position (ordered from the largest) in the array or range of data to return
-     * @return    float
-     *
-     */
-    public static function LARGE()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $entry = floor(array_pop($aArgs));
-
-        if ((is_numeric($entry)) && (!is_string($entry))) {
-            $mArgs = array();
-            foreach ($aArgs as $arg) {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $mArgs[] = $arg;
-                }
-            }
-            $count = self::COUNT($mArgs);
-            $entry = floor(--$entry);
-            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            rsort($mArgs);
-            return $mArgs[$entry];
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * LINEST
-     *
-     * Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data,
-     *        and then returns an array that describes the line.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @param    boolean                A logical value specifying whether to force the intersect to equal 0.
-     * @param    boolean                A logical value specifying whether to return additional regression statistics.
-     * @return    array
-     */
-    public static function LINEST($yValues, $xValues = null, $const = true, $stats = false)
-    {
-        $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
-        $stats = (is_null($stats)) ? false : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
-        if (is_null($xValues)) {
-            $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
-        }
-
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return 0;
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const);
-        if ($stats) {
-            return array(
-                array(
-                    $bestFitLinear->getSlope(),
-                    $bestFitLinear->getSlopeSE(),
-                    $bestFitLinear->getGoodnessOfFit(),
-                    $bestFitLinear->getF(),
-                    $bestFitLinear->getSSRegression(),
-                ),
-                array(
-                    $bestFitLinear->getIntersect(),
-                    $bestFitLinear->getIntersectSE(),
-                    $bestFitLinear->getStdevOfResiduals(),
-                    $bestFitLinear->getDFResiduals(),
-                    $bestFitLinear->getSSResiduals()
-                )
-            );
-        } else {
-            return array(
-                $bestFitLinear->getSlope(),
-                $bestFitLinear->getIntersect()
-            );
-        }
-    }
-
-
-    /**
-     * LOGEST
-     *
-     * Calculates an exponential curve that best fits the X and Y data series,
-     *        and then returns an array that describes the line.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @param    boolean                A logical value specifying whether to force the intersect to equal 0.
-     * @param    boolean                A logical value specifying whether to return additional regression statistics.
-     * @return    array
-     */
-    public static function LOGEST($yValues, $xValues = null, $const = true, $stats = false)
-    {
-        $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
-        $stats = (is_null($stats)) ? false : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
-        if (is_null($xValues)) {
-            $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
-        }
-
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        foreach ($yValues as $value) {
-            if ($value <= 0.0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-        }
-
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return 1;
-        }
-
-        $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
-        if ($stats) {
-            return array(
-                array(
-                    $bestFitExponential->getSlope(),
-                    $bestFitExponential->getSlopeSE(),
-                    $bestFitExponential->getGoodnessOfFit(),
-                    $bestFitExponential->getF(),
-                    $bestFitExponential->getSSRegression(),
-                ),
-                array(
-                    $bestFitExponential->getIntersect(),
-                    $bestFitExponential->getIntersectSE(),
-                    $bestFitExponential->getStdevOfResiduals(),
-                    $bestFitExponential->getDFResiduals(),
-                    $bestFitExponential->getSSResiduals()
-                )
-            );
-        } else {
-            return array(
-                $bestFitExponential->getSlope(),
-                $bestFitExponential->getIntersect()
-            );
-        }
-    }
-
-
-    /**
-     * LOGINV
-     *
-     * Returns the inverse of the normal cumulative distribution
-     *
-     * @param    float        $probability
-     * @param    float        $mean
-     * @param    float        $stdDev
-     * @return    float
-     *
-     * @todo    Try implementing P J Acklam's refinement algorithm for greater
-     *            accuracy if I can get my head round the mathematics
-     *            (as described at) http://home.online.no/~pjacklam/notes/invnorm/
-     */
-    public static function LOGINV($probability, $mean, $stdDev)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $mean        = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-        $stdDev      = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-
-        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
-            if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return exp($mean + $stdDev * self::NORMSINV($probability));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * LOGNORMDIST
-     *
-     * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed
-     * with parameters mean and standard_dev.
-     *
-     * @param    float        $value
-     * @param    float        $mean
-     * @param    float        $stdDev
-     * @return    float
-     */
-    public static function LOGNORMDIST($value, $mean, $stdDev)
-    {
-        $value  = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $mean   = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-        $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-
-        if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
-            if (($value <= 0) || ($stdDev <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return self::NORMSDIST((log($value) - $mean) / $stdDev);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * MAX
-     *
-     * MAX returns the value of the element of the values passed that has the highest value,
-     *        with negative numbers considered smaller than positive numbers.
-     *
-     * Excel Function:
-     *        MAX(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MAX()
-    {
-        $returnValue = null;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if ((is_null($returnValue)) || ($arg > $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        if (is_null($returnValue)) {
-            return 0;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * MAXA
-     *
-     * Returns the greatest value in a list of arguments, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        MAXA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MAXA()
-    {
-        $returnValue = null;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
-                if (is_bool($arg)) {
-                    $arg = (integer) $arg;
-                } elseif (is_string($arg)) {
-                    $arg = 0;
-                }
-                if ((is_null($returnValue)) || ($arg > $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        if (is_null($returnValue)) {
-            return 0;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * MAXIF
-     *
-     * Counts the maximum value within a range of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        MAXIF(value1[,value2[, ...]],condition)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    string        $condition        The criteria that defines which cells will be checked.
-     * @return    float
-     */
-    public static function MAXIF($aArgs, $condition, $sumArgs = array())
-    {
-        $returnValue = null;
-
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
-        $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
-        if (empty($sumArgs)) {
-            $sumArgs = $aArgs;
-        }
-        $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
-        // Loop through arguments
-        foreach ($aArgs as $key => $arg) {
-            if (!is_numeric($arg)) {
-                $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-            }
-            $testCondition = '='.$arg.$condition;
-            if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                if ((is_null($returnValue)) || ($arg > $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        return $returnValue;
-    }
-
-    /**
-     * MEDIAN
-     *
-     * Returns the median of the given numbers. The median is the number in the middle of a set of numbers.
-     *
-     * Excel Function:
-     *        MEDIAN(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MEDIAN()
-    {
-        $returnValue = PHPExcel_Calculation_Functions::NaN();
-
-        $mArgs = array();
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $mArgs[] = $arg;
-            }
-        }
-
-        $mValueCount = count($mArgs);
-        if ($mValueCount > 0) {
-            sort($mArgs, SORT_NUMERIC);
-            $mValueCount = $mValueCount / 2;
-            if ($mValueCount == floor($mValueCount)) {
-                $returnValue = ($mArgs[$mValueCount--] + $mArgs[$mValueCount]) / 2;
-            } else {
-                $mValueCount = floor($mValueCount);
-                $returnValue = $mArgs[$mValueCount];
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * MIN
-     *
-     * MIN returns the value of the element of the values passed that has the smallest value,
-     *        with negative numbers considered smaller than positive numbers.
-     *
-     * Excel Function:
-     *        MIN(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MIN()
-    {
-        $returnValue = null;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                if ((is_null($returnValue)) || ($arg < $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        if (is_null($returnValue)) {
-            return 0;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * MINA
-     *
-     * Returns the smallest value in a list of arguments, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        MINA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MINA()
-    {
-        $returnValue = null;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
-                if (is_bool($arg)) {
-                    $arg = (integer) $arg;
-                } elseif (is_string($arg)) {
-                    $arg = 0;
-                }
-                if ((is_null($returnValue)) || ($arg < $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        if (is_null($returnValue)) {
-            return 0;
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * MINIF
-     *
-     * Returns the minimum value within a range of cells that contain numbers within the list of arguments
-     *
-     * Excel Function:
-     *        MINIF(value1[,value2[, ...]],condition)
-     *
-     * @access    public
-     * @category Mathematical and Trigonometric Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    string        $condition        The criteria that defines which cells will be checked.
-     * @return    float
-     */
-    public static function MINIF($aArgs, $condition, $sumArgs = array())
-    {
-        $returnValue = null;
-
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
-        $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
-        if (empty($sumArgs)) {
-            $sumArgs = $aArgs;
-        }
-        $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
-        // Loop through arguments
-        foreach ($aArgs as $key => $arg) {
-            if (!is_numeric($arg)) {
-                $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
-            }
-            $testCondition = '='.$arg.$condition;
-            if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
-                if ((is_null($returnValue)) || ($arg < $returnValue)) {
-                    $returnValue = $arg;
-                }
-            }
-        }
-
-        return $returnValue;
-    }
-
-
-    //
-    //    Special variant of array_count_values that isn't limited to strings and integers,
-    //        but can work with floating point numbers as values
-    //
-    private static function modeCalc($data)
-    {
-        $frequencyArray = array();
-        foreach ($data as $datum) {
-            $found = false;
-            foreach ($frequencyArray as $key => $value) {
-                if ((string) $value['value'] == (string) $datum) {
-                    ++$frequencyArray[$key]['frequency'];
-                    $found = true;
-                    break;
-                }
-            }
-            if (!$found) {
-                $frequencyArray[] = array(
-                    'value'     => $datum,
-                    'frequency' => 1
-                );
-            }
-        }
-
-        foreach ($frequencyArray as $key => $value) {
-            $frequencyList[$key] = $value['frequency'];
-            $valueList[$key] = $value['value'];
-        }
-        array_multisort($frequencyList, SORT_DESC, $valueList, SORT_ASC, SORT_NUMERIC, $frequencyArray);
-
-        if ($frequencyArray[0]['frequency'] == 1) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-        return $frequencyArray[0]['value'];
-    }
-
-
-    /**
-     * MODE
-     *
-     * Returns the most frequently occurring, or repetitive, value in an array or range of data
-     *
-     * Excel Function:
-     *        MODE(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function MODE()
-    {
-        $returnValue = PHPExcel_Calculation_Functions::NA();
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        $mArgs = array();
-        foreach ($aArgs as $arg) {
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $mArgs[] = $arg;
-            }
-        }
-
-        if (!empty($mArgs)) {
-            return self::modeCalc($mArgs);
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * NEGBINOMDIST
-     *
-     * Returns the negative binomial distribution. NEGBINOMDIST returns the probability that
-     *        there will be number_f failures before the number_s-th success, when the constant
-     *        probability of a success is probability_s. This function is similar to the binomial
-     *        distribution, except that the number of successes is fixed, and the number of trials is
-     *        variable. Like the binomial, trials are assumed to be independent.
-     *
-     * @param    float        $failures        Number of Failures
-     * @param    float        $successes        Threshold number of Successes
-     * @param    float        $probability    Probability of success on each trial
-     * @return    float
-     *
-     */
-    public static function NEGBINOMDIST($failures, $successes, $probability)
-    {
-        $failures    = floor(PHPExcel_Calculation_Functions::flattenSingleValue($failures));
-        $successes   = floor(PHPExcel_Calculation_Functions::flattenSingleValue($successes));
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-
-        if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) {
-            if (($failures < 0) || ($successes < 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            } elseif (($probability < 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
-                if (($failures + $successes - 1) <= 0) {
-                    return PHPExcel_Calculation_Functions::NaN();
-                }
-            }
-            return (PHPExcel_Calculation_MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * NORMDIST
-     *
-     * Returns the normal distribution for the specified mean and standard deviation. This
-     * function has a very wide range of applications in statistics, including hypothesis
-     * testing.
-     *
-     * @param    float        $value
-     * @param    float        $mean        Mean Value
-     * @param    float        $stdDev        Standard Deviation
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function NORMDIST($value, $mean, $stdDev, $cumulative)
-    {
-        $value  = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $mean   = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-        $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-
-        if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
-            if ($stdDev < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    return 0.5 * (1 + PHPExcel_Calculation_Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2))));
-                } else {
-                    return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev))));
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * NORMINV
-     *
-     * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
-     *
-     * @param    float        $value
-     * @param    float        $mean        Mean Value
-     * @param    float        $stdDev        Standard Deviation
-     * @return    float
-     *
-     */
-    public static function NORMINV($probability, $mean, $stdDev)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $mean        = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-        $stdDev      = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-
-        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
-            if (($probability < 0) || ($probability > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ($stdDev < 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return (self::inverseNcdf($probability) * $stdDev) + $mean;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * NORMSDIST
-     *
-     * Returns the standard normal cumulative distribution function. The distribution has
-     * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a
-     * table of standard normal curve areas.
-     *
-     * @param    float        $value
-     * @return    float
-     */
-    public static function NORMSDIST($value)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        return self::NORMDIST($value, 0, 1, true);
-    }
-
-
-    /**
-     * NORMSINV
-     *
-     * Returns the inverse of the standard normal cumulative distribution
-     *
-     * @param    float        $value
-     * @return    float
-     */
-    public static function NORMSINV($value)
-    {
-        return self::NORMINV($value, 0, 1);
-    }
-
-
-    /**
-     * PERCENTILE
-     *
-     * Returns the nth percentile of values in a range..
-     *
-     * Excel Function:
-     *        PERCENTILE(value1[,value2[, ...]],entry)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    float        $entry            Percentile value in the range 0..1, inclusive.
-     * @return    float
-     */
-    public static function PERCENTILE()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $entry = array_pop($aArgs);
-
-        if ((is_numeric($entry)) && (!is_string($entry))) {
-            if (($entry < 0) || ($entry > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $mArgs = array();
-            foreach ($aArgs as $arg) {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $mArgs[] = $arg;
-                }
-            }
-            $mValueCount = count($mArgs);
-            if ($mValueCount > 0) {
-                sort($mArgs);
-                $count = self::COUNT($mArgs);
-                $index = $entry * ($count-1);
-                $iBase = floor($index);
-                if ($index == $iBase) {
-                    return $mArgs[$index];
-                } else {
-                    $iNext = $iBase + 1;
-                    $iProportion = $index - $iBase;
-                    return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion) ;
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * PERCENTRANK
-     *
-     * Returns the rank of a value in a data set as a percentage of the data set.
-     *
-     * @param    array of number        An array of, or a reference to, a list of numbers.
-     * @param    number                The number whose rank you want to find.
-     * @param    number                The number of significant digits for the returned percentage value.
-     * @return    float
-     */
-    public static function PERCENTRANK($valueSet, $value, $significance = 3)
-    {
-        $valueSet     = PHPExcel_Calculation_Functions::flattenArray($valueSet);
-        $value        = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $significance = (is_null($significance)) ? 3 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($significance);
-
-        foreach ($valueSet as $key => $valueEntry) {
-            if (!is_numeric($valueEntry)) {
-                unset($valueSet[$key]);
-            }
-        }
-        sort($valueSet, SORT_NUMERIC);
-        $valueCount = count($valueSet);
-        if ($valueCount == 0) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-
-        $valueAdjustor = $valueCount - 1;
-        if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        $pos = array_search($value, $valueSet);
-        if ($pos === false) {
-            $pos = 0;
-            $testValue = $valueSet[0];
-            while ($testValue < $value) {
-                $testValue = $valueSet[++$pos];
-            }
-            --$pos;
-            $pos += (($value - $valueSet[$pos]) / ($testValue - $valueSet[$pos]));
-        }
-
-        return round($pos / $valueAdjustor, $significance);
-    }
-
-
-    /**
-     * PERMUT
-     *
-     * Returns the number of permutations for a given number of objects that can be
-     *        selected from number objects. A permutation is any set or subset of objects or
-     *        events where internal order is significant. Permutations are different from
-     *        combinations, for which the internal order is not significant. Use this function
-     *        for lottery-style probability calculations.
-     *
-     * @param    int        $numObjs    Number of different objects
-     * @param    int        $numInSet    Number of objects in each permutation
-     * @return    int        Number of permutations
-     */
-    public static function PERMUT($numObjs, $numInSet)
-    {
-        $numObjs  = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs);
-        $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet);
-
-        if ((is_numeric($numObjs)) && (is_numeric($numInSet))) {
-            $numInSet = floor($numInSet);
-            if ($numObjs < $numInSet) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return round(PHPExcel_Calculation_MathTrig::FACT($numObjs) / PHPExcel_Calculation_MathTrig::FACT($numObjs - $numInSet));
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * POISSON
-     *
-     * Returns the Poisson distribution. A common application of the Poisson distribution
-     * is predicting the number of events over a specific time, such as the number of
-     * cars arriving at a toll plaza in 1 minute.
-     *
-     * @param    float        $value
-     * @param    float        $mean        Mean Value
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function POISSON($value, $mean, $cumulative)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $mean  = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-
-        if ((is_numeric($value)) && (is_numeric($mean))) {
-            if (($value < 0) || ($mean <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    $summer = 0;
-                    for ($i = 0; $i <= floor($value); ++$i) {
-                        $summer += pow($mean, $i) / PHPExcel_Calculation_MathTrig::FACT($i);
-                    }
-                    return exp(0-$mean) * $summer;
-                } else {
-                    return (exp(0-$mean) * pow($mean, $value)) / PHPExcel_Calculation_MathTrig::FACT($value);
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * QUARTILE
-     *
-     * Returns the quartile of a data set.
-     *
-     * Excel Function:
-     *        QUARTILE(value1[,value2[, ...]],entry)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    int            $entry            Quartile value in the range 1..3, inclusive.
-     * @return    float
-     */
-    public static function QUARTILE()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $entry = floor(array_pop($aArgs));
-
-        if ((is_numeric($entry)) && (!is_string($entry))) {
-            $entry /= 4;
-            if (($entry < 0) || ($entry > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return self::PERCENTILE($aArgs, $entry);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * RANK
-     *
-     * Returns the rank of a number in a list of numbers.
-     *
-     * @param    number                The number whose rank you want to find.
-     * @param    array of number        An array of, or a reference to, a list of numbers.
-     * @param    mixed                Order to sort the values in the value set
-     * @return    float
-     */
-    public static function RANK($value, $valueSet, $order = 0)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet);
-        $order = (is_null($order)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($order);
-
-        foreach ($valueSet as $key => $valueEntry) {
-            if (!is_numeric($valueEntry)) {
-                unset($valueSet[$key]);
-            }
-        }
-
-        if ($order == 0) {
-            rsort($valueSet, SORT_NUMERIC);
-        } else {
-            sort($valueSet, SORT_NUMERIC);
-        }
-        $pos = array_search($value, $valueSet);
-        if ($pos === false) {
-            return PHPExcel_Calculation_Functions::NA();
-        }
-
-        return ++$pos;
-    }
-
-
-    /**
-     * RSQ
-     *
-     * Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function RSQ($yValues, $xValues)
-    {
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getGoodnessOfFit();
-    }
-
-
-    /**
-     * SKEW
-     *
-     * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry
-     * of a distribution around its mean. Positive skewness indicates a distribution with an
-     * asymmetric tail extending toward more positive values. Negative skewness indicates a
-     * distribution with an asymmetric tail extending toward more negative values.
-     *
-     * @param    array    Data Series
-     * @return    float
-     */
-    public static function SKEW()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-        $mean = self::AVERAGE($aArgs);
-        $stdDev = self::STDEV($aArgs);
-
-        $count = $summer = 0;
-        // Loop through arguments
-        foreach ($aArgs as $k => $arg) {
-            if ((is_bool($arg)) &&
-                (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-            } else {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $summer += pow((($arg - $mean) / $stdDev), 3);
-                    ++$count;
-                }
-            }
-        }
-
-        if ($count > 2) {
-            return $summer * ($count / (($count-1) * ($count-2)));
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * SLOPE
-     *
-     * Returns the slope of the linear regression line through data points in known_y's and known_x's.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function SLOPE($yValues, $xValues)
-    {
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getSlope();
-    }
-
-
-    /**
-     * SMALL
-     *
-     * Returns the nth smallest value in a data set. You can use this function to
-     *        select a value based on its relative standing.
-     *
-     * Excel Function:
-     *        SMALL(value1[,value2[, ...]],entry)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    int            $entry            Position (ordered from the smallest) in the array or range of data to return
-     * @return    float
-     */
-    public static function SMALL()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $entry = array_pop($aArgs);
-
-        if ((is_numeric($entry)) && (!is_string($entry))) {
-            $mArgs = array();
-            foreach ($aArgs as $arg) {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $mArgs[] = $arg;
-                }
-            }
-            $count = self::COUNT($mArgs);
-            $entry = floor(--$entry);
-            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            sort($mArgs);
-            return $mArgs[$entry];
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * STANDARDIZE
-     *
-     * Returns a normalized value from a distribution characterized by mean and standard_dev.
-     *
-     * @param    float    $value        Value to normalize
-     * @param    float    $mean        Mean Value
-     * @param    float    $stdDev        Standard Deviation
-     * @return    float    Standardized value
-     */
-    public static function STANDARDIZE($value, $mean, $stdDev)
-    {
-        $value  = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $mean   = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
-        $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
-
-        if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
-            if ($stdDev <= 0) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            return ($value - $mean) / $stdDev ;
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * STDEV
-     *
-     * Estimates standard deviation based on a sample. The standard deviation is a measure of how
-     *        widely values are dispersed from the average value (the mean).
-     *
-     * Excel Function:
-     *        STDEV(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function STDEV()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        // Return value
-        $returnValue = null;
-
-        $aMean = self::AVERAGE($aArgs);
-        if (!is_null($aMean)) {
-            $aCount = -1;
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                    $arg = (integer) $arg;
-                }
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    if (is_null($returnValue)) {
-                        $returnValue = pow(($arg - $aMean), 2);
-                    } else {
-                        $returnValue += pow(($arg - $aMean), 2);
-                    }
-                    ++$aCount;
-                }
-            }
-
-            // Return
-            if (($aCount > 0) && ($returnValue >= 0)) {
-                return sqrt($returnValue / $aCount);
-            }
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * STDEVA
-     *
-     * Estimates standard deviation based on a sample, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        STDEVA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function STDEVA()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        $returnValue = null;
-
-        $aMean = self::AVERAGEA($aArgs);
-        if (!is_null($aMean)) {
-            $aCount = -1;
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-                } else {
-                    // Is it a numeric value?
-                    if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
-                        if (is_bool($arg)) {
-                            $arg = (integer) $arg;
-                        } elseif (is_string($arg)) {
-                            $arg = 0;
-                        }
-                        if (is_null($returnValue)) {
-                            $returnValue = pow(($arg - $aMean), 2);
-                        } else {
-                            $returnValue += pow(($arg - $aMean), 2);
-                        }
-                        ++$aCount;
-                    }
-                }
-            }
-
-            if (($aCount > 0) && ($returnValue >= 0)) {
-                return sqrt($returnValue / $aCount);
-            }
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * STDEVP
-     *
-     * Calculates standard deviation based on the entire population
-     *
-     * Excel Function:
-     *        STDEVP(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function STDEVP()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        $returnValue = null;
-
-        $aMean = self::AVERAGE($aArgs);
-        if (!is_null($aMean)) {
-            $aCount = 0;
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
-                    $arg = (integer) $arg;
-                }
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    if (is_null($returnValue)) {
-                        $returnValue = pow(($arg - $aMean), 2);
-                    } else {
-                        $returnValue += pow(($arg - $aMean), 2);
-                    }
-                    ++$aCount;
-                }
-            }
-
-            if (($aCount > 0) && ($returnValue >= 0)) {
-                return sqrt($returnValue / $aCount);
-            }
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * STDEVPA
-     *
-     * Calculates standard deviation based on the entire population, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        STDEVPA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function STDEVPA()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-
-        $returnValue = null;
-
-        $aMean = self::AVERAGEA($aArgs);
-        if (!is_null($aMean)) {
-            $aCount = 0;
-            foreach ($aArgs as $k => $arg) {
-                if ((is_bool($arg)) &&
-                    (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-                } else {
-                    // Is it a numeric value?
-                    if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
-                        if (is_bool($arg)) {
-                            $arg = (integer) $arg;
-                        } elseif (is_string($arg)) {
-                            $arg = 0;
-                        }
-                        if (is_null($returnValue)) {
-                            $returnValue = pow(($arg - $aMean), 2);
-                        } else {
-                            $returnValue += pow(($arg - $aMean), 2);
-                        }
-                        ++$aCount;
-                    }
-                }
-            }
-
-            if (($aCount > 0) && ($returnValue >= 0)) {
-                return sqrt($returnValue / $aCount);
-            }
-        }
-        return PHPExcel_Calculation_Functions::DIV0();
-    }
-
-
-    /**
-     * STEYX
-     *
-     * Returns the standard error of the predicted y-value for each x in the regression.
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @return    float
-     */
-    public static function STEYX($yValues, $xValues)
-    {
-        if (!self::checkTrendArrays($yValues, $xValues)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $yValueCount = count($yValues);
-        $xValueCount = count($xValues);
-
-        if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
-            return PHPExcel_Calculation_Functions::NA();
-        } elseif ($yValueCount == 1) {
-            return PHPExcel_Calculation_Functions::DIV0();
-        }
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
-        return $bestFitLinear->getStdevOfResiduals();
-    }
-
-
-    /**
-     * TDIST
-     *
-     * Returns the probability of Student's T distribution.
-     *
-     * @param    float        $value            Value for the function
-     * @param    float        $degrees        degrees of freedom
-     * @param    float        $tails            number of tails (1 or 2)
-     * @return    float
-     */
-    public static function TDIST($value, $degrees, $tails)
-    {
-        $value        = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $degrees    = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
-        $tails        = floor(PHPExcel_Calculation_Functions::flattenSingleValue($tails));
-
-        if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) {
-            if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            //    tdist, which finds the probability that corresponds to a given value
-            //    of t with k degrees of freedom. This algorithm is translated from a
-            //    pascal function on p81 of "Statistical Computing in Pascal" by D
-            //    Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd:
-            //    London). The above Pascal algorithm is itself a translation of the
-            //    fortran algoritm "AS 3" by B E Cooper of the Atlas Computer
-            //    Laboratory as reported in (among other places) "Applied Statistics
-            //    Algorithms", editied by P Griffiths and I D Hill (1985; Ellis
-            //    Horwood Ltd.; W. Sussex, England).
-            $tterm = $degrees;
-            $ttheta = atan2($value, sqrt($tterm));
-            $tc = cos($ttheta);
-            $ts = sin($ttheta);
-            $tsum = 0;
-
-            if (($degrees % 2) == 1) {
-                $ti = 3;
-                $tterm = $tc;
-            } else {
-                $ti = 2;
-                $tterm = 1;
-            }
-
-            $tsum = $tterm;
-            while ($ti < $degrees) {
-                $tterm *= $tc * $tc * ($ti - 1) / $ti;
-                $tsum += $tterm;
-                $ti += 2;
-            }
-            $tsum *= $ts;
-            if (($degrees % 2) == 1) {
-                $tsum = M_2DIVPI * ($tsum + $ttheta);
-            }
-            $tValue = 0.5 * (1 + $tsum);
-            if ($tails == 1) {
-                return 1 - abs($tValue);
-            } else {
-                return 1 - abs((1 - $tValue) - $tValue);
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * TINV
-     *
-     * Returns the one-tailed probability of the chi-squared distribution.
-     *
-     * @param    float        $probability    Probability for the function
-     * @param    float        $degrees        degrees of freedom
-     * @return    float
-     */
-    public static function TINV($probability, $degrees)
-    {
-        $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
-        $degrees     = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
-
-        if ((is_numeric($probability)) && (is_numeric($degrees))) {
-            $xLo = 100;
-            $xHi = 0;
-
-            $x = $xNew = 1;
-            $dx    = 1;
-            $i = 0;
-
-            while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) {
-                // Apply Newton-Raphson step
-                $result = self::TDIST($x, $degrees, 2);
-                $error = $result - $probability;
-                if ($error == 0.0) {
-                    $dx = 0;
-                } elseif ($error < 0.0) {
-                    $xLo = $x;
-                } else {
-                    $xHi = $x;
-                }
-                // Avoid division by zero
-                if ($result != 0.0) {
-                    $dx = $error / $result;
-                    $xNew = $x - $dx;
-                }
-                // If the NR fails to converge (which for example may be the
-                // case if the initial guess is too rough) we apply a bisection
-                // step to determine a more narrow interval around the root.
-                if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) {
-                    $xNew = ($xLo + $xHi) / 2;
-                    $dx = $xNew - $x;
-                }
-                $x = $xNew;
-            }
-            if ($i == MAX_ITERATIONS) {
-                return PHPExcel_Calculation_Functions::NA();
-            }
-            return round($x, 12);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * TREND
-     *
-     * Returns values along a linear trend
-     *
-     * @param    array of mixed        Data Series Y
-     * @param    array of mixed        Data Series X
-     * @param    array of mixed        Values of X for which we want to find Y
-     * @param    boolean                A logical value specifying whether to force the intersect to equal 0.
-     * @return    array of float
-     */
-    public static function TREND($yValues, $xValues = array(), $newValues = array(), $const = true)
-    {
-        $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues);
-        $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues);
-        $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues);
-        $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
-
-        $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const);
-        if (empty($newValues)) {
-            $newValues = $bestFitLinear->getXValues();
-        }
-
-        $returnArray = array();
-        foreach ($newValues as $xValue) {
-            $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue);
-        }
-
-        return $returnArray;
-    }
-
-
-    /**
-     * TRIMMEAN
-     *
-     * Returns the mean of the interior of a data set. TRIMMEAN calculates the mean
-     *        taken by excluding a percentage of data points from the top and bottom tails
-     *        of a data set.
-     *
-     * Excel Function:
-     *        TRIMEAN(value1[,value2[, ...]], $discard)
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @param    float        $discard        Percentage to discard
-     * @return    float
-     */
-    public static function TRIMMEAN()
-    {
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-
-        // Calculate
-        $percent = array_pop($aArgs);
-
-        if ((is_numeric($percent)) && (!is_string($percent))) {
-            if (($percent < 0) || ($percent > 1)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            $mArgs = array();
-            foreach ($aArgs as $arg) {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) && (!is_string($arg))) {
-                    $mArgs[] = $arg;
-                }
-            }
-            $discard = floor(self::COUNT($mArgs) * $percent / 2);
-            sort($mArgs);
-            for ($i=0; $i < $discard; ++$i) {
-                array_pop($mArgs);
-                array_shift($mArgs);
-            }
-            return self::AVERAGE($mArgs);
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * VARFunc
-     *
-     * Estimates variance based on a sample.
-     *
-     * Excel Function:
-     *        VAR(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function VARFunc()
-    {
-        $returnValue = PHPExcel_Calculation_Functions::DIV0();
-
-        $summerA = $summerB = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        $aCount = 0;
-        foreach ($aArgs as $arg) {
-            if (is_bool($arg)) {
-                $arg = (integer) $arg;
-            }
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $summerA += ($arg * $arg);
-                $summerB += $arg;
-                ++$aCount;
-            }
-        }
-
-        if ($aCount > 1) {
-            $summerA *= $aCount;
-            $summerB *= $summerB;
-            $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1));
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * VARA
-     *
-     * Estimates variance based on a sample, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        VARA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function VARA()
-    {
-        $returnValue = PHPExcel_Calculation_Functions::DIV0();
-
-        $summerA = $summerB = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-        $aCount = 0;
-        foreach ($aArgs as $k => $arg) {
-            if ((is_string($arg)) &&
-                (PHPExcel_Calculation_Functions::isValue($k))) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            } elseif ((is_string($arg)) &&
-                (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-            } else {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
-                    if (is_bool($arg)) {
-                        $arg = (integer) $arg;
-                    } elseif (is_string($arg)) {
-                        $arg = 0;
-                    }
-                    $summerA += ($arg * $arg);
-                    $summerB += $arg;
-                    ++$aCount;
-                }
-            }
-        }
-
-        if ($aCount > 1) {
-            $summerA *= $aCount;
-            $summerB *= $summerB;
-            $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1));
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * VARP
-     *
-     * Calculates variance based on the entire population
-     *
-     * Excel Function:
-     *        VARP(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function VARP()
-    {
-        // Return value
-        $returnValue = PHPExcel_Calculation_Functions::DIV0();
-
-        $summerA = $summerB = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        $aCount = 0;
-        foreach ($aArgs as $arg) {
-            if (is_bool($arg)) {
-                $arg = (integer) $arg;
-            }
-            // Is it a numeric value?
-            if ((is_numeric($arg)) && (!is_string($arg))) {
-                $summerA += ($arg * $arg);
-                $summerB += $arg;
-                ++$aCount;
-            }
-        }
-
-        if ($aCount > 0) {
-            $summerA *= $aCount;
-            $summerB *= $summerB;
-            $returnValue = ($summerA - $summerB) / ($aCount * $aCount);
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * VARPA
-     *
-     * Calculates variance based on the entire population, including numbers, text, and logical values
-     *
-     * Excel Function:
-     *        VARPA(value1[,value2[, ...]])
-     *
-     * @access    public
-     * @category Statistical Functions
-     * @param    mixed        $arg,...        Data values
-     * @return    float
-     */
-    public static function VARPA()
-    {
-        $returnValue = PHPExcel_Calculation_Functions::DIV0();
-
-        $summerA = $summerB = 0;
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
-        $aCount = 0;
-        foreach ($aArgs as $k => $arg) {
-            if ((is_string($arg)) &&
-                (PHPExcel_Calculation_Functions::isValue($k))) {
-                return PHPExcel_Calculation_Functions::VALUE();
-            } elseif ((is_string($arg)) &&
-                (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
-            } else {
-                // Is it a numeric value?
-                if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
-                    if (is_bool($arg)) {
-                        $arg = (integer) $arg;
-                    } elseif (is_string($arg)) {
-                        $arg = 0;
-                    }
-                    $summerA += ($arg * $arg);
-                    $summerB += $arg;
-                    ++$aCount;
-                }
-            }
-        }
-
-        if ($aCount > 0) {
-            $summerA *= $aCount;
-            $summerB *= $summerB;
-            $returnValue = ($summerA - $summerB) / ($aCount * $aCount);
-        }
-        return $returnValue;
-    }
-
-
-    /**
-     * WEIBULL
-     *
-     * Returns the Weibull distribution. Use this distribution in reliability
-     * analysis, such as calculating a device's mean time to failure.
-     *
-     * @param    float        $value
-     * @param    float        $alpha        Alpha Parameter
-     * @param    float        $beta        Beta Parameter
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function WEIBULL($value, $alpha, $beta, $cumulative)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
-        $beta  = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
-
-        if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) {
-            if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) {
-                return PHPExcel_Calculation_Functions::NaN();
-            }
-            if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
-                if ($cumulative) {
-                    return 1 - exp(0 - pow($value / $beta, $alpha));
-                } else {
-                    return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha));
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * ZTEST
-     *
-     * Returns the Weibull distribution. Use this distribution in reliability
-     * analysis, such as calculating a device's mean time to failure.
-     *
-     * @param    float        $dataSet
-     * @param    float        $m0        Alpha Parameter
-     * @param    float        $sigma    Beta Parameter
-     * @param    boolean        $cumulative
-     * @return    float
-     *
-     */
-    public static function ZTEST($dataSet, $m0, $sigma = null)
-    {
-        $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet);
-        $m0      = PHPExcel_Calculation_Functions::flattenSingleValue($m0);
-        $sigma   = PHPExcel_Calculation_Functions::flattenSingleValue($sigma);
-
-        if (is_null($sigma)) {
-            $sigma = self::STDEV($dataSet);
-        }
-        $n = count($dataSet);
-
-        return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0) / ($sigma / SQRT($n)));
-    }
-}

+ 0 - 651
libs/PHPExcel/PHPExcel/Calculation/TextData.php

xqd
@@ -1,651 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Calculation_TextData
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Calculation
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_TextData
-{
-    private static $invalidChars;
-
-    private static function unicodeToOrd($c)
-    {
-        if (ord($c{0}) >=0 && ord($c{0}) <= 127) {
-            return ord($c{0});
-        } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) {
-            return (ord($c{0})-192)*64 + (ord($c{1})-128);
-        } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) {
-            return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
-        } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) {
-            return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
-        } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) {
-            return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
-        } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) {
-            return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
-        } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
-            // error
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        return 0;
-    }
-
-    /**
-     * CHARACTER
-     *
-     * @param    string    $character    Value
-     * @return    int
-     */
-    public static function CHARACTER($character)
-    {
-        $character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
-
-        if ((!is_numeric($character)) || ($character < 0)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (function_exists('mb_convert_encoding')) {
-            return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
-        } else {
-            return chr(intval($character));
-        }
-    }
-
-
-    /**
-     * TRIMNONPRINTABLE
-     *
-     * @param    mixed    $stringValue    Value to check
-     * @return    string
-     */
-    public static function TRIMNONPRINTABLE($stringValue = '')
-    {
-        $stringValue    = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
-
-        if (is_bool($stringValue)) {
-            return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if (self::$invalidChars == null) {
-            self::$invalidChars = range(chr(0), chr(31));
-        }
-
-        if (is_string($stringValue) || is_numeric($stringValue)) {
-            return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F"));
-        }
-        return null;
-    }
-
-
-    /**
-     * TRIMSPACES
-     *
-     * @param    mixed    $stringValue    Value to check
-     * @return    string
-     */
-    public static function TRIMSPACES($stringValue = '')
-    {
-        $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
-        if (is_bool($stringValue)) {
-            return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if (is_string($stringValue) || is_numeric($stringValue)) {
-            return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');
-        }
-        return null;
-    }
-
-
-    /**
-     * ASCIICODE
-     *
-     * @param    string    $characters        Value
-     * @return    int
-     */
-    public static function ASCIICODE($characters)
-    {
-        if (($characters === null) || ($characters === '')) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        $characters    = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
-        if (is_bool($characters)) {
-            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                $characters = (int) $characters;
-            } else {
-                $characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-            }
-        }
-
-        $character = $characters;
-        if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
-            if (mb_strlen($characters, 'UTF-8') > 1) {
-                $character = mb_substr($characters, 0, 1, 'UTF-8');
-            }
-            return self::unicodeToOrd($character);
-        } else {
-            if (strlen($characters) > 0) {
-                $character = substr($characters, 0, 1);
-            }
-            return ord($character);
-        }
-    }
-
-
-    /**
-     * CONCATENATE
-     *
-     * @return    string
-     */
-    public static function CONCATENATE()
-    {
-        $returnValue = '';
-
-        // Loop through arguments
-        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
-        foreach ($aArgs as $arg) {
-            if (is_bool($arg)) {
-                if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
-                    $arg = (int) $arg;
-                } else {
-                    $arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-                }
-            }
-            $returnValue .= $arg;
-        }
-
-        return $returnValue;
-    }
-
-
-    /**
-     * DOLLAR
-     *
-     * This function converts a number to text using currency format, with the decimals rounded to the specified place.
-     * The format used is $#,##0.00_);($#,##0.00)..
-     *
-     * @param    float    $value            The value to format
-     * @param    int        $decimals        The number of digits to display to the right of the decimal point.
-     *                                    If decimals is negative, number is rounded to the left of the decimal point.
-     *                                    If you omit decimals, it is assumed to be 2
-     * @return    string
-     */
-    public static function DOLLAR($value = 0, $decimals = 2)
-    {
-        $value        = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $decimals    = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
-
-        // Validate parameters
-        if (!is_numeric($value) || !is_numeric($decimals)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $decimals = floor($decimals);
-
-        $mask = '$#,##0';
-        if ($decimals > 0) {
-            $mask .= '.' . str_repeat('0', $decimals);
-        } else {
-            $round = pow(10, abs($decimals));
-            if ($value < 0) {
-                $round = 0-$round;
-            }
-            $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
-        }
-
-        return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
-
-    }
-
-
-    /**
-     * SEARCHSENSITIVE
-     *
-     * @param    string    $needle        The string to look for
-     * @param    string    $haystack    The string in which to look
-     * @param    int        $offset        Offset within $haystack
-     * @return    string
-     */
-    public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
-    {
-        $needle   = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
-        $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
-        $offset   = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
-
-        if (!is_bool($needle)) {
-            if (is_bool($haystack)) {
-                $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-            }
-
-            if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
-                if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
-                    return $offset;
-                }
-                if (function_exists('mb_strpos')) {
-                    $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
-                } else {
-                    $pos = strpos($haystack, $needle, --$offset);
-                }
-                if ($pos !== false) {
-                    return ++$pos;
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * SEARCHINSENSITIVE
-     *
-     * @param    string    $needle        The string to look for
-     * @param    string    $haystack    The string in which to look
-     * @param    int        $offset        Offset within $haystack
-     * @return    string
-     */
-    public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
-    {
-        $needle   = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
-        $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
-        $offset   = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
-
-        if (!is_bool($needle)) {
-            if (is_bool($haystack)) {
-                $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-            }
-
-            if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
-                if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
-                    return $offset;
-                }
-                if (function_exists('mb_stripos')) {
-                    $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
-                } else {
-                    $pos = stripos($haystack, $needle, --$offset);
-                }
-                if ($pos !== false) {
-                    return ++$pos;
-                }
-            }
-        }
-        return PHPExcel_Calculation_Functions::VALUE();
-    }
-
-
-    /**
-     * FIXEDFORMAT
-     *
-     * @param    mixed        $value    Value to check
-     * @param    integer        $decimals
-     * @param    boolean        $no_commas
-     * @return    boolean
-     */
-    public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
-    {
-        $value     = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $decimals  = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
-        $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
-
-        // Validate parameters
-        if (!is_numeric($value) || !is_numeric($decimals)) {
-            return PHPExcel_Calculation_Functions::NaN();
-        }
-        $decimals = floor($decimals);
-
-        $valueResult = round($value, $decimals);
-        if ($decimals < 0) {
-            $decimals = 0;
-        }
-        if (!$no_commas) {
-            $valueResult = number_format($valueResult, $decimals);
-        }
-
-        return (string) $valueResult;
-    }
-
-
-    /**
-     * LEFT
-     *
-     * @param    string    $value    Value
-     * @param    int        $chars    Number of characters
-     * @return    string
-     */
-    public static function LEFT($value = '', $chars = 1)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
-
-        if ($chars < 0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (is_bool($value)) {
-            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if (function_exists('mb_substr')) {
-            return mb_substr($value, 0, $chars, 'UTF-8');
-        } else {
-            return substr($value, 0, $chars);
-        }
-    }
-
-
-    /**
-     * MID
-     *
-     * @param    string    $value    Value
-     * @param    int        $start    Start character
-     * @param    int        $chars    Number of characters
-     * @return    string
-     */
-    public static function MID($value = '', $start = 1, $chars = null)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
-        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
-
-        if (($start < 1) || ($chars < 0)) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (is_bool($value)) {
-            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if (function_exists('mb_substr')) {
-            return mb_substr($value, --$start, $chars, 'UTF-8');
-        } else {
-            return substr($value, --$start, $chars);
-        }
-    }
-
-
-    /**
-     * RIGHT
-     *
-     * @param    string    $value    Value
-     * @param    int        $chars    Number of characters
-     * @return    string
-     */
-    public static function RIGHT($value = '', $chars = 1)
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
-
-        if ($chars < 0) {
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-
-        if (is_bool($value)) {
-            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
-            return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
-        } else {
-            return substr($value, strlen($value) - $chars);
-        }
-    }
-
-
-    /**
-     * STRINGLENGTH
-     *
-     * @param    string    $value    Value
-     * @return    string
-     */
-    public static function STRINGLENGTH($value = '')
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        if (is_bool($value)) {
-            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        if (function_exists('mb_strlen')) {
-            return mb_strlen($value, 'UTF-8');
-        } else {
-            return strlen($value);
-        }
-    }
-
-
-    /**
-     * LOWERCASE
-     *
-     * Converts a string value to upper case.
-     *
-     * @param    string        $mixedCaseString
-     * @return    string
-     */
-    public static function LOWERCASE($mixedCaseString)
-    {
-        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
-
-        if (is_bool($mixedCaseString)) {
-            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        return PHPExcel_Shared_String::StrToLower($mixedCaseString);
-    }
-
-
-    /**
-     * UPPERCASE
-     *
-     * Converts a string value to upper case.
-     *
-     * @param    string        $mixedCaseString
-     * @return    string
-     */
-    public static function UPPERCASE($mixedCaseString)
-    {
-        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
-
-        if (is_bool($mixedCaseString)) {
-            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
-    }
-
-
-    /**
-     * PROPERCASE
-     *
-     * Converts a string value to upper case.
-     *
-     * @param    string        $mixedCaseString
-     * @return    string
-     */
-    public static function PROPERCASE($mixedCaseString)
-    {
-        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
-
-        if (is_bool($mixedCaseString)) {
-            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
-        }
-
-        return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
-    }
-
-
-    /**
-     * REPLACE
-     *
-     * @param    string    $oldText    String to modify
-     * @param    int        $start        Start character
-     * @param    int        $chars        Number of characters
-     * @param    string    $newText    String to replace in defined position
-     * @return    string
-     */
-    public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
-    {
-        $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
-        $start   = PHPExcel_Calculation_Functions::flattenSingleValue($start);
-        $chars   = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
-        $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
-
-        $left = self::LEFT($oldText, $start-1);
-        $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1);
-
-        return $left.$newText.$right;
-    }
-
-
-    /**
-     * SUBSTITUTE
-     *
-     * @param    string    $text        Value
-     * @param    string    $fromText    From Value
-     * @param    string    $toText        To Value
-     * @param    integer    $instance    Instance Number
-     * @return    string
-     */
-    public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
-    {
-        $text     = PHPExcel_Calculation_Functions::flattenSingleValue($text);
-        $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
-        $toText   = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
-        $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
-
-        if ($instance == 0) {
-            if (function_exists('mb_str_replace')) {
-                return mb_str_replace($fromText, $toText, $text);
-            } else {
-                return str_replace($fromText, $toText, $text);
-            }
-        } else {
-            $pos = -1;
-            while ($instance > 0) {
-                if (function_exists('mb_strpos')) {
-                    $pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
-                } else {
-                    $pos = strpos($text, $fromText, $pos+1);
-                }
-                if ($pos === false) {
-                    break;
-                }
-                --$instance;
-            }
-            if ($pos !== false) {
-                if (function_exists('mb_strlen')) {
-                    return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
-                } else {
-                    return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
-                }
-            }
-        }
-
-        return $text;
-    }
-
-
-    /**
-     * RETURNSTRING
-     *
-     * @param    mixed    $testValue    Value to check
-     * @return    boolean
-     */
-    public static function RETURNSTRING($testValue = '')
-    {
-        $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
-
-        if (is_string($testValue)) {
-            return $testValue;
-        }
-        return null;
-    }
-
-
-    /**
-     * TEXTFORMAT
-     *
-     * @param    mixed    $value    Value to check
-     * @param    string    $format    Format mask to use
-     * @return    boolean
-     */
-    public static function TEXTFORMAT($value, $format)
-    {
-        $value  = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-        $format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
-
-        if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
-            $value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
-        }
-
-        return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
-    }
-
-    /**
-     * VALUE
-     *
-     * @param    mixed    $value    Value to check
-     * @return    boolean
-     */
-    public static function VALUE($value = '')
-    {
-        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
-
-        if (!is_numeric($value)) {
-            $numberValue = str_replace(
-                PHPExcel_Shared_String::getThousandsSeparator(),
-                '',
-                trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
-            );
-            if (is_numeric($numberValue)) {
-                return (float) $numberValue;
-            }
-
-            $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
-            PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
-
-            if (strpos($value, ':') !== false) {
-                $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
-                if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
-                    PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
-                    return $timeValue;
-                }
-            }
-            $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
-            if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
-                PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
-                return $dateValue;
-            }
-            PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
-
-            return PHPExcel_Calculation_Functions::VALUE();
-        }
-        return (float) $value;
-    }
-}

+ 0 - 111
libs/PHPExcel/PHPExcel/Calculation/Token/Stack.php

xqd
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Calculation_Token_Stack
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Calculation
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Calculation_Token_Stack
-{
-    /**
-     *  The parser stack for formulae
-     *
-     *  @var mixed[]
-     */
-    private $stack = array();
-
-    /**
-     *  Count of entries in the parser stack
-     *
-     *  @var integer
-     */
-    private $count = 0;
-
-    /**
-     * Return the number of entries on the stack
-     *
-     * @return  integer
-     */
-    public function count()
-    {
-        return $this->count;
-    }
-
-    /**
-     * Push a new entry onto the stack
-     *
-     * @param  mixed  $type
-     * @param  mixed  $value
-     * @param  mixed  $reference
-     */
-    public function push($type, $value, $reference = null)
-    {
-        $this->stack[$this->count++] = array(
-            'type'      => $type,
-            'value'     => $value,
-            'reference' => $reference
-        );
-        if ($type == 'Function') {
-            $localeFunction = PHPExcel_Calculation::localeFunc($value);
-            if ($localeFunction != $value) {
-                $this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
-            }
-        }
-    }
-
-    /**
-     * Pop the last entry from the stack
-     *
-     * @return  mixed
-     */
-    public function pop()
-    {
-        if ($this->count > 0) {
-            return $this->stack[--$this->count];
-        }
-        return null;
-    }
-
-    /**
-     * Return an entry from the stack without removing it
-     *
-     * @param   integer  $n  number indicating how far back in the stack we want to look
-     * @return  mixed
-     */
-    public function last($n = 1)
-    {
-        if ($this->count - $n < 0) {
-            return null;
-        }
-        return $this->stack[$this->count - $n];
-    }
-
-    /**
-     * Clear the stack
-     */
-    public function clear()
-    {
-        $this->stack = array();
-        $this->count = 0;
-    }
-}

+ 0 - 351
libs/PHPExcel/PHPExcel/Calculation/functionlist.txt

xqd
@@ -1,351 +0,0 @@
-ABS
-ACCRINT
-ACCRINTM
-ACOS
-ACOSH
-ADDRESS
-AMORDEGRC
-AMORLINC
-AND
-AREAS
-ASC
-ASIN
-ASINH
-ATAN
-ATAN2
-ATANH
-AVEDEV
-AVERAGE
-AVERAGEA
-AVERAGEIF
-AVERAGEIFS
-BAHTTEXT
-BESSELI
-BESSELJ
-BESSELK
-BESSELY
-BETADIST
-BETAINV
-BIN2DEC
-BIN2HEX
-BIN2OCT
-BINOMDIST
-CEILING
-CELL
-CHAR
-CHIDIST
-CHIINV
-CHITEST
-CHOOSE
-CLEAN
-CODE
-COLUMN
-COLUMNS
-COMBIN
-COMPLEX
-CONCATENATE
-CONFIDENCE
-CONVERT
-CORREL
-COS
-COSH
-COUNT
-COUNTA
-COUNTBLANK
-COUNTIF
-COUNTIFS
-COUPDAYBS
-COUPDAYBS
-COUPDAYSNC
-COUPNCD
-COUPNUM
-COUPPCD
-COVAR
-CRITBINOM
-CUBEKPIMEMBER
-CUBEMEMBER
-CUBEMEMBERPROPERTY
-CUBERANKEDMEMBER
-CUBESET
-CUBESETCOUNT
-CUBEVALUE
-CUMIPMT
-CUMPRINC
-DATE
-DATEDIF
-DATEVALUE
-DAVERAGE
-DAY
-DAYS360
-DB
-DCOUNT
-DCOUNTA
-DDB
-DEC2BIN
-DEC2HEX
-DEC2OCT
-DEGREES
-DELTA
-DEVSQ
-DGET
-DISC
-DMAX
-DMIN
-DOLLAR
-DOLLARDE
-DOLLARFR
-DPRODUCT
-DSTDEV
-DSTDEVP
-DSUM
-DURATION
-DVAR
-DVARP
-EDATE
-EFFECT
-EOMONTH
-ERF
-ERFC
-ERROR.TYPE
-EVEN
-EXACT
-EXP
-EXPONDIST
-FACT
-FACTDOUBLE
-FALSE
-FDIST
-FIND
-FINDB
-FINV
-FISHER
-FISHERINV
-FIXED
-FLOOR
-FORECAST
-FREQUENCY
-FTEST
-FV
-FVSCHEDULE
-GAMAMDIST
-GAMMAINV
-GAMMALN
-GCD
-GEOMEAN
-GESTEP
-GETPIVOTDATA
-GROWTH
-HARMEAN
-HEX2BIN
-HEX2OCT
-HLOOKUP
-HOUR
-HYPERLINK
-HYPGEOMDIST
-IF
-IFERROR
-IMABS
-IMAGINARY
-IMARGUMENT
-IMCONJUGATE
-IMCOS
-IMEXP
-IMLN
-IMLOG10
-IMLOG2
-IMPOWER
-IMPRODUCT
-IMREAL
-IMSIN
-IMSQRT
-IMSUB
-IMSUM
-INDEX
-INDIRECT
-INFO
-INT
-INTERCEPT
-INTRATE
-IPMT
-IRR
-ISBLANK
-ISERR
-ISERROR
-ISEVEN
-ISLOGICAL
-ISNA
-ISNONTEXT
-ISNUMBER
-ISODD
-ISPMT
-ISREF
-ISTEXT
-JIS
-KURT
-LARGE
-LCM
-LEFT
-LEFTB
-LEN
-LENB
-LINEST
-LN
-LOG
-LOG10
-LOGEST
-LOGINV
-LOGNORMDIST
-LOOKUP
-LOWER
-MATCH
-MAX
-MAXA
-MDETERM
-MDURATION
-MEDIAN
-MID
-MIDB
-MIN
-MINA
-MINUTE
-MINVERSE
-MIRR
-MMULT
-MOD
-MODE
-MONTH
-MROUND
-MULTINOMIAL
-N
-NA
-NEGBINOMDIST
-NETWORKDAYS
-NOMINAL
-NORMDIST
-NORMINV
-NORMSDIST
-NORMSINV
-NOT
-NOW
-NPER
-NPV
-OCT2BIN
-OCT2DEC
-OCT2HEX
-ODD
-ODDFPRICE
-ODDFYIELD
-ODDLPRICE
-ODDLYIELD
-OFFSET
-OR
-PEARSON
-PERCENTILE
-PERCENTRANK
-PERMUT
-PHONETIC
-PI
-PMT
-POISSON
-POWER
-PPMT
-PRICE
-PRICEDISC
-PRICEMAT
-PROB
-PRODUCT
-PROPER
-PV
-QUARTILE
-QUOTIENT
-RADIANS
-RAND
-RANDBETWEEN
-RANK
-RATE
-RECEIVED
-REPLACE
-REPLACEB
-REPT
-RIGHT
-RIGHTB
-ROMAN
-ROUND
-ROUNDDOWN
-ROUNDUP
-ROW
-ROWS
-RSQ
-RTD
-SEARCH
-SEARCHB
-SECOND
-SERIESSUM
-SIGN
-SIN
-SINH
-SKEW
-SLN
-SLOPE
-SMALL
-SQRT
-SQRTPI
-STANDARDIZE
-STDEV
-STDEVA
-STDEVP
-STDEVPA
-STEYX
-SUBSTITUTE
-SUBTOTAL
-SUM
-SUMIF
-SUMIFS
-SUMPRODUCT
-SUMSQ
-SUMX2MY2
-SUMX2PY2
-SUMXMY2
-SYD
-T
-TAN
-TANH
-TBILLEQ
-TBILLPRICE
-TBILLYIELD
-TDIST
-TEXT
-TIME
-TIMEVALUE
-TINV
-TODAY
-TRANSPOSE
-TREND
-TRIM
-TRIMMEAN
-TRUE
-TRUNC
-TTEST
-TYPE
-UPPER
-USDOLLAR
-VALUE
-VAR
-VARA
-VARP
-VARPA
-VDB
-VERSION
-VLOOKUP
-WEEKDAY
-WEEKNUM
-WEIBULL
-WORKDAY
-XIRR
-XNPV
-YEAR
-YEARFRAC
-YIELD
-YIELDDISC
-YIELDMAT
-ZTEST

+ 0 - 1032
libs/PHPExcel/PHPExcel/Cell.php

xqd
@@ -1,1032 +0,0 @@
-<?php
-
-/**
- *    PHPExcel_Cell
- *
- *    Copyright (c) 2006 - 2015 PHPExcel
- *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License as published by the Free Software Foundation; either
- *    version 2.1 of the License, or (at your option) any later version.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- *    @category    PHPExcel
- *    @package    PHPExcel_Cell
- *    @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- *    @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- *    @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell
-{
-    /**
-     *  Default range variable constant
-     *
-     *  @var  string
-     */
-    const DEFAULT_RANGE = 'A1:A1';
-
-    /**
-     *    Value binder to use
-     *
-     *    @var    PHPExcel_Cell_IValueBinder
-     */
-    private static $valueBinder;
-
-    /**
-     *    Value of the cell
-     *
-     *    @var    mixed
-     */
-    private $value;
-
-    /**
-     *    Calculated value of the cell (used for caching)
-     *    This returns the value last calculated by MS Excel or whichever spreadsheet program was used to
-     *        create the original spreadsheet file.
-     *    Note that this value is not guaranteed to reflect the actual calculated value because it is
-     *        possible that auto-calculation was disabled in the original spreadsheet, and underlying data
-     *        values used by the formula have changed since it was last calculated.
-     *
-     *    @var mixed
-     */
-    private $calculatedValue;
-
-    /**
-     *    Type of the cell data
-     *
-     *    @var    string
-     */
-    private $dataType;
-
-    /**
-     *    Parent worksheet
-     *
-     *    @var    PHPExcel_CachedObjectStorage_CacheBase
-     */
-    private $parent;
-
-    /**
-     *    Index to cellXf
-     *
-     *    @var    int
-     */
-    private $xfIndex = 0;
-
-    /**
-     *    Attributes of the formula
-     *
-     */
-    private $formulaAttributes;
-
-
-    /**
-     *    Send notification to the cache controller
-     *
-     *    @return void
-     **/
-    public function notifyCacheController()
-    {
-        $this->parent->updateCacheData($this);
-
-        return $this;
-    }
-
-    public function detach()
-    {
-        $this->parent = null;
-    }
-
-    public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
-    {
-        $this->parent = $parent;
-    }
-
-
-    /**
-     *    Create a new Cell
-     *
-     *    @param    mixed                $pValue
-     *    @param    string                $pDataType
-     *    @param    PHPExcel_Worksheet    $pSheet
-     *    @throws    PHPExcel_Exception
-     */
-    public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
-    {
-        // Initialise cell value
-        $this->value = $pValue;
-
-        // Set worksheet cache
-        $this->parent = $pSheet->getCellCacheController();
-
-        // Set datatype?
-        if ($pDataType !== null) {
-            if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
-                $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
-            }
-            $this->dataType = $pDataType;
-        } elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
-            throw new PHPExcel_Exception("Value could not be bound to cell.");
-        }
-    }
-
-    /**
-     *    Get cell coordinate column
-     *
-     *    @return    string
-     */
-    public function getColumn()
-    {
-        return $this->parent->getCurrentColumn();
-    }
-
-    /**
-     *    Get cell coordinate row
-     *
-     *    @return    int
-     */
-    public function getRow()
-    {
-        return $this->parent->getCurrentRow();
-    }
-
-    /**
-     *    Get cell coordinate
-     *
-     *    @return    string
-     */
-    public function getCoordinate()
-    {
-        return $this->parent->getCurrentAddress();
-    }
-
-    /**
-     *    Get cell value
-     *
-     *    @return    mixed
-     */
-    public function getValue()
-    {
-        return $this->value;
-    }
-
-    /**
-     *    Get cell value with formatting
-     *
-     *    @return    string
-     */
-    public function getFormattedValue()
-    {
-        return (string) PHPExcel_Style_NumberFormat::toFormattedString(
-            $this->getCalculatedValue(),
-            $this->getStyle()
-                ->getNumberFormat()->getFormatCode()
-        );
-    }
-
-    /**
-     *    Set cell value
-     *
-     *    Sets the value for a cell, automatically determining the datatype using the value binder
-     *
-     *    @param    mixed    $pValue                    Value
-     *    @return    PHPExcel_Cell
-     *    @throws    PHPExcel_Exception
-     */
-    public function setValue($pValue = null)
-    {
-        if (!self::getValueBinder()->bindValue($this, $pValue)) {
-            throw new PHPExcel_Exception("Value could not be bound to cell.");
-        }
-        return $this;
-    }
-
-    /**
-     *    Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder)
-     *
-     *    @param    mixed    $pValue            Value
-     *    @param    string    $pDataType        Explicit data type
-     *    @return    PHPExcel_Cell
-     *    @throws    PHPExcel_Exception
-     */
-    public function setValueExplicit($pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
-    {
-        // set the value according to data type
-        switch ($pDataType) {
-            case PHPExcel_Cell_DataType::TYPE_NULL:
-                $this->value = $pValue;
-                break;
-            case PHPExcel_Cell_DataType::TYPE_STRING2:
-                $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
-                // no break
-            case PHPExcel_Cell_DataType::TYPE_STRING:
-                // Synonym for string
-            case PHPExcel_Cell_DataType::TYPE_INLINE:
-                // Rich text
-                $this->value = PHPExcel_Cell_DataType::checkString($pValue);
-                break;
-            case PHPExcel_Cell_DataType::TYPE_NUMERIC:
-                $this->value = (float) $pValue;
-                break;
-            case PHPExcel_Cell_DataType::TYPE_FORMULA:
-                $this->value = (string) $pValue;
-                break;
-            case PHPExcel_Cell_DataType::TYPE_BOOL:
-                $this->value = (bool) $pValue;
-                break;
-            case PHPExcel_Cell_DataType::TYPE_ERROR:
-                $this->value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
-                break;
-            default:
-                throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType);
-                break;
-        }
-
-        // set the datatype
-        $this->dataType = $pDataType;
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    Get calculated cell value
-     *
-     *    @deprecated        Since version 1.7.8 for planned changes to cell for array formula handling
-     *
-     *    @param    boolean $resetLog  Whether the calculation engine logger should be reset or not
-     *    @return    mixed
-     *    @throws    PHPExcel_Exception
-     */
-    public function getCalculatedValue($resetLog = true)
-    {
-//echo 'Cell '.$this->getCoordinate().' value is a '.$this->dataType.' with a value of '.$this->getValue().PHP_EOL;
-        if ($this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
-            try {
-//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
-                $result = PHPExcel_Calculation::getInstance(
-                    $this->getWorksheet()->getParent()
-                )->calculateCellValue($this, $resetLog);
-//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL;
-                //    We don't yet handle array returns
-                if (is_array($result)) {
-                    while (is_array($result)) {
-                        $result = array_pop($result);
-                    }
-                }
-            } catch (PHPExcel_Exception $ex) {
-                if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
-//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
-                    return $this->calculatedValue; // Fallback for calculations referencing external files.
-                }
-//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
-                $result = '#N/A';
-                throw new PHPExcel_Calculation_Exception(
-                    $this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()
-                );
-            }
-
-            if ($result === '#Not Yet Implemented') {
-//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
-                return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
-            }
-//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
-            return $result;
-        } elseif ($this->value instanceof PHPExcel_RichText) {
-//        echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->value.'<br />';
-            return $this->value->getPlainText();
-        }
-//        echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->value.'<br />';
-        return $this->value;
-    }
-
-    /**
-     *    Set old calculated value (cached)
-     *
-     *    @param    mixed $pValue    Value
-     *    @return    PHPExcel_Cell
-     */
-    public function setCalculatedValue($pValue = null)
-    {
-        if ($pValue !== null) {
-            $this->calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
-        }
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    Get old calculated value (cached)
-     *    This returns the value last calculated by MS Excel or whichever spreadsheet program was used to
-     *        create the original spreadsheet file.
-     *    Note that this value is not guaranteed to refelect the actual calculated value because it is
-     *        possible that auto-calculation was disabled in the original spreadsheet, and underlying data
-     *        values used by the formula have changed since it was last calculated.
-     *
-     *    @return    mixed
-     */
-    public function getOldCalculatedValue()
-    {
-        return $this->calculatedValue;
-    }
-
-    /**
-     *    Get cell data type
-     *
-     *    @return string
-     */
-    public function getDataType()
-    {
-        return $this->dataType;
-    }
-
-    /**
-     *    Set cell data type
-     *
-     *    @param    string $pDataType
-     *    @return    PHPExcel_Cell
-     */
-    public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
-    {
-        if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
-            $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
-        }
-        $this->dataType = $pDataType;
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *  Identify if the cell contains a formula
-     *
-     *  @return boolean
-     */
-    public function isFormula()
-    {
-        return $this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
-    }
-
-    /**
-     *    Does this cell contain Data validation rules?
-     *
-     *    @return    boolean
-     *    @throws    PHPExcel_Exception
-     */
-    public function hasDataValidation()
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
-        }
-
-        return $this->getWorksheet()->dataValidationExists($this->getCoordinate());
-    }
-
-    /**
-     *    Get Data validation rules
-     *
-     *    @return    PHPExcel_Cell_DataValidation
-     *    @throws    PHPExcel_Exception
-     */
-    public function getDataValidation()
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
-        }
-
-        return $this->getWorksheet()->getDataValidation($this->getCoordinate());
-    }
-
-    /**
-     *    Set Data validation rules
-     *
-     *    @param    PHPExcel_Cell_DataValidation    $pDataValidation
-     *    @return    PHPExcel_Cell
-     *    @throws    PHPExcel_Exception
-     */
-    public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
-        }
-
-        $this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation);
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    Does this cell contain a Hyperlink?
-     *
-     *    @return boolean
-     *    @throws    PHPExcel_Exception
-     */
-    public function hasHyperlink()
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
-        }
-
-        return $this->getWorksheet()->hyperlinkExists($this->getCoordinate());
-    }
-
-    /**
-     *    Get Hyperlink
-     *
-     *    @return    PHPExcel_Cell_Hyperlink
-     *    @throws    PHPExcel_Exception
-     */
-    public function getHyperlink()
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
-        }
-
-        return $this->getWorksheet()->getHyperlink($this->getCoordinate());
-    }
-
-    /**
-     *    Set Hyperlink
-     *
-     *    @param    PHPExcel_Cell_Hyperlink    $pHyperlink
-     *    @return    PHPExcel_Cell
-     *    @throws    PHPExcel_Exception
-     */
-    public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
-    {
-        if (!isset($this->parent)) {
-            throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
-        }
-
-        $this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink);
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    Get parent worksheet
-     *
-     *    @return PHPExcel_CachedObjectStorage_CacheBase
-     */
-    public function getParent()
-    {
-        return $this->parent;
-    }
-
-    /**
-     *    Get parent worksheet
-     *
-     *    @return PHPExcel_Worksheet
-     */
-    public function getWorksheet()
-    {
-        return $this->parent->getParent();
-    }
-
-    /**
-     *    Is this cell in a merge range
-     *
-     *    @return boolean
-     */
-    public function isInMergeRange()
-    {
-        return (boolean) $this->getMergeRange();
-    }
-
-    /**
-     *    Is this cell the master (top left cell) in a merge range (that holds the actual data value)
-     *
-     *    @return boolean
-     */
-    public function isMergeRangeValueCell()
-    {
-        if ($mergeRange = $this->getMergeRange()) {
-            $mergeRange = PHPExcel_Cell::splitRange($mergeRange);
-            list($startCell) = $mergeRange[0];
-            if ($this->getCoordinate() === $startCell) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     *    If this cell is in a merge range, then return the range
-     *
-     *    @return string
-     */
-    public function getMergeRange()
-    {
-        foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) {
-            if ($this->isInRange($mergeRange)) {
-                return $mergeRange;
-            }
-        }
-        return false;
-    }
-
-    /**
-     *    Get cell style
-     *
-     *    @return    PHPExcel_Style
-     */
-    public function getStyle()
-    {
-        return $this->getWorksheet()->getStyle($this->getCoordinate());
-    }
-
-    /**
-     *    Re-bind parent
-     *
-     *    @param    PHPExcel_Worksheet $parent
-     *    @return    PHPExcel_Cell
-     */
-    public function rebindParent(PHPExcel_Worksheet $parent)
-    {
-        $this->parent = $parent->getCellCacheController();
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    Is cell in a specific range?
-     *
-     *    @param    string    $pRange        Cell range (e.g. A1:A1)
-     *    @return    boolean
-     */
-    public function isInRange($pRange = 'A1:A1')
-    {
-        list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange);
-
-        // Translate properties
-        $myColumn = self::columnIndexFromString($this->getColumn());
-        $myRow    = $this->getRow();
-
-        // Verify if cell is in range
-        return (($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) &&
-                ($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow)
-               );
-    }
-
-    /**
-     *    Coordinate from string
-     *
-     *    @param    string    $pCoordinateString
-     *    @return    array    Array containing column and row (indexes 0 and 1)
-     *    @throws    PHPExcel_Exception
-     */
-    public static function coordinateFromString($pCoordinateString = 'A1')
-    {
-        if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
-            return array($matches[1],$matches[2]);
-        } elseif ((strpos($pCoordinateString, ':') !== false) || (strpos($pCoordinateString, ',') !== false)) {
-            throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells');
-        } elseif ($pCoordinateString == '') {
-            throw new PHPExcel_Exception('Cell coordinate can not be zero-length string');
-        }
-
-        throw new PHPExcel_Exception('Invalid cell coordinate '.$pCoordinateString);
-    }
-
-    /**
-     *    Make string row, column or cell coordinate absolute
-     *
-     *    @param    string    $pCoordinateString        e.g. 'A' or '1' or 'A1'
-     *                    Note that this value can be a row or column reference as well as a cell reference
-     *    @return    string    Absolute coordinate        e.g. '$A' or '$1' or '$A$1'
-     *    @throws    PHPExcel_Exception
-     */
-    public static function absoluteReference($pCoordinateString = 'A1')
-    {
-        if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) {
-            // Split out any worksheet name from the reference
-            $worksheet = '';
-            $cellAddress = explode('!', $pCoordinateString);
-            if (count($cellAddress) > 1) {
-                list($worksheet, $pCoordinateString) = $cellAddress;
-            }
-            if ($worksheet > '') {
-                $worksheet .= '!';
-            }
-
-            // Create absolute coordinate
-            if (ctype_digit($pCoordinateString)) {
-                return $worksheet . '$' . $pCoordinateString;
-            } elseif (ctype_alpha($pCoordinateString)) {
-                return $worksheet . '$' . strtoupper($pCoordinateString);
-            }
-            return $worksheet . self::absoluteCoordinate($pCoordinateString);
-        }
-
-        throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells');
-    }
-
-    /**
-     *    Make string coordinate absolute
-     *
-     *    @param    string    $pCoordinateString        e.g. 'A1'
-     *    @return    string    Absolute coordinate        e.g. '$A$1'
-     *    @throws    PHPExcel_Exception
-     */
-    public static function absoluteCoordinate($pCoordinateString = 'A1')
-    {
-        if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) {
-            // Split out any worksheet name from the coordinate
-            $worksheet = '';
-            $cellAddress = explode('!', $pCoordinateString);
-            if (count($cellAddress) > 1) {
-                list($worksheet, $pCoordinateString) = $cellAddress;
-            }
-            if ($worksheet > '') {
-                $worksheet .= '!';
-            }
-
-            // Create absolute coordinate
-            list($column, $row) = self::coordinateFromString($pCoordinateString);
-            $column = ltrim($column, '$');
-            $row = ltrim($row, '$');
-            return $worksheet . '$' . $column . '$' . $row;
-        }
-
-        throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells');
-    }
-
-    /**
-     *    Split range into coordinate strings
-     *
-     *    @param    string    $pRange        e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'
-     *    @return    array    Array containg one or more arrays containing one or two coordinate strings
-     *                                e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11'))
-     *                                        or array('B4')
-     */
-    public static function splitRange($pRange = 'A1:A1')
-    {
-        // Ensure $pRange is a valid range
-        if (empty($pRange)) {
-            $pRange = self::DEFAULT_RANGE;
-        }
-
-        $exploded = explode(',', $pRange);
-        $counter = count($exploded);
-        for ($i = 0; $i < $counter; ++$i) {
-            $exploded[$i] = explode(':', $exploded[$i]);
-        }
-        return $exploded;
-    }
-
-    /**
-     *    Build range from coordinate strings
-     *
-     *    @param    array    $pRange    Array containg one or more arrays containing one or two coordinate strings
-     *    @return    string    String representation of $pRange
-     *    @throws    PHPExcel_Exception
-     */
-    public static function buildRange($pRange)
-    {
-        // Verify range
-        if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) {
-            throw new PHPExcel_Exception('Range does not contain any information');
-        }
-
-        // Build range
-        $imploded = array();
-        $counter = count($pRange);
-        for ($i = 0; $i < $counter; ++$i) {
-            $pRange[$i] = implode(':', $pRange[$i]);
-        }
-        $imploded = implode(',', $pRange);
-
-        return $imploded;
-    }
-
-    /**
-     *    Calculate range boundaries
-     *
-     *    @param    string    $pRange        Cell range (e.g. A1:A1)
-     *    @return    array    Range coordinates array(Start Cell, End Cell)
-     *                    where Start Cell and End Cell are arrays (Column Number, Row Number)
-     */
-    public static function rangeBoundaries($pRange = 'A1:A1')
-    {
-        // Ensure $pRange is a valid range
-        if (empty($pRange)) {
-            $pRange = self::DEFAULT_RANGE;
-        }
-
-        // Uppercase coordinate
-        $pRange = strtoupper($pRange);
-
-        // Extract range
-        if (strpos($pRange, ':') === false) {
-            $rangeA = $rangeB = $pRange;
-        } else {
-            list($rangeA, $rangeB) = explode(':', $pRange);
-        }
-
-        // Calculate range outer borders
-        $rangeStart = self::coordinateFromString($rangeA);
-        $rangeEnd    = self::coordinateFromString($rangeB);
-
-        // Translate column into index
-        $rangeStart[0]    = self::columnIndexFromString($rangeStart[0]);
-        $rangeEnd[0]    = self::columnIndexFromString($rangeEnd[0]);
-
-        return array($rangeStart, $rangeEnd);
-    }
-
-    /**
-     *    Calculate range dimension
-     *
-     *    @param    string    $pRange        Cell range (e.g. A1:A1)
-     *    @return    array    Range dimension (width, height)
-     */
-    public static function rangeDimension($pRange = 'A1:A1')
-    {
-        // Calculate range outer borders
-        list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange);
-
-        return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) );
-    }
-
-    /**
-     *    Calculate range boundaries
-     *
-     *    @param    string    $pRange        Cell range (e.g. A1:A1)
-     *    @return    array    Range coordinates array(Start Cell, End Cell)
-     *                    where Start Cell and End Cell are arrays (Column ID, Row Number)
-     */
-    public static function getRangeBoundaries($pRange = 'A1:A1')
-    {
-        // Ensure $pRange is a valid range
-        if (empty($pRange)) {
-            $pRange = self::DEFAULT_RANGE;
-        }
-
-        // Uppercase coordinate
-        $pRange = strtoupper($pRange);
-
-        // Extract range
-        if (strpos($pRange, ':') === false) {
-            $rangeA = $rangeB = $pRange;
-        } else {
-            list($rangeA, $rangeB) = explode(':', $pRange);
-        }
-
-        return array( self::coordinateFromString($rangeA), self::coordinateFromString($rangeB));
-    }
-
-    /**
-     *    Column index from string
-     *
-     *    @param    string $pString
-     *    @return    int Column index (base 1 !!!)
-     */
-    public static function columnIndexFromString($pString = 'A')
-    {
-        //    Using a lookup cache adds a slight memory overhead, but boosts speed
-        //    caching using a static within the method is faster than a class static,
-        //        though it's additional memory overhead
-        static $_indexCache = array();
-
-        if (isset($_indexCache[$pString])) {
-            return $_indexCache[$pString];
-        }
-        //    It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
-        //        and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
-        //        memory overhead either
-        static $_columnLookup = array(
-            'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13,
-            'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26,
-            'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13,
-            'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26
-        );
-
-        //    We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
-        //        for improved performance
-        if (isset($pString{0})) {
-            if (!isset($pString{1})) {
-                $_indexCache[$pString] = $_columnLookup[$pString];
-                return $_indexCache[$pString];
-            } elseif (!isset($pString{2})) {
-                $_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
-                return $_indexCache[$pString];
-            } elseif (!isset($pString{3})) {
-                $_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
-                return $_indexCache[$pString];
-            }
-        }
-        throw new PHPExcel_Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty"));
-    }
-
-    /**
-     *    String from columnindex
-     *
-     *    @param    int $pColumnIndex Column index (base 0 !!!)
-     *    @return    string
-     */
-    public static function stringFromColumnIndex($pColumnIndex = 0)
-    {
-        //    Using a lookup cache adds a slight memory overhead, but boosts speed
-        //    caching using a static within the method is faster than a class static,
-        //        though it's additional memory overhead
-        static $_indexCache = array();
-
-        if (!isset($_indexCache[$pColumnIndex])) {
-            // Determine column string
-            if ($pColumnIndex < 26) {
-                $_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex);
-            } elseif ($pColumnIndex < 702) {
-                $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) .
-                                              chr(65 + $pColumnIndex % 26);
-            } else {
-                $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) .
-                                              chr(65 + ((($pColumnIndex - 26) % 676) / 26)) .
-                                              chr(65 + $pColumnIndex % 26);
-            }
-        }
-        return $_indexCache[$pColumnIndex];
-    }
-
-    /**
-     *    Extract all cell references in range
-     *
-     *    @param    string    $pRange        Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)
-     *    @return    array    Array containing single cell references
-     */
-    public static function extractAllCellReferencesInRange($pRange = 'A1')
-    {
-        // Returnvalue
-        $returnValue = array();
-
-        // Explode spaces
-        $cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
-        foreach ($cellBlocks as $cellBlock) {
-            // Single cell?
-            if (strpos($cellBlock, ':') === false && strpos($cellBlock, ',') === false) {
-                $returnValue[] = $cellBlock;
-                continue;
-            }
-
-            // Range...
-            $ranges = self::splitRange($cellBlock);
-            foreach ($ranges as $range) {
-                // Single cell?
-                if (!isset($range[1])) {
-                    $returnValue[] = $range[0];
-                    continue;
-                }
-
-                // Range...
-                list($rangeStart, $rangeEnd)    = $range;
-                sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow);
-                sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow);
-                ++$endCol;
-
-                // Current data
-                $currentCol = $startCol;
-                $currentRow = $startRow;
-
-                // Loop cells
-                while ($currentCol != $endCol) {
-                    while ($currentRow <= $endRow) {
-                        $returnValue[] = $currentCol.$currentRow;
-                        ++$currentRow;
-                    }
-                    ++$currentCol;
-                    $currentRow = $startRow;
-                }
-            }
-        }
-
-        //    Sort the result by column and row
-        $sortKeys = array();
-        foreach (array_unique($returnValue) as $coord) {
-            sscanf($coord, '%[A-Z]%d', $column, $row);
-            $sortKeys[sprintf('%3s%09d', $column, $row)] = $coord;
-        }
-        ksort($sortKeys);
-
-        // Return value
-        return array_values($sortKeys);
-    }
-
-    /**
-     * Compare 2 cells
-     *
-     * @param    PHPExcel_Cell    $a    Cell a
-     * @param    PHPExcel_Cell    $b    Cell b
-     * @return    int        Result of comparison (always -1 or 1, never zero!)
-     */
-    public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
-    {
-        if ($a->getRow() < $b->getRow()) {
-            return -1;
-        } elseif ($a->getRow() > $b->getRow()) {
-            return 1;
-        } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
-            return -1;
-        } else {
-            return 1;
-        }
-    }
-
-    /**
-     * Get value binder to use
-     *
-     * @return PHPExcel_Cell_IValueBinder
-     */
-    public static function getValueBinder()
-    {
-        if (self::$valueBinder === null) {
-            self::$valueBinder = new PHPExcel_Cell_DefaultValueBinder();
-        }
-
-        return self::$valueBinder;
-    }
-
-    /**
-     * Set value binder to use
-     *
-     * @param PHPExcel_Cell_IValueBinder $binder
-     * @throws PHPExcel_Exception
-     */
-    public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null)
-    {
-        if ($binder === null) {
-            throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
-        }
-
-        self::$valueBinder = $binder;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if ((is_object($value)) && ($key != 'parent')) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-
-    /**
-     * Get index to cellXf
-     *
-     * @return int
-     */
-    public function getXfIndex()
-    {
-        return $this->xfIndex;
-    }
-
-    /**
-     * Set index to cellXf
-     *
-     * @param int $pValue
-     * @return PHPExcel_Cell
-     */
-    public function setXfIndex($pValue = 0)
-    {
-        $this->xfIndex = $pValue;
-
-        return $this->notifyCacheController();
-    }
-
-    /**
-     *    @deprecated        Since version 1.7.8 for planned changes to cell for array formula handling
-     */
-    public function setFormulaAttributes($pAttributes)
-    {
-        $this->formulaAttributes = $pAttributes;
-        return $this;
-    }
-
-    /**
-     *    @deprecated        Since version 1.7.8 for planned changes to cell for array formula handling
-     */
-    public function getFormulaAttributes()
-    {
-        return $this->formulaAttributes;
-    }
-
-    /**
-     * Convert to string
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return (string) $this->getValue();
-    }
-}

+ 0 - 187
libs/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php

xqd
@@ -1,187 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Cell_AdvancedValueBinder
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
-{
-    /**
-     * Bind value to a cell
-     *
-     * @param  PHPExcel_Cell  $cell  Cell to bind value to
-     * @param  mixed $value          Value to bind in cell
-     * @return boolean
-     */
-    public function bindValue(PHPExcel_Cell $cell, $value = null)
-    {
-        // sanitize UTF-8 strings
-        if (is_string($value)) {
-            $value = PHPExcel_Shared_String::SanitizeUTF8($value);
-        }
-
-        // Find out data type
-        $dataType = parent::dataTypeForValue($value);
-
-        // Style logic - strings
-        if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
-            //    Test for booleans using locale-setting
-            if ($value == PHPExcel_Calculation::getTRUE()) {
-                $cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL);
-                return true;
-            } elseif ($value == PHPExcel_Calculation::getFALSE()) {
-                $cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL);
-                return true;
-            }
-
-            // Check for number in scientific format
-            if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
-                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                return true;
-            }
-
-            // Check for fraction
-            if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
-                // Convert value to number
-                $value = $matches[2] / $matches[3];
-                if ($matches[1] == '-') {
-                    $value = 0 - $value;
-                }
-                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode('??/??');
-                return true;
-            } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
-                // Convert value to number
-                $value = $matches[2] + ($matches[3] / $matches[4]);
-                if ($matches[1] == '-') {
-                    $value = 0 - $value;
-                }
-                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode('# ??/??');
-                return true;
-            }
-
-            // Check for percentage
-            if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
-                // Convert value to number
-                $value = (float) str_replace('%', '', $value) / 100;
-                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
-                return true;
-            }
-
-            // Check for currency
-            $currencyCode = PHPExcel_Shared_String::getCurrencyCode();
-            $decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
-            $thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
-            if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
-                // Convert value to number
-                $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
-                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode(
-                        str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
-                    );
-                return true;
-            } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
-                // Convert value to number
-                $value = (float) trim(str_replace(array('$',','), '', $value));
-                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
-                return true;
-            }
-
-            // Check for time without seconds e.g. '9:45', '09:45'
-            if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
-                // Convert value to number
-                list($h, $m) = explode(':', $value);
-                $days = $h / 24 + $m / 1440;
-                $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
-                return true;
-            }
-
-            // Check for time with seconds '9:45:59', '09:45:59'
-            if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
-                // Convert value to number
-                list($h, $m, $s) = explode(':', $value);
-                $days = $h / 24 + $m / 1440 + $s / 86400;
-                // Convert value to number
-                $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
-                return true;
-            }
-
-            // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
-            if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
-                // Convert value to number
-                $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-                // Determine style. Either there is a time part or not. Look for ':'
-                if (strpos($value, ':') !== false) {
-                    $formatCode = 'yyyy-mm-dd h:mm';
-                } else {
-                    $formatCode = 'yyyy-mm-dd';
-                }
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getNumberFormat()->setFormatCode($formatCode);
-                return true;
-            }
-
-            // Check for newline character "\n"
-            if (strpos($value, "\n") !== false) {
-                $value = PHPExcel_Shared_String::SanitizeUTF8($value);
-                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
-                // Set style
-                $cell->getWorksheet()->getStyle($cell->getCoordinate())
-                    ->getAlignment()->setWrapText(true);
-                return true;
-            }
-        }
-
-        // Not bound yet? Use parent...
-        return parent::bindValue($cell, $value);
-    }
-}

+ 0 - 115
libs/PHPExcel/PHPExcel/Cell/DataType.php

xqd
@@ -1,115 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Cell_DataType
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell_DataType
-{
-    /* Data types */
-    const TYPE_STRING2  = 'str';
-    const TYPE_STRING   = 's';
-    const TYPE_FORMULA  = 'f';
-    const TYPE_NUMERIC  = 'n';
-    const TYPE_BOOL     = 'b';
-    const TYPE_NULL     = 'null';
-    const TYPE_INLINE   = 'inlineStr';
-    const TYPE_ERROR    = 'e';
-
-    /**
-     * List of error codes
-     *
-     * @var array
-     */
-    private static $errorCodes = array(
-        '#NULL!'  => 0,
-        '#DIV/0!' => 1,
-        '#VALUE!' => 2,
-        '#REF!'   => 3,
-        '#NAME?'  => 4,
-        '#NUM!'   => 5,
-        '#N/A'    => 6
-    );
-
-    /**
-     * Get list of error codes
-     *
-     * @return array
-     */
-    public static function getErrorCodes()
-    {
-        return self::$errorCodes;
-    }
-
-    /**
-     * DataType for value
-     *
-     * @deprecated  Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
-     * @param       mixed  $pValue
-     * @return      string
-     */
-    public static function dataTypeForValue($pValue = null)
-    {
-        return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
-    }
-
-    /**
-     * Check a string that it satisfies Excel requirements
-     *
-     * @param  mixed  Value to sanitize to an Excel string
-     * @return mixed  Sanitized value
-     */
-    public static function checkString($pValue = null)
-    {
-        if ($pValue instanceof PHPExcel_RichText) {
-            // TODO: Sanitize Rich-Text string (max. character count is 32,767)
-            return $pValue;
-        }
-
-        // string must never be longer than 32,767 characters, truncate if necessary
-        $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
-
-        // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
-        $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
-
-        return $pValue;
-    }
-
-    /**
-     * Check a value that it is a valid error code
-     *
-     * @param  mixed   Value to sanitize to an Excel error code
-     * @return string  Sanitized value
-     */
-    public static function checkErrorCode($pValue = null)
-    {
-        $pValue = (string) $pValue;
-
-        if (!array_key_exists($pValue, self::$errorCodes)) {
-            $pValue = '#NULL!';
-        }
-
-        return $pValue;
-    }
-}

+ 0 - 492
libs/PHPExcel/PHPExcel/Cell/DataValidation.php

xqd
@@ -1,492 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Cell_DataValidation
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell_DataValidation
-{
-    /* Data validation types */
-    const TYPE_NONE        = 'none';
-    const TYPE_CUSTOM      = 'custom';
-    const TYPE_DATE        = 'date';
-    const TYPE_DECIMAL     = 'decimal';
-    const TYPE_LIST        = 'list';
-    const TYPE_TEXTLENGTH  = 'textLength';
-    const TYPE_TIME        = 'time';
-    const TYPE_WHOLE       = 'whole';
-
-    /* Data validation error styles */
-    const STYLE_STOP         = 'stop';
-    const STYLE_WARNING      = 'warning';
-    const STYLE_INFORMATION  = 'information';
-
-    /* Data validation operators */
-    const OPERATOR_BETWEEN             = 'between';
-    const OPERATOR_EQUAL               = 'equal';
-    const OPERATOR_GREATERTHAN         = 'greaterThan';
-    const OPERATOR_GREATERTHANOREQUAL  = 'greaterThanOrEqual';
-    const OPERATOR_LESSTHAN            = 'lessThan';
-    const OPERATOR_LESSTHANOREQUAL     = 'lessThanOrEqual';
-    const OPERATOR_NOTBETWEEN          = 'notBetween';
-    const OPERATOR_NOTEQUAL            = 'notEqual';
-
-    /**
-     * Formula 1
-     *
-     * @var string
-     */
-    private $formula1;
-
-    /**
-     * Formula 2
-     *
-     * @var string
-     */
-    private $formula2;
-
-    /**
-     * Type
-     *
-     * @var string
-     */
-    private $type = PHPExcel_Cell_DataValidation::TYPE_NONE;
-
-    /**
-     * Error style
-     *
-     * @var string
-     */
-    private $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
-
-    /**
-     * Operator
-     *
-     * @var string
-     */
-    private $operator;
-
-    /**
-     * Allow Blank
-     *
-     * @var boolean
-     */
-    private $allowBlank;
-
-    /**
-     * Show DropDown
-     *
-     * @var boolean
-     */
-    private $showDropDown;
-
-    /**
-     * Show InputMessage
-     *
-     * @var boolean
-     */
-    private $showInputMessage;
-
-    /**
-     * Show ErrorMessage
-     *
-     * @var boolean
-     */
-    private $showErrorMessage;
-
-    /**
-     * Error title
-     *
-     * @var string
-     */
-    private $errorTitle;
-
-    /**
-     * Error
-     *
-     * @var string
-     */
-    private $error;
-
-    /**
-     * Prompt title
-     *
-     * @var string
-     */
-    private $promptTitle;
-
-    /**
-     * Prompt
-     *
-     * @var string
-     */
-    private $prompt;
-
-    /**
-     * Create a new PHPExcel_Cell_DataValidation
-     */
-    public function __construct()
-    {
-        // Initialise member variables
-        $this->formula1          = '';
-        $this->formula2          = '';
-        $this->type              = PHPExcel_Cell_DataValidation::TYPE_NONE;
-        $this->errorStyle        = PHPExcel_Cell_DataValidation::STYLE_STOP;
-        $this->operator          = '';
-        $this->allowBlank        = false;
-        $this->showDropDown      = false;
-        $this->showInputMessage  = false;
-        $this->showErrorMessage  = false;
-        $this->errorTitle        = '';
-        $this->error             = '';
-        $this->promptTitle       = '';
-        $this->prompt            = '';
-    }
-
-    /**
-     * Get Formula 1
-     *
-     * @return string
-     */
-    public function getFormula1()
-    {
-        return $this->formula1;
-    }
-
-    /**
-     * Set Formula 1
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setFormula1($value = '')
-    {
-        $this->formula1 = $value;
-        return $this;
-    }
-
-    /**
-     * Get Formula 2
-     *
-     * @return string
-     */
-    public function getFormula2()
-    {
-        return $this->formula2;
-    }
-
-    /**
-     * Set Formula 2
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setFormula2($value = '')
-    {
-        $this->formula2 = $value;
-        return $this;
-    }
-
-    /**
-     * Get Type
-     *
-     * @return string
-     */
-    public function getType()
-    {
-        return $this->type;
-    }
-
-    /**
-     * Set Type
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE)
-    {
-        $this->type = $value;
-        return $this;
-    }
-
-    /**
-     * Get Error style
-     *
-     * @return string
-     */
-    public function getErrorStyle()
-    {
-        return $this->errorStyle;
-    }
-
-    /**
-     * Set Error style
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP)
-    {
-        $this->errorStyle = $value;
-        return $this;
-    }
-
-    /**
-     * Get Operator
-     *
-     * @return string
-     */
-    public function getOperator()
-    {
-        return $this->operator;
-    }
-
-    /**
-     * Set Operator
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setOperator($value = '')
-    {
-        $this->operator = $value;
-        return $this;
-    }
-
-    /**
-     * Get Allow Blank
-     *
-     * @return boolean
-     */
-    public function getAllowBlank()
-    {
-        return $this->allowBlank;
-    }
-
-    /**
-     * Set Allow Blank
-     *
-     * @param  boolean    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setAllowBlank($value = false)
-    {
-        $this->allowBlank = $value;
-        return $this;
-    }
-
-    /**
-     * Get Show DropDown
-     *
-     * @return boolean
-     */
-    public function getShowDropDown()
-    {
-        return $this->showDropDown;
-    }
-
-    /**
-     * Set Show DropDown
-     *
-     * @param  boolean    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setShowDropDown($value = false)
-    {
-        $this->showDropDown = $value;
-        return $this;
-    }
-
-    /**
-     * Get Show InputMessage
-     *
-     * @return boolean
-     */
-    public function getShowInputMessage()
-    {
-        return $this->showInputMessage;
-    }
-
-    /**
-     * Set Show InputMessage
-     *
-     * @param  boolean    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setShowInputMessage($value = false)
-    {
-        $this->showInputMessage = $value;
-        return $this;
-    }
-
-    /**
-     * Get Show ErrorMessage
-     *
-     * @return boolean
-     */
-    public function getShowErrorMessage()
-    {
-        return $this->showErrorMessage;
-    }
-
-    /**
-     * Set Show ErrorMessage
-     *
-     * @param  boolean    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setShowErrorMessage($value = false)
-    {
-        $this->showErrorMessage = $value;
-        return $this;
-    }
-
-    /**
-     * Get Error title
-     *
-     * @return string
-     */
-    public function getErrorTitle()
-    {
-        return $this->errorTitle;
-    }
-
-    /**
-     * Set Error title
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setErrorTitle($value = '')
-    {
-        $this->errorTitle = $value;
-        return $this;
-    }
-
-    /**
-     * Get Error
-     *
-     * @return string
-     */
-    public function getError()
-    {
-        return $this->error;
-    }
-
-    /**
-     * Set Error
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setError($value = '')
-    {
-        $this->error = $value;
-        return $this;
-    }
-
-    /**
-     * Get Prompt title
-     *
-     * @return string
-     */
-    public function getPromptTitle()
-    {
-        return $this->promptTitle;
-    }
-
-    /**
-     * Set Prompt title
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setPromptTitle($value = '')
-    {
-        $this->promptTitle = $value;
-        return $this;
-    }
-
-    /**
-     * Get Prompt
-     *
-     * @return string
-     */
-    public function getPrompt()
-    {
-        return $this->prompt;
-    }
-
-    /**
-     * Set Prompt
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_DataValidation
-     */
-    public function setPrompt($value = '')
-    {
-        $this->prompt = $value;
-        return $this;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        return md5(
-            $this->formula1 .
-            $this->formula2 .
-            $this->type = PHPExcel_Cell_DataValidation::TYPE_NONE .
-            $this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP .
-            $this->operator .
-            ($this->allowBlank ? 't' : 'f') .
-            ($this->showDropDown ? 't' : 'f') .
-            ($this->showInputMessage ? 't' : 'f') .
-            ($this->showErrorMessage ? 't' : 'f') .
-            $this->errorTitle .
-            $this->error .
-            $this->promptTitle .
-            $this->prompt .
-            __CLASS__
-        );
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 102
libs/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php

xqd
@@ -1,102 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Cell_DefaultValueBinder
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
-{
-    /**
-     * Bind value to a cell
-     *
-     * @param  PHPExcel_Cell  $cell   Cell to bind value to
-     * @param  mixed          $value  Value to bind in cell
-     * @return boolean
-     */
-    public function bindValue(PHPExcel_Cell $cell, $value = null)
-    {
-        // sanitize UTF-8 strings
-        if (is_string($value)) {
-            $value = PHPExcel_Shared_String::SanitizeUTF8($value);
-        } elseif (is_object($value)) {
-            // Handle any objects that might be injected
-            if ($value instanceof DateTime) {
-                $value = $value->format('Y-m-d H:i:s');
-            } elseif (!($value instanceof PHPExcel_RichText)) {
-                $value = (string) $value;
-            }
-        }
-
-        // Set value explicit
-        $cell->setValueExplicit($value, self::dataTypeForValue($value));
-
-        // Done!
-        return true;
-    }
-
-    /**
-     * DataType for value
-     *
-     * @param   mixed  $pValue
-     * @return  string
-     */
-    public static function dataTypeForValue($pValue = null)
-    {
-        // Match the value against a few data types
-        if ($pValue === null) {
-            return PHPExcel_Cell_DataType::TYPE_NULL;
-        } elseif ($pValue === '') {
-            return PHPExcel_Cell_DataType::TYPE_STRING;
-        } elseif ($pValue instanceof PHPExcel_RichText) {
-            return PHPExcel_Cell_DataType::TYPE_INLINE;
-        } elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
-            return PHPExcel_Cell_DataType::TYPE_FORMULA;
-        } elseif (is_bool($pValue)) {
-            return PHPExcel_Cell_DataType::TYPE_BOOL;
-        } elseif (is_float($pValue) || is_int($pValue)) {
-            return PHPExcel_Cell_DataType::TYPE_NUMERIC;
-        } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
-            $tValue = ltrim($pValue, '+-');
-            if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
-                return PHPExcel_Cell_DataType::TYPE_STRING;
-            } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
-                return PHPExcel_Cell_DataType::TYPE_STRING;
-            }
-            return PHPExcel_Cell_DataType::TYPE_NUMERIC;
-        } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
-            return PHPExcel_Cell_DataType::TYPE_ERROR;
-        }
-
-        return PHPExcel_Cell_DataType::TYPE_STRING;
-    }
-}

+ 0 - 124
libs/PHPExcel/PHPExcel/Cell/Hyperlink.php

xqd
@@ -1,124 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Cell_Hyperlink
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Cell_Hyperlink
-{
-    /**
-     * URL to link the cell to
-     *
-     * @var string
-     */
-    private $url;
-
-    /**
-     * Tooltip to display on the hyperlink
-     *
-     * @var string
-     */
-    private $tooltip;
-
-    /**
-     * Create a new PHPExcel_Cell_Hyperlink
-     *
-     * @param  string  $pUrl      Url to link the cell to
-     * @param  string  $pTooltip  Tooltip to display on the hyperlink
-     */
-    public function __construct($pUrl = '', $pTooltip = '')
-    {
-        // Initialise member variables
-        $this->url     = $pUrl;
-        $this->tooltip = $pTooltip;
-    }
-
-    /**
-     * Get URL
-     *
-     * @return string
-     */
-    public function getUrl()
-    {
-        return $this->url;
-    }
-
-    /**
-     * Set URL
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_Hyperlink
-     */
-    public function setUrl($value = '')
-    {
-        $this->url = $value;
-        return $this;
-    }
-
-    /**
-     * Get tooltip
-     *
-     * @return string
-     */
-    public function getTooltip()
-    {
-        return $this->tooltip;
-    }
-
-    /**
-     * Set tooltip
-     *
-     * @param  string    $value
-     * @return PHPExcel_Cell_Hyperlink
-     */
-    public function setTooltip($value = '')
-    {
-        $this->tooltip = $value;
-        return $this;
-    }
-
-    /**
-     * Is this hyperlink internal? (to another worksheet)
-     *
-     * @return boolean
-     */
-    public function isInternal()
-    {
-        return strpos($this->url, 'sheet://') !== false;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        return md5(
-            $this->url .
-            $this->tooltip .
-            __CLASS__
-        );
-    }
-}

+ 0 - 47
libs/PHPExcel/PHPExcel/Cell/IValueBinder.php

xqd
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-/**
- * PHPExcel_Cell_IValueBinder
- *
- * @category   PHPExcel
- * @package    PHPExcel_Cell
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-interface PHPExcel_Cell_IValueBinder
-{
-    /**
-     * Bind value to a cell
-     *
-     * @param  PHPExcel_Cell $cell    Cell to bind value to
-     * @param  mixed $value           Value to bind in cell
-     * @return boolean
-     */
-    public function bindValue(PHPExcel_Cell $cell, $value = null);
-}

+ 0 - 680
libs/PHPExcel/PHPExcel/Chart.php

xqd
@@ -1,680 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart
-{
-    /**
-     * Chart Name
-     *
-     * @var string
-     */
-    private $name = '';
-
-    /**
-     * Worksheet
-     *
-     * @var PHPExcel_Worksheet
-     */
-    private $worksheet;
-
-    /**
-     * Chart Title
-     *
-     * @var PHPExcel_Chart_Title
-     */
-    private $title;
-
-    /**
-     * Chart Legend
-     *
-     * @var PHPExcel_Chart_Legend
-     */
-    private $legend;
-
-    /**
-     * X-Axis Label
-     *
-     * @var PHPExcel_Chart_Title
-     */
-    private $xAxisLabel;
-
-    /**
-     * Y-Axis Label
-     *
-     * @var PHPExcel_Chart_Title
-     */
-    private $yAxisLabel;
-
-    /**
-     * Chart Plot Area
-     *
-     * @var PHPExcel_Chart_PlotArea
-     */
-    private $plotArea;
-
-    /**
-     * Plot Visible Only
-     *
-     * @var boolean
-     */
-    private $plotVisibleOnly = true;
-
-    /**
-     * Display Blanks as
-     *
-     * @var string
-     */
-    private $displayBlanksAs = '0';
-
-    /**
-     * Chart Asix Y as
-     *
-     * @var PHPExcel_Chart_Axis
-     */
-    private $yAxis;
-
-    /**
-     * Chart Asix X as
-     *
-     * @var PHPExcel_Chart_Axis
-     */
-    private $xAxis;
-
-    /**
-     * Chart Major Gridlines as
-     *
-     * @var PHPExcel_Chart_GridLines
-     */
-    private $majorGridlines;
-
-    /**
-     * Chart Minor Gridlines as
-     *
-     * @var PHPExcel_Chart_GridLines
-     */
-    private $minorGridlines;
-
-    /**
-     * Top-Left Cell Position
-     *
-     * @var string
-     */
-    private $topLeftCellRef = 'A1';
-
-
-    /**
-     * Top-Left X-Offset
-     *
-     * @var integer
-     */
-    private $topLeftXOffset = 0;
-
-
-    /**
-     * Top-Left Y-Offset
-     *
-     * @var integer
-     */
-    private $topLeftYOffset = 0;
-
-
-    /**
-     * Bottom-Right Cell Position
-     *
-     * @var string
-     */
-    private $bottomRightCellRef = 'A1';
-
-
-    /**
-     * Bottom-Right X-Offset
-     *
-     * @var integer
-     */
-    private $bottomRightXOffset = 10;
-
-
-    /**
-     * Bottom-Right Y-Offset
-     *
-     * @var integer
-     */
-    private $bottomRightYOffset = 10;
-
-
-    /**
-     * Create a new PHPExcel_Chart
-     */
-    public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
-    {
-        $this->name = $name;
-        $this->title = $title;
-        $this->legend = $legend;
-        $this->xAxisLabel = $xAxisLabel;
-        $this->yAxisLabel = $yAxisLabel;
-        $this->plotArea = $plotArea;
-        $this->plotVisibleOnly = $plotVisibleOnly;
-        $this->displayBlanksAs = $displayBlanksAs;
-        $this->xAxis = $xAxis;
-        $this->yAxis = $yAxis;
-        $this->majorGridlines = $majorGridlines;
-        $this->minorGridlines = $minorGridlines;
-    }
-
-    /**
-     * Get Name
-     *
-     * @return string
-     */
-    public function getName()
-    {
-        return $this->name;
-    }
-
-    /**
-     * Get Worksheet
-     *
-     * @return PHPExcel_Worksheet
-     */
-    public function getWorksheet()
-    {
-        return $this->worksheet;
-    }
-
-    /**
-     * Set Worksheet
-     *
-     * @param    PHPExcel_Worksheet    $pValue
-     * @throws    PHPExcel_Chart_Exception
-     * @return PHPExcel_Chart
-     */
-    public function setWorksheet(PHPExcel_Worksheet $pValue = null)
-    {
-        $this->worksheet = $pValue;
-
-        return $this;
-    }
-
-    /**
-     * Get Title
-     *
-     * @return PHPExcel_Chart_Title
-     */
-    public function getTitle()
-    {
-        return $this->title;
-    }
-
-    /**
-     * Set Title
-     *
-     * @param    PHPExcel_Chart_Title $title
-     * @return    PHPExcel_Chart
-     */
-    public function setTitle(PHPExcel_Chart_Title $title)
-    {
-        $this->title = $title;
-
-        return $this;
-    }
-
-    /**
-     * Get Legend
-     *
-     * @return PHPExcel_Chart_Legend
-     */
-    public function getLegend()
-    {
-        return $this->legend;
-    }
-
-    /**
-     * Set Legend
-     *
-     * @param    PHPExcel_Chart_Legend $legend
-     * @return    PHPExcel_Chart
-     */
-    public function setLegend(PHPExcel_Chart_Legend $legend)
-    {
-        $this->legend = $legend;
-
-        return $this;
-    }
-
-    /**
-     * Get X-Axis Label
-     *
-     * @return PHPExcel_Chart_Title
-     */
-    public function getXAxisLabel()
-    {
-        return $this->xAxisLabel;
-    }
-
-    /**
-     * Set X-Axis Label
-     *
-     * @param    PHPExcel_Chart_Title $label
-     * @return    PHPExcel_Chart
-     */
-    public function setXAxisLabel(PHPExcel_Chart_Title $label)
-    {
-        $this->xAxisLabel = $label;
-
-        return $this;
-    }
-
-    /**
-     * Get Y-Axis Label
-     *
-     * @return PHPExcel_Chart_Title
-     */
-    public function getYAxisLabel()
-    {
-        return $this->yAxisLabel;
-    }
-
-    /**
-     * Set Y-Axis Label
-     *
-     * @param    PHPExcel_Chart_Title $label
-     * @return    PHPExcel_Chart
-     */
-    public function setYAxisLabel(PHPExcel_Chart_Title $label)
-    {
-        $this->yAxisLabel = $label;
-
-        return $this;
-    }
-
-    /**
-     * Get Plot Area
-     *
-     * @return PHPExcel_Chart_PlotArea
-     */
-    public function getPlotArea()
-    {
-        return $this->plotArea;
-    }
-
-    /**
-     * Get Plot Visible Only
-     *
-     * @return boolean
-     */
-    public function getPlotVisibleOnly()
-    {
-        return $this->plotVisibleOnly;
-    }
-
-    /**
-     * Set Plot Visible Only
-     *
-     * @param boolean $plotVisibleOnly
-     * @return PHPExcel_Chart
-     */
-    public function setPlotVisibleOnly($plotVisibleOnly = true)
-    {
-        $this->plotVisibleOnly = $plotVisibleOnly;
-
-        return $this;
-    }
-
-    /**
-     * Get Display Blanks as
-     *
-     * @return string
-     */
-    public function getDisplayBlanksAs()
-    {
-        return $this->displayBlanksAs;
-    }
-
-    /**
-     * Set Display Blanks as
-     *
-     * @param string $displayBlanksAs
-     * @return PHPExcel_Chart
-     */
-    public function setDisplayBlanksAs($displayBlanksAs = '0')
-    {
-        $this->displayBlanksAs = $displayBlanksAs;
-    }
-
-
-    /**
-     * Get yAxis
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    public function getChartAxisY()
-    {
-        if ($this->yAxis !== null) {
-            return $this->yAxis;
-        }
-
-        return new PHPExcel_Chart_Axis();
-    }
-
-    /**
-     * Get xAxis
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    public function getChartAxisX()
-    {
-        if ($this->xAxis !== null) {
-            return $this->xAxis;
-        }
-
-        return new PHPExcel_Chart_Axis();
-    }
-
-    /**
-     * Get Major Gridlines
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-    public function getMajorGridlines()
-    {
-        if ($this->majorGridlines !== null) {
-            return $this->majorGridlines;
-        }
-
-        return new PHPExcel_Chart_GridLines();
-    }
-
-    /**
-     * Get Minor Gridlines
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-    public function getMinorGridlines()
-    {
-        if ($this->minorGridlines !== null) {
-            return $this->minorGridlines;
-        }
-
-        return new PHPExcel_Chart_GridLines();
-    }
-
-
-    /**
-     * Set the Top Left position for the chart
-     *
-     * @param    string    $cell
-     * @param    integer    $xOffset
-     * @param    integer    $yOffset
-     * @return PHPExcel_Chart
-     */
-    public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
-    {
-        $this->topLeftCellRef = $cell;
-        if (!is_null($xOffset)) {
-            $this->setTopLeftXOffset($xOffset);
-        }
-        if (!is_null($yOffset)) {
-            $this->setTopLeftYOffset($yOffset);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get the top left position of the chart
-     *
-     * @return array    an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
-     */
-    public function getTopLeftPosition()
-    {
-        return array(
-            'cell'    => $this->topLeftCellRef,
-            'xOffset' => $this->topLeftXOffset,
-            'yOffset' => $this->topLeftYOffset
-        );
-    }
-
-    /**
-     * Get the cell address where the top left of the chart is fixed
-     *
-     * @return string
-     */
-    public function getTopLeftCell()
-    {
-        return $this->topLeftCellRef;
-    }
-
-    /**
-     * Set the Top Left cell position for the chart
-     *
-     * @param    string    $cell
-     * @return PHPExcel_Chart
-     */
-    public function setTopLeftCell($cell)
-    {
-        $this->topLeftCellRef = $cell;
-
-        return $this;
-    }
-
-    /**
-     * Set the offset position within the Top Left cell for the chart
-     *
-     * @param    integer    $xOffset
-     * @param    integer    $yOffset
-     * @return PHPExcel_Chart
-     */
-    public function setTopLeftOffset($xOffset = null, $yOffset = null)
-    {
-        if (!is_null($xOffset)) {
-            $this->setTopLeftXOffset($xOffset);
-        }
-        if (!is_null($yOffset)) {
-            $this->setTopLeftYOffset($yOffset);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get the offset position within the Top Left cell for the chart
-     *
-     * @return integer[]
-     */
-    public function getTopLeftOffset()
-    {
-        return array(
-            'X' => $this->topLeftXOffset,
-            'Y' => $this->topLeftYOffset
-        );
-    }
-
-    public function setTopLeftXOffset($xOffset)
-    {
-        $this->topLeftXOffset = $xOffset;
-
-        return $this;
-    }
-
-    public function getTopLeftXOffset()
-    {
-        return $this->topLeftXOffset;
-    }
-
-    public function setTopLeftYOffset($yOffset)
-    {
-        $this->topLeftYOffset = $yOffset;
-
-        return $this;
-    }
-
-    public function getTopLeftYOffset()
-    {
-        return $this->topLeftYOffset;
-    }
-
-    /**
-     * Set the Bottom Right position of the chart
-     *
-     * @param    string    $cell
-     * @param    integer    $xOffset
-     * @param    integer    $yOffset
-     * @return PHPExcel_Chart
-     */
-    public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
-    {
-        $this->bottomRightCellRef = $cell;
-        if (!is_null($xOffset)) {
-            $this->setBottomRightXOffset($xOffset);
-        }
-        if (!is_null($yOffset)) {
-            $this->setBottomRightYOffset($yOffset);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get the bottom right position of the chart
-     *
-     * @return array    an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
-     */
-    public function getBottomRightPosition()
-    {
-        return array(
-            'cell'    => $this->bottomRightCellRef,
-            'xOffset' => $this->bottomRightXOffset,
-            'yOffset' => $this->bottomRightYOffset
-        );
-    }
-
-    public function setBottomRightCell($cell)
-    {
-        $this->bottomRightCellRef = $cell;
-
-        return $this;
-    }
-
-    /**
-     * Get the cell address where the bottom right of the chart is fixed
-     *
-     * @return string
-     */
-    public function getBottomRightCell()
-    {
-        return $this->bottomRightCellRef;
-    }
-
-    /**
-     * Set the offset position within the Bottom Right cell for the chart
-     *
-     * @param    integer    $xOffset
-     * @param    integer    $yOffset
-     * @return PHPExcel_Chart
-     */
-    public function setBottomRightOffset($xOffset = null, $yOffset = null)
-    {
-        if (!is_null($xOffset)) {
-            $this->setBottomRightXOffset($xOffset);
-        }
-        if (!is_null($yOffset)) {
-            $this->setBottomRightYOffset($yOffset);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get the offset position within the Bottom Right cell for the chart
-     *
-     * @return integer[]
-     */
-    public function getBottomRightOffset()
-    {
-        return array(
-            'X' => $this->bottomRightXOffset,
-            'Y' => $this->bottomRightYOffset
-        );
-    }
-
-    public function setBottomRightXOffset($xOffset)
-    {
-        $this->bottomRightXOffset = $xOffset;
-
-        return $this;
-    }
-
-    public function getBottomRightXOffset()
-    {
-        return $this->bottomRightXOffset;
-    }
-
-    public function setBottomRightYOffset($yOffset)
-    {
-        $this->bottomRightYOffset = $yOffset;
-
-        return $this;
-    }
-
-    public function getBottomRightYOffset()
-    {
-        return $this->bottomRightYOffset;
-    }
-
-
-    public function refresh()
-    {
-        if ($this->worksheet !== null) {
-            $this->plotArea->refresh($this->worksheet);
-        }
-    }
-
-    public function render($outputDestination = null)
-    {
-        $libraryName = PHPExcel_Settings::getChartRendererName();
-        if (is_null($libraryName)) {
-            return false;
-        }
-        //    Ensure that data series values are up-to-date before we render
-        $this->refresh();
-
-        $libraryPath = PHPExcel_Settings::getChartRendererPath();
-        $includePath = str_replace('\\', '/', get_include_path());
-        $rendererPath = str_replace('\\', '/', $libraryPath);
-        if (strpos($rendererPath, $includePath) === false) {
-            set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
-        }
-
-        $rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
-        $renderer = new $rendererName($this);
-
-        if ($outputDestination == 'php://output') {
-            $outputDestination = null;
-        }
-        return $renderer->render($outputDestination);
-    }
-}

+ 0 - 561
libs/PHPExcel/PHPExcel/Chart/Axis.php

xqd
@@ -1,561 +0,0 @@
-<?php
-
-/**
- * Created by PhpStorm.
- * User: Wiktor Trzonkowski
- * Date: 6/17/14
- * Time: 12:11 PM
- */
-
-class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
-{
-    /**
-     * Axis Number
-     *
-     * @var  array of mixed
-     */
-    private $axisNumber = array(
-        'format' => self::FORMAT_CODE_GENERAL,
-        'source_linked' => 1
-    );
-
-    /**
-     * Axis Options
-     *
-     * @var  array of mixed
-     */
-    private $axisOptions = array(
-        'minimum' => null,
-        'maximum' => null,
-        'major_unit' => null,
-        'minor_unit' => null,
-        'orientation' => self::ORIENTATION_NORMAL,
-        'minor_tick_mark' => self::TICK_MARK_NONE,
-        'major_tick_mark' => self::TICK_MARK_NONE,
-        'axis_labels' => self::AXIS_LABELS_NEXT_TO,
-        'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
-        'horizontal_crosses_value' => null
-    );
-
-    /**
-     * Fill Properties
-     *
-     * @var  array of mixed
-     */
-    private $fillProperties = array(
-        'type' => self::EXCEL_COLOR_TYPE_ARGB,
-        'value' => null,
-        'alpha' => 0
-    );
-
-    /**
-     * Line Properties
-     *
-     * @var  array of mixed
-     */
-    private $lineProperties = array(
-        'type' => self::EXCEL_COLOR_TYPE_ARGB,
-        'value' => null,
-        'alpha' => 0
-    );
-
-    /**
-     * Line Style Properties
-     *
-     * @var  array of mixed
-     */
-    private $lineStyleProperties = array(
-        'width' => '9525',
-        'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
-        'dash' => self::LINE_STYLE_DASH_SOLID,
-        'cap' => self::LINE_STYLE_CAP_FLAT,
-        'join' => self::LINE_STYLE_JOIN_BEVEL,
-        'arrow' => array(
-            'head' => array(
-                'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
-                'size' => self::LINE_STYLE_ARROW_SIZE_5
-            ),
-            'end' => array(
-                'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
-                'size' => self::LINE_STYLE_ARROW_SIZE_8
-            ),
-        )
-    );
-
-    /**
-     * Shadow Properties
-     *
-     * @var  array of mixed
-     */
-    private $shadowProperties = array(
-        'presets' => self::SHADOW_PRESETS_NOSHADOW,
-        'effect' => null,
-        'color' => array(
-            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
-            'value' => 'black',
-            'alpha' => 40,
-        ),
-        'size' => array(
-            'sx' => null,
-            'sy' => null,
-            'kx' => null
-        ),
-        'blur' => null,
-        'direction' => null,
-        'distance' => null,
-        'algn' => null,
-        'rotWithShape' => null
-    );
-
-    /**
-     * Glow Properties
-     *
-     * @var  array of mixed
-     */
-    private $glowProperties = array(
-        'size' => null,
-        'color' => array(
-            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
-            'value' => 'black',
-            'alpha' => 40
-        )
-    );
-
-    /**
-     * Soft Edge Properties
-     *
-     * @var  array of mixed
-     */
-    private $softEdges = array(
-        'size' => null
-    );
-
-    /**
-     * Get Series Data Type
-     *
-     * @return  string
-     */
-    public function setAxisNumberProperties($format_code)
-    {
-        $this->axisNumber['format'] = (string) $format_code;
-        $this->axisNumber['source_linked'] = 0;
-    }
-
-    /**
-     * Get Axis Number Format Data Type
-     *
-     * @return  string
-     */
-    public function getAxisNumberFormat()
-    {
-        return $this->axisNumber['format'];
-    }
-
-    /**
-     * Get Axis Number Source Linked
-     *
-     * @return  string
-     */
-    public function getAxisNumberSourceLinked()
-    {
-        return (string) $this->axisNumber['source_linked'];
-    }
-
-    /**
-     * Set Axis Options Properties
-     *
-     * @param string $axis_labels
-     * @param string $horizontal_crosses_value
-     * @param string $horizontal_crosses
-     * @param string $axis_orientation
-     * @param string $major_tmt
-     * @param string $minor_tmt
-     * @param string $minimum
-     * @param string $maximum
-     * @param string $major_unit
-     * @param string $minor_unit
-     *
-     */
-    public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
-    {
-        $this->axisOptions['axis_labels'] = (string) $axis_labels;
-        ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
-        ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
-        ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
-        ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
-        ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
-        ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
-        ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
-        ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
-        ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
-        ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
-    }
-
-    /**
-     * Get Axis Options Property
-     *
-     * @param string $property
-     *
-     * @return string
-     */
-    public function getAxisOptionsProperty($property)
-    {
-        return $this->axisOptions[$property];
-    }
-
-    /**
-     * Set Axis Orientation Property
-     *
-     * @param string $orientation
-     *
-     */
-    public function setAxisOrientation($orientation)
-    {
-        $this->orientation = (string) $orientation;
-    }
-
-    /**
-     * Set Fill Property
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     *
-     */
-    public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
-    {
-        $this->fillProperties = $this->setColorProperties($color, $alpha, $type);
-    }
-
-    /**
-     * Set Line Property
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     *
-     */
-    public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
-    {
-        $this->lineProperties = $this->setColorProperties($color, $alpha, $type);
-    }
-
-    /**
-     * Get Fill Property
-     *
-     * @param string $property
-     *
-     * @return string
-     */
-    public function getFillProperty($property)
-    {
-        return $this->fillProperties[$property];
-    }
-
-    /**
-     * Get Line Property
-     *
-     * @param string $property
-     *
-     * @return string
-     */
-    public function getLineProperty($property)
-    {
-        return $this->lineProperties[$property];
-    }
-
-    /**
-     * Set Line Style Properties
-     *
-     * @param float $line_width
-     * @param string $compound_type
-     * @param string $dash_type
-     * @param string $cap_type
-     * @param string $join_type
-     * @param string $head_arrow_type
-     * @param string $head_arrow_size
-     * @param string $end_arrow_type
-     * @param string $end_arrow_size
-     *
-     */
-    public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
-    {
-        (!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
-        (!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
-        (!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
-        (!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
-        (!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
-        (!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
-        (!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
-        (!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
-        (!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
-    }
-
-    /**
-     * Get Line Style Property
-     *
-     * @param array|string $elements
-     *
-     * @return string
-     */
-    public function getLineStyleProperty($elements)
-    {
-        return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
-    }
-
-    /**
-     * Get Line Style Arrow Excel Width
-     *
-     * @param string $arrow
-     *
-     * @return string
-     */
-    public function getLineStyleArrowWidth($arrow)
-    {
-        return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
-    }
-
-    /**
-     * Get Line Style Arrow Excel Length
-     *
-     * @param string $arrow
-     *
-     * @return string
-     */
-    public function getLineStyleArrowLength($arrow)
-    {
-        return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
-    }
-
-    /**
-     * Set Shadow Properties
-     *
-     * @param int $shadow_presets
-     * @param string $sh_color_value
-     * @param string $sh_color_type
-     * @param string $sh_color_alpha
-     * @param float $sh_blur
-     * @param int $sh_angle
-     * @param float $sh_distance
-     *
-     */
-    public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
-    {
-        $this->setShadowPresetsProperties((int) $sh_presets)
-            ->setShadowColor(
-                is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
-                is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
-                is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
-            )
-            ->setShadowBlur($sh_blur)
-            ->setShadowAngle($sh_angle)
-            ->setShadowDistance($sh_distance);
-    }
-
-    /**
-     * Set Shadow Color
-     *
-     * @param int $shadow_presets
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowPresetsProperties($shadow_presets)
-    {
-        $this->shadowProperties['presets'] = $shadow_presets;
-        $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Properties from Maped Values
-     *
-     * @param array $properties_map
-     * @param * $reference
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
-    {
-        $base_reference = $reference;
-        foreach ($properties_map as $property_key => $property_val) {
-            if (is_array($property_val)) {
-                if ($reference === null) {
-                    $reference = & $this->shadowProperties[$property_key];
-                } else {
-                    $reference = & $reference[$property_key];
-                }
-                $this->setShadowProperiesMapValues($property_val, $reference);
-            } else {
-                if ($base_reference === null) {
-                    $this->shadowProperties[$property_key] = $property_val;
-                } else {
-                    $reference[$property_key] = $property_val;
-                }
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Color
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowColor($color, $alpha, $type)
-    {
-        $this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Blur
-     *
-     * @param float $blur
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowBlur($blur)
-    {
-        if ($blur !== null) {
-            $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Angle
-     *
-     * @param int $angle
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowAngle($angle)
-    {
-        if ($angle !== null) {
-            $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Distance
-     *
-     * @param float $distance
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setShadowDistance($distance)
-    {
-        if ($distance !== null) {
-            $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get Glow Property
-     *
-     * @param float $size
-     * @param string $color_value
-     * @param int $color_alpha
-     * @param string $color_type
-     */
-    public function getShadowProperty($elements)
-    {
-        return $this->getArrayElementsValue($this->shadowProperties, $elements);
-    }
-
-    /**
-     * Set Glow Properties
-     *
-     * @param float $size
-     * @param string $color_value
-     * @param int $color_alpha
-     * @param string $color_type
-     */
-    public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
-    {
-        $this->setGlowSize($size)
-            ->setGlowColor(
-                is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
-                is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
-                is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
-            );
-    }
-
-    /**
-     * Get Glow Property
-     *
-     * @param array|string $property
-     *
-     * @return string
-     */
-    public function getGlowProperty($property)
-    {
-        return $this->getArrayElementsValue($this->glowProperties, $property);
-    }
-
-    /**
-     * Set Glow Color
-     *
-     * @param float $size
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setGlowSize($size)
-    {
-        if (!is_null($size)) {
-            $this->glowProperties['size'] = $this->getExcelPointsWidth($size);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Glow Color
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     *
-     * @return PHPExcel_Chart_Axis
-     */
-    private function setGlowColor($color, $alpha, $type)
-    {
-        $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
-
-        return $this;
-    }
-
-    /**
-     * Set Soft Edges Size
-     *
-     * @param float $size
-     */
-    public function setSoftEdges($size)
-    {
-        if (!is_null($size)) {
-            $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
-        }
-    }
-
-    /**
-     * Get Soft Edges Size
-     *
-     * @return string
-     */
-    public function getSoftEdgesSize()
-    {
-        return $this->softEdges['size'];
-    }
-}

+ 0 - 390
libs/PHPExcel/PHPExcel/Chart/DataSeries.php

xqd
@@ -1,390 +0,0 @@
-<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-/**
- * PHPExcel_Chart_DataSeries
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Chart_DataSeries
-{
-    const TYPE_BARCHART        = 'barChart';
-    const TYPE_BARCHART_3D     = 'bar3DChart';
-    const TYPE_LINECHART       = 'lineChart';
-    const TYPE_LINECHART_3D    = 'line3DChart';
-    const TYPE_AREACHART       = 'areaChart';
-    const TYPE_AREACHART_3D    = 'area3DChart';
-    const TYPE_PIECHART        = 'pieChart';
-    const TYPE_PIECHART_3D     = 'pie3DChart';
-    const TYPE_DOUGHTNUTCHART  = 'doughnutChart';
-    const TYPE_DONUTCHART      = self::TYPE_DOUGHTNUTCHART;    //    Synonym
-    const TYPE_SCATTERCHART    = 'scatterChart';
-    const TYPE_SURFACECHART    = 'surfaceChart';
-    const TYPE_SURFACECHART_3D = 'surface3DChart';
-    const TYPE_RADARCHART      = 'radarChart';
-    const TYPE_BUBBLECHART     = 'bubbleChart';
-    const TYPE_STOCKCHART      = 'stockChart';
-    const TYPE_CANDLECHART     = self::TYPE_STOCKCHART;       //    Synonym
-
-    const GROUPING_CLUSTERED       = 'clustered';
-    const GROUPING_STACKED         = 'stacked';
-    const GROUPING_PERCENT_STACKED = 'percentStacked';
-    const GROUPING_STANDARD        = 'standard';
-
-    const DIRECTION_BAR        = 'bar';
-    const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
-    const DIRECTION_COL        = 'col';
-    const DIRECTION_COLUMN     = self::DIRECTION_COL;
-    const DIRECTION_VERTICAL   = self::DIRECTION_COL;
-
-    const STYLE_LINEMARKER   = 'lineMarker';
-    const STYLE_SMOOTHMARKER = 'smoothMarker';
-    const STYLE_MARKER       = 'marker';
-    const STYLE_FILLED       = 'filled';
-
-
-    /**
-     * Series Plot Type
-     *
-     * @var string
-     */
-    private $plotType;
-
-    /**
-     * Plot Grouping Type
-     *
-     * @var boolean
-     */
-    private $plotGrouping;
-
-    /**
-     * Plot Direction
-     *
-     * @var boolean
-     */
-    private $plotDirection;
-
-    /**
-     * Plot Style
-     *
-     * @var string
-     */
-    private $plotStyle;
-
-    /**
-     * Order of plots in Series
-     *
-     * @var array of integer
-     */
-    private $plotOrder = array();
-
-    /**
-     * Plot Label
-     *
-     * @var array of PHPExcel_Chart_DataSeriesValues
-     */
-    private $plotLabel = array();
-
-    /**
-     * Plot Category
-     *
-     * @var array of PHPExcel_Chart_DataSeriesValues
-     */
-    private $plotCategory = array();
-
-    /**
-     * Smooth Line
-     *
-     * @var string
-     */
-    private $smoothLine;
-
-    /**
-     * Plot Values
-     *
-     * @var array of PHPExcel_Chart_DataSeriesValues
-     */
-    private $plotValues = array();
-
-    /**
-     * Create a new PHPExcel_Chart_DataSeries
-     */
-    public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
-    {
-        $this->plotType = $plotType;
-        $this->plotGrouping = $plotGrouping;
-        $this->plotOrder = $plotOrder;
-        $keys = array_keys($plotValues);
-        $this->plotValues = $plotValues;
-        if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
-            $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
-        }
-
-        $this->plotLabel = $plotLabel;
-        if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
-            $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
-        }
-        $this->plotCategory = $plotCategory;
-        $this->smoothLine = $smoothLine;
-        $this->plotStyle = $plotStyle;
-        
-        if (is_null($plotDirection)) {
-            $plotDirection = self::DIRECTION_COL;
-        }
-        $this->plotDirection = $plotDirection;
-    }
-
-    /**
-     * Get Plot Type
-     *
-     * @return string
-     */
-    public function getPlotType()
-    {
-        return $this->plotType;
-    }
-
-    /**
-     * Set Plot Type
-     *
-     * @param string $plotType
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function setPlotType($plotType = '')
-    {
-        $this->plotType = $plotType;
-        return $this;
-    }
-
-    /**
-     * Get Plot Grouping Type
-     *
-     * @return string
-     */
-    public function getPlotGrouping()
-    {
-        return $this->plotGrouping;
-    }
-
-    /**
-     * Set Plot Grouping Type
-     *
-     * @param string $groupingType
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function setPlotGrouping($groupingType = null)
-    {
-        $this->plotGrouping = $groupingType;
-        return $this;
-    }
-
-    /**
-     * Get Plot Direction
-     *
-     * @return string
-     */
-    public function getPlotDirection()
-    {
-        return $this->plotDirection;
-    }
-
-    /**
-     * Set Plot Direction
-     *
-     * @param string $plotDirection
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function setPlotDirection($plotDirection = null)
-    {
-        $this->plotDirection = $plotDirection;
-        return $this;
-    }
-
-    /**
-     * Get Plot Order
-     *
-     * @return string
-     */
-    public function getPlotOrder()
-    {
-        return $this->plotOrder;
-    }
-
-    /**
-     * Get Plot Labels
-     *
-     * @return array of PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotLabels()
-    {
-        return $this->plotLabel;
-    }
-
-    /**
-     * Get Plot Label by Index
-     *
-     * @return PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotLabelByIndex($index)
-    {
-        $keys = array_keys($this->plotLabel);
-        if (in_array($index, $keys)) {
-            return $this->plotLabel[$index];
-        } elseif (isset($keys[$index])) {
-            return $this->plotLabel[$keys[$index]];
-        }
-        return false;
-    }
-
-    /**
-     * Get Plot Categories
-     *
-     * @return array of PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotCategories()
-    {
-        return $this->plotCategory;
-    }
-
-    /**
-     * Get Plot Category by Index
-     *
-     * @return PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotCategoryByIndex($index)
-    {
-        $keys = array_keys($this->plotCategory);
-        if (in_array($index, $keys)) {
-            return $this->plotCategory[$index];
-        } elseif (isset($keys[$index])) {
-            return $this->plotCategory[$keys[$index]];
-        }
-        return false;
-    }
-
-    /**
-     * Get Plot Style
-     *
-     * @return string
-     */
-    public function getPlotStyle()
-    {
-        return $this->plotStyle;
-    }
-
-    /**
-     * Set Plot Style
-     *
-     * @param string $plotStyle
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function setPlotStyle($plotStyle = null)
-    {
-        $this->plotStyle = $plotStyle;
-        return $this;
-    }
-
-    /**
-     * Get Plot Values
-     *
-     * @return array of PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotValues()
-    {
-        return $this->plotValues;
-    }
-
-    /**
-     * Get Plot Values by Index
-     *
-     * @return PHPExcel_Chart_DataSeriesValues
-     */
-    public function getPlotValuesByIndex($index)
-    {
-        $keys = array_keys($this->plotValues);
-        if (in_array($index, $keys)) {
-            return $this->plotValues[$index];
-        } elseif (isset($keys[$index])) {
-            return $this->plotValues[$keys[$index]];
-        }
-        return false;
-    }
-
-    /**
-     * Get Number of Plot Series
-     *
-     * @return integer
-     */
-    public function getPlotSeriesCount()
-    {
-        return count($this->plotValues);
-    }
-
-    /**
-     * Get Smooth Line
-     *
-     * @return boolean
-     */
-    public function getSmoothLine()
-    {
-        return $this->smoothLine;
-    }
-
-    /**
-     * Set Smooth Line
-     *
-     * @param boolean $smoothLine
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function setSmoothLine($smoothLine = true)
-    {
-        $this->smoothLine = $smoothLine;
-        return $this;
-    }
-
-    public function refresh(PHPExcel_Worksheet $worksheet)
-    {
-        foreach ($this->plotValues as $plotValues) {
-            if ($plotValues !== null) {
-                $plotValues->refresh($worksheet, true);
-            }
-        }
-        foreach ($this->plotLabel as $plotValues) {
-            if ($plotValues !== null) {
-                $plotValues->refresh($worksheet, true);
-            }
-        }
-        foreach ($this->plotCategory as $plotValues) {
-            if ($plotValues !== null) {
-                $plotValues->refresh($worksheet, false);
-            }
-        }
-    }
-}

+ 0 - 333
libs/PHPExcel/PHPExcel/Chart/DataSeriesValues.php

xqd
@@ -1,333 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart_DataSeriesValues
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_DataSeriesValues
-{
-
-    const DATASERIES_TYPE_STRING    = 'String';
-    const DATASERIES_TYPE_NUMBER    = 'Number';
-
-    private static $dataTypeValues = array(
-        self::DATASERIES_TYPE_STRING,
-        self::DATASERIES_TYPE_NUMBER,
-    );
-
-    /**
-     * Series Data Type
-     *
-     * @var    string
-     */
-    private $dataType;
-
-    /**
-     * Series Data Source
-     *
-     * @var    string
-     */
-    private $dataSource;
-
-    /**
-     * Format Code
-     *
-     * @var    string
-     */
-    private $formatCode;
-
-    /**
-     * Series Point Marker
-     *
-     * @var    string
-     */
-    private $pointMarker;
-
-    /**
-     * Point Count (The number of datapoints in the dataseries)
-     *
-     * @var    integer
-     */
-    private $pointCount = 0;
-
-    /**
-     * Data Values
-     *
-     * @var    array of mixed
-     */
-    private $dataValues = array();
-
-    /**
-     * Create a new PHPExcel_Chart_DataSeriesValues object
-     */
-    public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
-    {
-        $this->setDataType($dataType);
-        $this->dataSource = $dataSource;
-        $this->formatCode = $formatCode;
-        $this->pointCount = $pointCount;
-        $this->dataValues = $dataValues;
-        $this->pointMarker = $marker;
-    }
-
-    /**
-     * Get Series Data Type
-     *
-     * @return    string
-     */
-    public function getDataType()
-    {
-        return $this->dataType;
-    }
-
-    /**
-     * Set Series Data Type
-     *
-     * @param    string    $dataType    Datatype of this data series
-     *                                Typical values are:
-     *                                    PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING
-     *                                        Normally used for axis point values
-     *                                    PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER
-     *                                        Normally used for chart data values
-     * @return    PHPExcel_Chart_DataSeriesValues
-     */
-    public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
-    {
-        if (!in_array($dataType, self::$dataTypeValues)) {
-            throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
-        }
-        $this->dataType = $dataType;
-
-        return $this;
-    }
-
-    /**
-     * Get Series Data Source (formula)
-     *
-     * @return    string
-     */
-    public function getDataSource()
-    {
-        return $this->dataSource;
-    }
-
-    /**
-     * Set Series Data Source (formula)
-     *
-     * @param    string    $dataSource
-     * @return    PHPExcel_Chart_DataSeriesValues
-     */
-    public function setDataSource($dataSource = null, $refreshDataValues = true)
-    {
-        $this->dataSource = $dataSource;
-
-        if ($refreshDataValues) {
-            //    TO DO
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get Point Marker
-     *
-     * @return string
-     */
-    public function getPointMarker()
-    {
-        return $this->pointMarker;
-    }
-
-    /**
-     * Set Point Marker
-     *
-     * @param    string    $marker
-     * @return    PHPExcel_Chart_DataSeriesValues
-     */
-    public function setPointMarker($marker = null)
-    {
-        $this->pointMarker = $marker;
-
-        return $this;
-    }
-
-    /**
-     * Get Series Format Code
-     *
-     * @return    string
-     */
-    public function getFormatCode()
-    {
-        return $this->formatCode;
-    }
-
-    /**
-     * Set Series Format Code
-     *
-     * @param    string    $formatCode
-     * @return    PHPExcel_Chart_DataSeriesValues
-     */
-    public function setFormatCode($formatCode = null)
-    {
-        $this->formatCode = $formatCode;
-
-        return $this;
-    }
-
-    /**
-     * Get Series Point Count
-     *
-     * @return    integer
-     */
-    public function getPointCount()
-    {
-        return $this->pointCount;
-    }
-
-    /**
-     * Identify if the Data Series is a multi-level or a simple series
-     *
-     * @return    boolean
-     */
-    public function isMultiLevelSeries()
-    {
-        if (count($this->dataValues) > 0) {
-            return is_array($this->dataValues[0]);
-        }
-        return null;
-    }
-
-    /**
-     * Return the level count of a multi-level Data Series
-     *
-     * @return    boolean
-     */
-    public function multiLevelCount()
-    {
-        $levelCount = 0;
-        foreach ($this->dataValues as $dataValueSet) {
-            $levelCount = max($levelCount, count($dataValueSet));
-        }
-        return $levelCount;
-    }
-
-    /**
-     * Get Series Data Values
-     *
-     * @return    array of mixed
-     */
-    public function getDataValues()
-    {
-        return $this->dataValues;
-    }
-
-    /**
-     * Get the first Series Data value
-     *
-     * @return    mixed
-     */
-    public function getDataValue()
-    {
-        $count = count($this->dataValues);
-        if ($count == 0) {
-            return null;
-        } elseif ($count == 1) {
-            return $this->dataValues[0];
-        }
-        return $this->dataValues;
-    }
-
-    /**
-     * Set Series Data Values
-     *
-     * @param    array    $dataValues
-     * @param    boolean    $refreshDataSource
-     *                    TRUE - refresh the value of dataSource based on the values of $dataValues
-     *                    FALSE - don't change the value of dataSource
-     * @return    PHPExcel_Chart_DataSeriesValues
-     */
-    public function setDataValues($dataValues = array(), $refreshDataSource = true)
-    {
-        $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
-        $this->pointCount = count($dataValues);
-
-        if ($refreshDataSource) {
-            //    TO DO
-        }
-
-        return $this;
-    }
-
-    private function stripNulls($var)
-    {
-        return $var !== null;
-    }
-
-    public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
-    {
-        if ($this->dataSource !== null) {
-            $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
-            $newDataValues = PHPExcel_Calculation::unwrapResult(
-                $calcEngine->_calculateFormulaValue(
-                    '='.$this->dataSource,
-                    null,
-                    $worksheet->getCell('A1')
-                )
-            );
-            if ($flatten) {
-                $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
-                foreach ($this->dataValues as &$dataValue) {
-                    if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
-                        $dataValue = 0.0;
-                    }
-                }
-                unset($dataValue);
-            } else {
-                $cellRange = explode('!', $this->dataSource);
-                if (count($cellRange) > 1) {
-                    list(, $cellRange) = $cellRange;
-                }
-
-                $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
-                if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
-                    $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
-                } else {
-                    $newArray = array_values(array_shift($newDataValues));
-                    foreach ($newArray as $i => $newDataSet) {
-                        $newArray[$i] = array($newDataSet);
-                    }
-
-                    foreach ($newDataValues as $newDataSet) {
-                        $i = 0;
-                        foreach ($newDataSet as $newDataVal) {
-                            array_unshift($newArray[$i++], $newDataVal);
-                        }
-                    }
-                    $this->dataValues = $newArray;
-                }
-            }
-            $this->pointCount = count($this->dataValues);
-        }
-    }
-}

+ 0 - 46
libs/PHPExcel/PHPExcel/Chart/Exception.php

xqd
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart_Exception
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Chart
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_Exception extends PHPExcel_Exception
-{
-    /**
-     * Error handler callback
-     *
-     * @param mixed $code
-     * @param mixed $string
-     * @param mixed $file
-     * @param mixed $line
-     * @param mixed $context
-     */
-    public static function errorHandlerCallback($code, $string, $file, $line, $context)
-    {
-        $e = new self($string, $code);
-        $e->line = $line;
-        $e->file = $file;
-        throw $e;
-    }
-}

+ 0 - 472
libs/PHPExcel/PHPExcel/Chart/GridLines.php

xqd
@@ -1,472 +0,0 @@
-<?php
-
-/**
- * Created by PhpStorm.
- * User: Wiktor Trzonkowski
- * Date: 7/2/14
- * Time: 2:36 PM
- */
-
-class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
-{
-
-  /**
-   * Properties of Class:
-   * Object State (State for Minor Tick Mark) @var bool
-   * Line Properties @var  array of mixed
-   * Shadow Properties @var  array of mixed
-   * Glow Properties @var  array of mixed
-   * Soft Properties @var  array of mixed
-   *
-   */
-
-    private $objectState = false;
-
-    private $lineProperties = array(
-        'color' => array(
-            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
-            'value' => null,
-            'alpha' => 0
-        ),
-        'style' => array(
-            'width' => '9525',
-            'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
-            'dash' => self::LINE_STYLE_DASH_SOLID,
-            'cap' => self::LINE_STYLE_CAP_FLAT,
-            'join' => self::LINE_STYLE_JOIN_BEVEL,
-            'arrow' => array(
-                'head' => array(
-                    'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
-                    'size' => self::LINE_STYLE_ARROW_SIZE_5
-                ),
-                'end' => array(
-                    'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
-                    'size' => self::LINE_STYLE_ARROW_SIZE_8
-                ),
-            )
-        )
-    );
-
-    private $shadowProperties = array(
-        'presets' => self::SHADOW_PRESETS_NOSHADOW,
-        'effect' => null,
-        'color' => array(
-            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
-            'value' => 'black',
-            'alpha' => 85,
-        ),
-        'size' => array(
-            'sx' => null,
-            'sy' => null,
-            'kx' => null
-        ),
-        'blur' => null,
-        'direction' => null,
-        'distance' => null,
-        'algn' => null,
-        'rotWithShape' => null
-    );
-
-    private $glowProperties = array(
-        'size' => null,
-        'color' => array(
-            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
-            'value' => 'black',
-            'alpha' => 40
-        )
-    );
-
-    private $softEdges = array(
-        'size' => null
-     );
-
-    /**
-     * Get Object State
-     *
-     * @return bool
-     */
-
-    public function getObjectState()
-    {
-        return $this->objectState;
-    }
-
-    /**
-     * Change Object State to True
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function activateObject()
-    {
-        $this->objectState = true;
-
-        return $this;
-    }
-
-    /**
-     * Set Line Color Properties
-     *
-     * @param string $value
-     * @param int $alpha
-     * @param string $type
-     */
-
-    public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
-    {
-        $this->activateObject()
-            ->lineProperties['color'] = $this->setColorProperties(
-                $value,
-                $alpha,
-                $type
-            );
-    }
-
-    /**
-     * Set Line Color Properties
-     *
-     * @param float $line_width
-     * @param string $compound_type
-     * @param string $dash_type
-     * @param string $cap_type
-     * @param string $join_type
-     * @param string $head_arrow_type
-     * @param string $head_arrow_size
-     * @param string $end_arrow_type
-     * @param string $end_arrow_size
-     */
-
-    public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
-    {
-        $this->activateObject();
-        (!is_null($line_width))
-                ? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
-                : null;
-        (!is_null($compound_type))
-                ? $this->lineProperties['style']['compound'] = (string) $compound_type
-                : null;
-        (!is_null($dash_type))
-                ? $this->lineProperties['style']['dash'] = (string) $dash_type
-                : null;
-        (!is_null($cap_type))
-                ? $this->lineProperties['style']['cap'] = (string) $cap_type
-                : null;
-        (!is_null($join_type))
-                ? $this->lineProperties['style']['join'] = (string) $join_type
-                : null;
-        (!is_null($head_arrow_type))
-                ? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
-                : null;
-        (!is_null($head_arrow_size))
-                ? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
-                : null;
-        (!is_null($end_arrow_type))
-                ? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
-                : null;
-        (!is_null($end_arrow_size))
-                ? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
-                : null;
-    }
-
-    /**
-     * Get Line Color Property
-     *
-     * @param string $parameter
-     *
-     * @return string
-     */
-
-    public function getLineColorProperty($parameter)
-    {
-        return $this->lineProperties['color'][$parameter];
-    }
-
-    /**
-     * Get Line Style Property
-     *
-     * @param    array|string $elements
-     *
-     * @return string
-     */
-
-    public function getLineStyleProperty($elements)
-    {
-        return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
-    }
-
-    /**
-     * Set Glow Properties
-     *
-     * @param    float $size
-     * @param    string $color_value
-     * @param    int $color_alpha
-     * @param    string $color_type
-     *
-     */
-
-    public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
-    {
-        $this
-                ->activateObject()
-                ->setGlowSize($size)
-                ->setGlowColor($color_value, $color_alpha, $color_type);
-    }
-
-    /**
-     * Get Glow Color Property
-     *
-     * @param string $property
-     *
-     * @return string
-     */
-
-    public function getGlowColor($property)
-    {
-        return $this->glowProperties['color'][$property];
-    }
-
-    /**
-     * Get Glow Size
-     *
-     * @return string
-     */
-
-    public function getGlowSize()
-    {
-        return $this->glowProperties['size'];
-    }
-
-    /**
-     * Set Glow Size
-     *
-     * @param float $size
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function setGlowSize($size)
-    {
-        $this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
-
-        return $this;
-    }
-
-    /**
-     * Set Glow Color
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function setGlowColor($color, $alpha, $type)
-    {
-        if (!is_null($color)) {
-            $this->glowProperties['color']['value'] = (string) $color;
-        }
-        if (!is_null($alpha)) {
-            $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
-        }
-        if (!is_null($type)) {
-            $this->glowProperties['color']['type'] = (string) $type;
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get Line Style Arrow Parameters
-     *
-     * @param string $arrow_selector
-     * @param string $property_selector
-     *
-     * @return string
-     */
-
-    public function getLineStyleArrowParameters($arrow_selector, $property_selector)
-    {
-        return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
-    }
-
-    /**
-     * Set Shadow Properties
-     *
-     * @param int $sh_presets
-     * @param string $sh_color_value
-     * @param string $sh_color_type
-     * @param int $sh_color_alpha
-     * @param string $sh_blur
-     * @param int $sh_angle
-     * @param float $sh_distance
-     *
-     */
-
-    public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
-    {
-        $this->activateObject()
-            ->setShadowPresetsProperties((int) $sh_presets)
-            ->setShadowColor(
-                is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
-                is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
-                is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
-            )
-            ->setShadowBlur($sh_blur)
-            ->setShadowAngle($sh_angle)
-            ->setShadowDistance($sh_distance);
-    }
-
-    /**
-     * Set Shadow Presets Properties
-     *
-     * @param int $shadow_presets
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function setShadowPresetsProperties($shadow_presets)
-    {
-        $this->shadowProperties['presets'] = $shadow_presets;
-        $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Properties Values
-     *
-     * @param array $properties_map
-     * @param * $reference
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
-    {
-        $base_reference = $reference;
-        foreach ($properties_map as $property_key => $property_val) {
-            if (is_array($property_val)) {
-                if ($reference === null) {
-                    $reference = & $this->shadowProperties[$property_key];
-                } else {
-                    $reference = & $reference[$property_key];
-                }
-                $this->setShadowProperiesMapValues($property_val, $reference);
-            } else {
-                if ($base_reference === null) {
-                    $this->shadowProperties[$property_key] = $property_val;
-                } else {
-                    $reference[$property_key] = $property_val;
-                }
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Color
-     *
-     * @param string $color
-     * @param int $alpha
-     * @param string $type
-     * @return PHPExcel_Chart_GridLines
-     */
-    private function setShadowColor($color, $alpha, $type)
-    {
-        if (!is_null($color)) {
-            $this->shadowProperties['color']['value'] = (string) $color;
-        }
-        if (!is_null($alpha)) {
-            $this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
-        }
-        if (!is_null($type)) {
-            $this->shadowProperties['color']['type'] = (string) $type;
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Blur
-     *
-     * @param float $blur
-     *
-     * @return PHPExcel_Chart_GridLines
-     */
-    private function setShadowBlur($blur)
-    {
-        if ($blur !== null) {
-            $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Angle
-     *
-     * @param int $angle
-     * @return PHPExcel_Chart_GridLines
-     */
-
-    private function setShadowAngle($angle)
-    {
-        if ($angle !== null) {
-            $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Set Shadow Distance
-     *
-     * @param float $distance
-     * @return PHPExcel_Chart_GridLines
-     */
-    private function setShadowDistance($distance)
-    {
-        if ($distance !== null) {
-            $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get Shadow Property
-     *
-     * @param string $elements
-     * @param array $elements
-     * @return string
-     */
-    public function getShadowProperty($elements)
-    {
-        return $this->getArrayElementsValue($this->shadowProperties, $elements);
-    }
-
-    /**
-     * Set Soft Edges Size
-     *
-     * @param float $size
-     */
-    public function setSoftEdgesSize($size)
-    {
-        if (!is_null($size)) {
-            $this->activateObject();
-            $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
-        }
-    }
-
-    /**
-     * Get Soft Edges Size
-     *
-     * @return string
-     */
-    public function getSoftEdgesSize()
-    {
-        return $this->softEdges['size'];
-    }
-}

+ 0 - 486
libs/PHPExcel/PHPExcel/Chart/Layout.php

xqd
@@ -1,486 +0,0 @@
-<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-
-
-/**
- * PHPExcel_Chart_Layout
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Chart_Layout
-{
-    /**
-     * layoutTarget
-     *
-     * @var string
-     */
-    private $layoutTarget;
-
-    /**
-     * X Mode
-     *
-     * @var string
-     */
-    private $xMode;
-
-    /**
-     * Y Mode
-     *
-     * @var string
-     */
-    private $yMode;
-
-    /**
-     * X-Position
-     *
-     * @var float
-     */
-    private $xPos;
-
-    /**
-     * Y-Position
-     *
-     * @var float
-     */
-    private $yPos;
-
-    /**
-     * width
-     *
-     * @var float
-     */
-    private $width;
-
-    /**
-     * height
-     *
-     * @var float
-     */
-    private $height;
-
-    /**
-     * show legend key
-     * Specifies that legend keys should be shown in data labels
-     *
-     * @var boolean
-     */
-    private $showLegendKey;
-
-    /**
-     * show value
-     * Specifies that the value should be shown in a data label.
-     *
-     * @var boolean
-     */
-    private $showVal;
-
-    /**
-     * show category name
-     * Specifies that the category name should be shown in the data label.
-     *
-     * @var boolean
-     */
-    private $showCatName;
-
-    /**
-     * show data series name
-     * Specifies that the series name should be shown in the data label.
-     *
-     * @var boolean
-     */
-    private $showSerName;
-
-    /**
-     * show percentage
-     * Specifies that the percentage should be shown in the data label.
-     *
-     * @var boolean
-     */
-    private $showPercent;
-
-    /**
-     * show bubble size
-     *
-     * @var boolean
-     */
-    private $showBubbleSize;
-
-    /**
-     * show leader lines
-     * Specifies that leader lines should be shown for the data label.
-     *
-     * @var boolean
-     */
-    private $showLeaderLines;
-
-
-    /**
-     * Create a new PHPExcel_Chart_Layout
-     */
-    public function __construct($layout = array())
-    {
-        if (isset($layout['layoutTarget'])) {
-            $this->layoutTarget = $layout['layoutTarget'];
-        }
-        if (isset($layout['xMode'])) {
-            $this->xMode = $layout['xMode'];
-        }
-        if (isset($layout['yMode'])) {
-            $this->yMode = $layout['yMode'];
-        }
-        if (isset($layout['x'])) {
-            $this->xPos = (float) $layout['x'];
-        }
-        if (isset($layout['y'])) {
-            $this->yPos = (float) $layout['y'];
-        }
-        if (isset($layout['w'])) {
-            $this->width = (float) $layout['w'];
-        }
-        if (isset($layout['h'])) {
-            $this->height = (float) $layout['h'];
-        }
-    }
-
-    /**
-     * Get Layout Target
-     *
-     * @return string
-     */
-    public function getLayoutTarget()
-    {
-        return $this->layoutTarget;
-    }
-
-    /**
-     * Set Layout Target
-     *
-     * @param Layout Target $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setLayoutTarget($value)
-    {
-        $this->layoutTarget = $value;
-        return $this;
-    }
-
-    /**
-     * Get X-Mode
-     *
-     * @return string
-     */
-    public function getXMode()
-    {
-        return $this->xMode;
-    }
-
-    /**
-     * Set X-Mode
-     *
-     * @param X-Mode $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setXMode($value)
-    {
-        $this->xMode = $value;
-        return $this;
-    }
-
-    /**
-     * Get Y-Mode
-     *
-     * @return string
-     */
-    public function getYMode()
-    {
-        return $this->yMode;
-    }
-
-    /**
-     * Set Y-Mode
-     *
-     * @param Y-Mode $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setYMode($value)
-    {
-        $this->yMode = $value;
-        return $this;
-    }
-
-    /**
-     * Get X-Position
-     *
-     * @return number
-     */
-    public function getXPosition()
-    {
-        return $this->xPos;
-    }
-
-    /**
-     * Set X-Position
-     *
-     * @param X-Position $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setXPosition($value)
-    {
-        $this->xPos = $value;
-        return $this;
-    }
-
-    /**
-     * Get Y-Position
-     *
-     * @return number
-     */
-    public function getYPosition()
-    {
-        return $this->yPos;
-    }
-
-    /**
-     * Set Y-Position
-     *
-     * @param Y-Position $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setYPosition($value)
-    {
-        $this->yPos = $value;
-        return $this;
-    }
-
-    /**
-     * Get Width
-     *
-     * @return number
-     */
-    public function getWidth()
-    {
-        return $this->width;
-    }
-
-    /**
-     * Set Width
-     *
-     * @param Width $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setWidth($value)
-    {
-        $this->width = $value;
-        return $this;
-    }
-
-    /**
-     * Get Height
-     *
-     * @return number
-     */
-    public function getHeight()
-    {
-        return $this->height;
-    }
-
-    /**
-     * Set Height
-     *
-     * @param Height $value
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setHeight($value)
-    {
-        $this->height = $value;
-        return $this;
-    }
-
-
-    /**
-     * Get show legend key
-     *
-     * @return boolean
-     */
-    public function getShowLegendKey()
-    {
-        return $this->showLegendKey;
-    }
-
-    /**
-     * Set show legend key
-     * Specifies that legend keys should be shown in data labels.
-     *
-     * @param boolean $value        Show legend key
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowLegendKey($value)
-    {
-        $this->showLegendKey = $value;
-        return $this;
-    }
-
-    /**
-     * Get show value
-     *
-     * @return boolean
-     */
-    public function getShowVal()
-    {
-        return $this->showVal;
-    }
-
-    /**
-     * Set show val
-     * Specifies that the value should be shown in data labels.
-     *
-     * @param boolean $value        Show val
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowVal($value)
-    {
-        $this->showVal = $value;
-        return $this;
-    }
-
-    /**
-     * Get show category name
-     *
-     * @return boolean
-     */
-    public function getShowCatName()
-    {
-        return $this->showCatName;
-    }
-
-    /**
-     * Set show cat name
-     * Specifies that the category name should be shown in data labels.
-     *
-     * @param boolean $value        Show cat name
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowCatName($value)
-    {
-        $this->showCatName = $value;
-        return $this;
-    }
-
-    /**
-     * Get show data series name
-     *
-     * @return boolean
-     */
-    public function getShowSerName()
-    {
-        return $this->showSerName;
-    }
-
-    /**
-     * Set show ser name
-     * Specifies that the series name should be shown in data labels.
-     *
-     * @param boolean $value        Show series name
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowSerName($value)
-    {
-        $this->showSerName = $value;
-        return $this;
-    }
-
-    /**
-     * Get show percentage
-     *
-     * @return boolean
-     */
-    public function getShowPercent()
-    {
-        return $this->showPercent;
-    }
-
-    /**
-     * Set show percentage
-     * Specifies that the percentage should be shown in data labels.
-     *
-     * @param boolean $value        Show percentage
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowPercent($value)
-    {
-        $this->showPercent = $value;
-        return $this;
-    }
-
-    /**
-     * Get show bubble size
-     *
-     * @return boolean
-     */
-    public function getShowBubbleSize()
-    {
-        return $this->showBubbleSize;
-    }
-
-    /**
-     * Set show bubble size
-     * Specifies that the bubble size should be shown in data labels.
-     *
-     * @param boolean $value        Show bubble size
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowBubbleSize($value)
-    {
-        $this->showBubbleSize = $value;
-        return $this;
-    }
-
-    /**
-     * Get show leader lines
-     *
-     * @return boolean
-     */
-    public function getShowLeaderLines()
-    {
-        return $this->showLeaderLines;
-    }
-
-    /**
-     * Set show leader lines
-     * Specifies that leader lines should be shown in data labels.
-     *
-     * @param boolean $value        Show leader lines
-     * @return PHPExcel_Chart_Layout
-     */
-    public function setShowLeaderLines($value)
-    {
-        $this->showLeaderLines = $value;
-        return $this;
-    }
-}

+ 0 - 170
libs/PHPExcel/PHPExcel/Chart/Legend.php

xqd
@@ -1,170 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart_Legend
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_Legend
-{
-    /** Legend positions */
-    const xlLegendPositionBottom = -4107;    //    Below the chart.
-    const xlLegendPositionCorner = 2;        //    In the upper right-hand corner of the chart border.
-    const xlLegendPositionCustom = -4161;    //    A custom position.
-    const xlLegendPositionLeft   = -4131;    //    Left of the chart.
-    const xlLegendPositionRight  = -4152;    //    Right of the chart.
-    const xlLegendPositionTop    = -4160;    //    Above the chart.
-
-    const POSITION_RIGHT    = 'r';
-    const POSITION_LEFT     = 'l';
-    const POSITION_BOTTOM   = 'b';
-    const POSITION_TOP      = 't';
-    const POSITION_TOPRIGHT = 'tr';
-
-    private static $positionXLref = array(
-        self::xlLegendPositionBottom => self::POSITION_BOTTOM,
-        self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
-        self::xlLegendPositionCustom => '??',
-        self::xlLegendPositionLeft   => self::POSITION_LEFT,
-        self::xlLegendPositionRight  => self::POSITION_RIGHT,
-        self::xlLegendPositionTop    => self::POSITION_TOP
-    );
-
-    /**
-     * Legend position
-     *
-     * @var    string
-     */
-    private $position = self::POSITION_RIGHT;
-
-    /**
-     * Allow overlay of other elements?
-     *
-     * @var    boolean
-     */
-    private $overlay = true;
-
-    /**
-     * Legend Layout
-     *
-     * @var    PHPExcel_Chart_Layout
-     */
-    private $layout = null;
-
-
-    /**
-     *    Create a new PHPExcel_Chart_Legend
-     */
-    public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false)
-    {
-        $this->setPosition($position);
-        $this->layout = $layout;
-        $this->setOverlay($overlay);
-    }
-
-    /**
-     * Get legend position as an excel string value
-     *
-     * @return    string
-     */
-    public function getPosition()
-    {
-        return $this->position;
-    }
-
-    /**
-     * Get legend position using an excel string value
-     *
-     * @param    string    $position
-     */
-    public function setPosition($position = self::POSITION_RIGHT)
-    {
-        if (!in_array($position, self::$positionXLref)) {
-            return false;
-        }
-
-        $this->position = $position;
-        return true;
-    }
-
-    /**
-     * Get legend position as an Excel internal numeric value
-     *
-     * @return    number
-     */
-    public function getPositionXL()
-    {
-        return array_search($this->position, self::$positionXLref);
-    }
-
-    /**
-     * Set legend position using an Excel internal numeric value
-     *
-     * @param    number    $positionXL
-     */
-    public function setPositionXL($positionXL = self::xlLegendPositionRight)
-    {
-        if (!array_key_exists($positionXL, self::$positionXLref)) {
-            return false;
-        }
-
-        $this->position = self::$positionXLref[$positionXL];
-        return true;
-    }
-
-    /**
-     * Get allow overlay of other elements?
-     *
-     * @return    boolean
-     */
-    public function getOverlay()
-    {
-        return $this->overlay;
-    }
-
-    /**
-     * Set allow overlay of other elements?
-     *
-     * @param    boolean    $overlay
-     * @return    boolean
-     */
-    public function setOverlay($overlay = false)
-    {
-        if (!is_bool($overlay)) {
-            return false;
-        }
-
-        $this->overlay = $overlay;
-        return true;
-    }
-
-    /**
-     * Get Layout
-     *
-     * @return PHPExcel_Chart_Layout
-     */
-    public function getLayout()
-    {
-        return $this->layout;
-    }
-}

+ 0 - 126
libs/PHPExcel/PHPExcel/Chart/PlotArea.php

xqd
@@ -1,126 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart_PlotArea
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_PlotArea
-{
-    /**
-     * PlotArea Layout
-     *
-     * @var PHPExcel_Chart_Layout
-     */
-    private $layout = null;
-
-    /**
-     * Plot Series
-     *
-     * @var array of PHPExcel_Chart_DataSeries
-     */
-    private $plotSeries = array();
-
-    /**
-     * Create a new PHPExcel_Chart_PlotArea
-     */
-    public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
-    {
-        $this->layout = $layout;
-        $this->plotSeries = $plotSeries;
-    }
-
-    /**
-     * Get Layout
-     *
-     * @return PHPExcel_Chart_Layout
-     */
-    public function getLayout()
-    {
-        return $this->layout;
-    }
-
-    /**
-     * Get Number of Plot Groups
-     *
-     * @return array of PHPExcel_Chart_DataSeries
-     */
-    public function getPlotGroupCount()
-    {
-        return count($this->plotSeries);
-    }
-
-    /**
-     * Get Number of Plot Series
-     *
-     * @return integer
-     */
-    public function getPlotSeriesCount()
-    {
-        $seriesCount = 0;
-        foreach ($this->plotSeries as $plot) {
-            $seriesCount += $plot->getPlotSeriesCount();
-        }
-        return $seriesCount;
-    }
-
-    /**
-     * Get Plot Series
-     *
-     * @return array of PHPExcel_Chart_DataSeries
-     */
-    public function getPlotGroup()
-    {
-        return $this->plotSeries;
-    }
-
-    /**
-     * Get Plot Series by Index
-     *
-     * @return PHPExcel_Chart_DataSeries
-     */
-    public function getPlotGroupByIndex($index)
-    {
-        return $this->plotSeries[$index];
-    }
-
-    /**
-     * Set Plot Series
-     *
-     * @param [PHPExcel_Chart_DataSeries]
-     * @return PHPExcel_Chart_PlotArea
-     */
-    public function setPlotSeries($plotSeries = array())
-    {
-        $this->plotSeries = $plotSeries;
-        
-        return $this;
-    }
-
-    public function refresh(PHPExcel_Worksheet $worksheet)
-    {
-        foreach ($this->plotSeries as $plotSeries) {
-            $plotSeries->refresh($worksheet);
-        }
-    }
-}

+ 0 - 363
libs/PHPExcel/PHPExcel/Chart/Properties.php

xqd
@@ -1,363 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: nhw2h8s
- * Date: 7/2/14
- * Time: 5:45 PM
- */
-
-abstract class PHPExcel_Chart_Properties
-{
-    const
-        EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
-        EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
-        EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
-
-    const
-        AXIS_LABELS_LOW = 'low',
-        AXIS_LABELS_HIGH = 'high',
-        AXIS_LABELS_NEXT_TO = 'nextTo',
-        AXIS_LABELS_NONE = 'none';
-
-    const
-        TICK_MARK_NONE = 'none',
-        TICK_MARK_INSIDE = 'in',
-        TICK_MARK_OUTSIDE = 'out',
-        TICK_MARK_CROSS = 'cross';
-
-    const
-        HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
-        HORIZONTAL_CROSSES_MAXIMUM = 'max';
-
-    const
-        FORMAT_CODE_GENERAL = 'General',
-        FORMAT_CODE_NUMBER = '#,##0.00',
-        FORMAT_CODE_CURRENCY = '$#,##0.00',
-        FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
-        FORMAT_CODE_DATE = 'm/d/yyyy',
-        FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
-        FORMAT_CODE_PERCENTAGE = '0.00%',
-        FORMAT_CODE_FRACTION = '# ?/?',
-        FORMAT_CODE_SCIENTIFIC = '0.00E+00',
-        FORMAT_CODE_TEXT = '@',
-        FORMAT_CODE_SPECIAL = '00000';
-
-    const
-        ORIENTATION_NORMAL = 'minMax',
-        ORIENTATION_REVERSED = 'maxMin';
-
-    const
-        LINE_STYLE_COMPOUND_SIMPLE = 'sng',
-        LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
-        LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
-        LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
-        LINE_STYLE_COMPOUND_TRIPLE = 'tri',
-
-        LINE_STYLE_DASH_SOLID = 'solid',
-        LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
-        LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
-        LINE_STYPE_DASH_DASH = 'dash',
-        LINE_STYLE_DASH_DASH_DOT = 'dashDot',
-        LINE_STYLE_DASH_LONG_DASH = 'lgDash',
-        LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
-        LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
-
-        LINE_STYLE_CAP_SQUARE = 'sq',
-        LINE_STYLE_CAP_ROUND = 'rnd',
-        LINE_STYLE_CAP_FLAT = 'flat',
-
-        LINE_STYLE_JOIN_ROUND = 'bevel',
-        LINE_STYLE_JOIN_MITER = 'miter',
-        LINE_STYLE_JOIN_BEVEL = 'bevel',
-
-        LINE_STYLE_ARROW_TYPE_NOARROW = null,
-        LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
-        LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
-        LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
-        LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
-        LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
-
-        LINE_STYLE_ARROW_SIZE_1 = 1,
-        LINE_STYLE_ARROW_SIZE_2 = 2,
-        LINE_STYLE_ARROW_SIZE_3 = 3,
-        LINE_STYLE_ARROW_SIZE_4 = 4,
-        LINE_STYLE_ARROW_SIZE_5 = 5,
-        LINE_STYLE_ARROW_SIZE_6 = 6,
-        LINE_STYLE_ARROW_SIZE_7 = 7,
-        LINE_STYLE_ARROW_SIZE_8 = 8,
-        LINE_STYLE_ARROW_SIZE_9 = 9;
-
-    const
-        SHADOW_PRESETS_NOSHADOW = null,
-        SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
-        SHADOW_PRESETS_OUTER_BOTTOM = 2,
-        SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
-        SHADOW_PRESETS_OUTER_RIGHT = 4,
-        SHADOW_PRESETS_OUTER_CENTER = 5,
-        SHADOW_PRESETS_OUTER_LEFT = 6,
-        SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
-        SHADOW_PRESETS_OUTER_TOP = 8,
-        SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
-        SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
-        SHADOW_PRESETS_INNER_BOTTOM = 11,
-        SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
-        SHADOW_PRESETS_INNER_RIGHT = 13,
-        SHADOW_PRESETS_INNER_CENTER = 14,
-        SHADOW_PRESETS_INNER_LEFT = 15,
-        SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
-        SHADOW_PRESETS_INNER_TOP = 17,
-        SHADOW_PRESETS_INNER_TOP_LEFT = 18,
-        SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
-        SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
-        SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
-        SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
-        SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
-
-    protected function getExcelPointsWidth($width)
-    {
-        return $width * 12700;
-    }
-
-    protected function getExcelPointsAngle($angle)
-    {
-        return $angle * 60000;
-    }
-
-    protected function getTrueAlpha($alpha)
-    {
-        return (string) 100 - $alpha . '000';
-    }
-
-    protected function setColorProperties($color, $alpha, $type)
-    {
-        return array(
-            'type' => (string) $type,
-            'value' => (string) $color,
-            'alpha' => (string) $this->getTrueAlpha($alpha)
-        );
-    }
-
-    protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
-    {
-        $sizes = array(
-            1 => array('w' => 'sm', 'len' => 'sm'),
-            2 => array('w' => 'sm', 'len' => 'med'),
-            3 => array('w' => 'sm', 'len' => 'lg'),
-            4 => array('w' => 'med', 'len' => 'sm'),
-            5 => array('w' => 'med', 'len' => 'med'),
-            6 => array('w' => 'med', 'len' => 'lg'),
-            7 => array('w' => 'lg', 'len' => 'sm'),
-            8 => array('w' => 'lg', 'len' => 'med'),
-            9 => array('w' => 'lg', 'len' => 'lg')
-        );
-
-        return $sizes[$array_selector][$array_kay_selector];
-    }
-
-    protected function getShadowPresetsMap($shadow_presets_option)
-    {
-        $presets_options = array(
-            //OUTER
-            1 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '2700000',
-                'algn' => 'tl',
-                'rotWithShape' => '0'
-            ),
-            2 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '5400000',
-                'algn' => 't',
-                'rotWithShape' => '0'
-            ),
-            3 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '8100000',
-                'algn' => 'tr',
-                'rotWithShape' => '0'
-            ),
-            4 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'algn' => 'l',
-                'rotWithShape' => '0'
-            ),
-            5 => array(
-                'effect' => 'outerShdw',
-                'size' => array(
-                    'sx' => '102000',
-                    'sy' => '102000'
-                )
-                ,
-                'blur' => '63500',
-                'distance' => '38100',
-                'algn' => 'ctr',
-                'rotWithShape' => '0'
-            ),
-            6 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '10800000',
-                'algn' => 'r',
-                'rotWithShape' => '0'
-            ),
-            7 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '18900000',
-                'algn' => 'bl',
-                'rotWithShape' => '0'
-            ),
-            8 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '16200000',
-                'rotWithShape' => '0'
-            ),
-            9 => array(
-                'effect' => 'outerShdw',
-                'blur' => '50800',
-                'distance' => '38100',
-                'direction' => '13500000',
-                'algn' => 'br',
-                'rotWithShape' => '0'
-            ),
-            //INNER
-            10 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '2700000',
-            ),
-            11 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '5400000',
-            ),
-            12 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '8100000',
-            ),
-            13 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-            ),
-            14 => array(
-                'effect' => 'innerShdw',
-                'blur' => '114300',
-            ),
-            15 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '10800000',
-            ),
-            16 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '18900000',
-            ),
-            17 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '16200000',
-            ),
-            18 => array(
-                'effect' => 'innerShdw',
-                'blur' => '63500',
-                'distance' => '50800',
-                'direction' => '13500000',
-            ),
-            //perspective
-            19 => array(
-                'effect' => 'outerShdw',
-                'blur' => '152400',
-                'distance' => '317500',
-                'size' => array(
-                    'sx' => '90000',
-                    'sy' => '-19000',
-                ),
-                'direction' => '5400000',
-                'rotWithShape' => '0',
-            ),
-            20 => array(
-                'effect' => 'outerShdw',
-                'blur' => '76200',
-                'direction' => '18900000',
-                'size' => array(
-                    'sy' => '23000',
-                    'kx' => '-1200000',
-                ),
-                'algn' => 'bl',
-                'rotWithShape' => '0',
-            ),
-            21 => array(
-                'effect' => 'outerShdw',
-                'blur' => '76200',
-                'direction' => '13500000',
-                'size' => array(
-                    'sy' => '23000',
-                    'kx' => '1200000',
-                ),
-                'algn' => 'br',
-                'rotWithShape' => '0',
-            ),
-            22 => array(
-                'effect' => 'outerShdw',
-                'blur' => '76200',
-                'distance' => '12700',
-                'direction' => '2700000',
-                'size' => array(
-                    'sy' => '-23000',
-                    'kx' => '-800400',
-                ),
-                'algn' => 'bl',
-                'rotWithShape' => '0',
-            ),
-            23 => array(
-                'effect' => 'outerShdw',
-                'blur' => '76200',
-                'distance' => '12700',
-                'direction' => '8100000',
-                'size' => array(
-                    'sy' => '-23000',
-                    'kx' => '800400',
-                ),
-                'algn' => 'br',
-                'rotWithShape' => '0',
-            ),
-        );
-
-        return $presets_options[$shadow_presets_option];
-    }
-
-    protected function getArrayElementsValue($properties, $elements)
-    {
-        $reference = & $properties;
-        if (!is_array($elements)) {
-            return $reference[$elements];
-        } else {
-            foreach ($elements as $keys) {
-                $reference = & $reference[$keys];
-            }
-            return $reference;
-        }
-        return $this;
-    }
-}

+ 0 - 20
libs/PHPExcel/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt

xqd
@@ -1,20 +0,0 @@
-ChartDirector
-	http://www.advsofteng.com/cdphp.html
-
-GraPHPite
-	http://graphpite.sourceforge.net/
-
-JpGraph
-	http://www.aditus.nu/jpgraph/
-
-LibChart
-	http://naku.dohcrew.com/libchart/pages/introduction/
-
-pChart
-	http://pchart.sourceforge.net/
-
-TeeChart
-	http://www.steema.com/products/teechart/overview.html
-
-PHPGraphLib
-    http://www.ebrueggeman.com/phpgraphlib

+ 0 - 883
libs/PHPExcel/PHPExcel/Chart/Renderer/jpgraph.php

xqd
@@ -1,883 +0,0 @@
-<?php
-
-require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
-
-/**
- * PHPExcel_Chart_Renderer_jpgraph
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart_Renderer
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_Renderer_jpgraph
-{
-    private static $width    = 640;
-
-    private static $height    = 480;
-
-    private static $colourSet = array(
-        'mediumpurple1',    'palegreen3',     'gold1',          'cadetblue1',
-        'darkmagenta',      'coral',          'dodgerblue3',    'eggplant',
-        'mediumblue',       'magenta',        'sandybrown',     'cyan',
-        'firebrick1',       'forestgreen',    'deeppink4',      'darkolivegreen',
-        'goldenrod2'
-    );
-
-    private static $markSet = array(
-        'diamond'  => MARK_DIAMOND,
-        'square'   => MARK_SQUARE,
-        'triangle' => MARK_UTRIANGLE,
-        'x'        => MARK_X,
-        'star'     => MARK_STAR,
-        'dot'      => MARK_FILLEDCIRCLE,
-        'dash'     => MARK_DTRIANGLE,
-        'circle'   => MARK_CIRCLE,
-        'plus'     => MARK_CROSS
-    );
-
-
-    private $chart;
-
-    private $graph;
-
-    private static $plotColour = 0;
-
-    private static $plotMark = 0;
-
-
-    private function formatPointMarker($seriesPlot, $markerID)
-    {
-        $plotMarkKeys = array_keys(self::$markSet);
-        if (is_null($markerID)) {
-            //    Use default plot marker (next marker in the series)
-            self::$plotMark %= count(self::$markSet);
-            $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
-        } elseif ($markerID !== 'none') {
-            //    Use specified plot marker (if it exists)
-            if (isset(self::$markSet[$markerID])) {
-                $seriesPlot->mark->SetType(self::$markSet[$markerID]);
-            } else {
-                //    If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
-                self::$plotMark %= count(self::$markSet);
-                $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
-            }
-        } else {
-            //    Hide plot marker
-            $seriesPlot->mark->Hide();
-        }
-        $seriesPlot->mark->SetColor(self::$colourSet[self::$plotColour]);
-        $seriesPlot->mark->SetFillColor(self::$colourSet[self::$plotColour]);
-        $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
-
-        return $seriesPlot;
-    }
-
-
-    private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '')
-    {
-        $datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
-        if (!is_null($datasetLabelFormatCode)) {
-            //    Retrieve any label formatting code
-            $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
-        }
-
-        $testCurrentIndex = 0;
-        foreach ($datasetLabels as $i => $datasetLabel) {
-            if (is_array($datasetLabel)) {
-                if ($rotation == 'bar') {
-                    $datasetLabels[$i] = implode(" ", $datasetLabel);
-                } else {
-                    $datasetLabel = array_reverse($datasetLabel);
-                    $datasetLabels[$i] = implode("\n", $datasetLabel);
-                }
-            } else {
-                //    Format labels according to any formatting code
-                if (!is_null($datasetLabelFormatCode)) {
-                    $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode);
-                }
-            }
-            ++$testCurrentIndex;
-        }
-
-        return $datasetLabels;
-    }
-
-
-    private function percentageSumCalculation($groupID, $seriesCount)
-    {
-        //    Adjust our values to a percentage value across all series in the group
-        for ($i = 0; $i < $seriesCount; ++$i) {
-            if ($i == 0) {
-                $sumValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-            } else {
-                $nextValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-                foreach ($nextValues as $k => $value) {
-                    if (isset($sumValues[$k])) {
-                        $sumValues[$k] += $value;
-                    } else {
-                        $sumValues[$k] = $value;
-                    }
-                }
-            }
-        }
-
-        return $sumValues;
-    }
-
-
-    private function percentageAdjustValues($dataValues, $sumValues)
-    {
-        foreach ($dataValues as $k => $dataValue) {
-            $dataValues[$k] = $dataValue / $sumValues[$k] * 100;
-        }
-
-        return $dataValues;
-    }
-
-
-    private function getCaption($captionElement)
-    {
-        //    Read any caption
-        $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : null;
-        //    Test if we have a title caption to display
-        if (!is_null($caption)) {
-            //    If we do, it could be a plain string or an array
-            if (is_array($caption)) {
-                //    Implode an array to a plain string
-                $caption = implode('', $caption);
-            }
-        }
-        return $caption;
-    }
-
-
-    private function renderTitle()
-    {
-        $title = $this->getCaption($this->chart->getTitle());
-        if (!is_null($title)) {
-            $this->graph->title->Set($title);
-        }
-    }
-
-
-    private function renderLegend()
-    {
-        $legend = $this->chart->getLegend();
-        if (!is_null($legend)) {
-            $legendPosition = $legend->getPosition();
-            $legendOverlay = $legend->getOverlay();
-            switch ($legendPosition) {
-                case 'r':
-                    $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center');    //    right
-                    $this->graph->legend->SetColumns(1);
-                    break;
-                case 'l':
-                    $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center');    //    left
-                    $this->graph->legend->SetColumns(1);
-                    break;
-                case 't':
-                    $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top');    //    top
-                    break;
-                case 'b':
-                    $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom');    //    bottom
-                    break;
-                default:
-                    $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top');    //    top-right
-                    $this->graph->legend->SetColumns(1);
-                    break;
-            }
-        } else {
-            $this->graph->legend->Hide();
-        }
-    }
-
-
-    private function renderCartesianPlotArea($type = 'textlin')
-    {
-        $this->graph = new Graph(self::$width, self::$height);
-        $this->graph->SetScale($type);
-
-        $this->renderTitle();
-
-        //    Rotate for bar rather than column chart
-        $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
-        $reverse = ($rotation == 'bar') ? true : false;
-
-        $xAxisLabel = $this->chart->getXAxisLabel();
-        if (!is_null($xAxisLabel)) {
-            $title = $this->getCaption($xAxisLabel);
-            if (!is_null($title)) {
-                $this->graph->xaxis->SetTitle($title, 'center');
-                $this->graph->xaxis->title->SetMargin(35);
-                if ($reverse) {
-                    $this->graph->xaxis->title->SetAngle(90);
-                    $this->graph->xaxis->title->SetMargin(90);
-                }
-            }
-        }
-
-        $yAxisLabel = $this->chart->getYAxisLabel();
-        if (!is_null($yAxisLabel)) {
-            $title = $this->getCaption($yAxisLabel);
-            if (!is_null($title)) {
-                $this->graph->yaxis->SetTitle($title, 'center');
-                if ($reverse) {
-                    $this->graph->yaxis->title->SetAngle(0);
-                    $this->graph->yaxis->title->SetMargin(-55);
-                }
-            }
-        }
-    }
-
-
-    private function renderPiePlotArea($doughnut = false)
-    {
-        $this->graph = new PieGraph(self::$width, self::$height);
-
-        $this->renderTitle();
-    }
-
-
-    private function renderRadarPlotArea()
-    {
-        $this->graph = new RadarGraph(self::$width, self::$height);
-        $this->graph->SetScale('lin');
-
-        $this->renderTitle();
-    }
-
-
-    private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d')
-    {
-        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
-
-        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
-        if ($labelCount > 0) {
-            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
-            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
-            $this->graph->xaxis->SetTickLabels($datasetLabels);
-        }
-
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $seriesPlots = array();
-        if ($grouping == 'percentStacked') {
-            $sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
-        }
-
-        //    Loop through each data series in turn
-        for ($i = 0; $i < $seriesCount; ++$i) {
-            $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-            $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
-
-            if ($grouping == 'percentStacked') {
-                $dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
-            }
-
-            //    Fill in any missing values in the $dataValues array
-            $testCurrentIndex = 0;
-            foreach ($dataValues as $k => $dataValue) {
-                while ($k != $testCurrentIndex) {
-                    $dataValues[$testCurrentIndex] = null;
-                    ++$testCurrentIndex;
-                }
-                ++$testCurrentIndex;
-            }
-
-            $seriesPlot = new LinePlot($dataValues);
-            if ($combination) {
-                $seriesPlot->SetBarCenter();
-            }
-
-            if ($filled) {
-                $seriesPlot->SetFilled(true);
-                $seriesPlot->SetColor('black');
-                $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
-            } else {
-                //    Set the appropriate plot marker
-                $this->formatPointMarker($seriesPlot, $marker);
-            }
-            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
-            $seriesPlot->SetLegend($dataLabel);
-
-            $seriesPlots[] = $seriesPlot;
-        }
-
-        if ($grouping == 'standard') {
-            $groupPlot = $seriesPlots;
-        } else {
-            $groupPlot = new AccLinePlot($seriesPlots);
-        }
-        $this->graph->Add($groupPlot);
-    }
-
-
-    private function renderPlotBar($groupID, $dimensions = '2d')
-    {
-        $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
-        //    Rotate for bar rather than column chart
-        if (($groupID == 0) && ($rotation == 'bar')) {
-            $this->graph->Set90AndMargin();
-        }
-        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
-
-        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
-        if ($labelCount > 0) {
-            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
-            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
-            //    Rotate for bar rather than column chart
-            if ($rotation == 'bar') {
-                $datasetLabels = array_reverse($datasetLabels);
-                $this->graph->yaxis->SetPos('max');
-                $this->graph->yaxis->SetLabelAlign('center', 'top');
-                $this->graph->yaxis->SetLabelSide(SIDE_RIGHT);
-            }
-            $this->graph->xaxis->SetTickLabels($datasetLabels);
-        }
-
-
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $seriesPlots = array();
-        if ($grouping == 'percentStacked') {
-            $sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
-        }
-
-        //    Loop through each data series in turn
-        for ($j = 0; $j < $seriesCount; ++$j) {
-            $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
-            if ($grouping == 'percentStacked') {
-                $dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
-            }
-
-            //    Fill in any missing values in the $dataValues array
-            $testCurrentIndex = 0;
-            foreach ($dataValues as $k => $dataValue) {
-                while ($k != $testCurrentIndex) {
-                    $dataValues[$testCurrentIndex] = null;
-                    ++$testCurrentIndex;
-                }
-                ++$testCurrentIndex;
-            }
-
-            //    Reverse the $dataValues order for bar rather than column chart
-            if ($rotation == 'bar') {
-                $dataValues = array_reverse($dataValues);
-            }
-            $seriesPlot = new BarPlot($dataValues);
-            $seriesPlot->SetColor('black');
-            $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
-            if ($dimensions == '3d') {
-                $seriesPlot->SetShadow();
-            }
-            if (!$this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
-                $dataLabel = '';
-            } else {
-                $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
-            }
-            $seriesPlot->SetLegend($dataLabel);
-
-            $seriesPlots[] = $seriesPlot;
-        }
-        //    Reverse the plot order for bar rather than column chart
-        if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) {
-            $seriesPlots = array_reverse($seriesPlots);
-        }
-
-        if ($grouping == 'clustered') {
-            $groupPlot = new GroupBarPlot($seriesPlots);
-        } elseif ($grouping == 'standard') {
-            $groupPlot = new GroupBarPlot($seriesPlots);
-        } else {
-            $groupPlot = new AccBarPlot($seriesPlots);
-            if ($dimensions == '3d') {
-                $groupPlot->SetShadow();
-            }
-        }
-
-        $this->graph->Add($groupPlot);
-    }
-
-
-    private function renderPlotScatter($groupID, $bubble)
-    {
-        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
-        $scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
-
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $seriesPlots = array();
-
-        //    Loop through each data series in turn
-        for ($i = 0; $i < $seriesCount; ++$i) {
-            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
-            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-
-            foreach ($dataValuesY as $k => $dataValueY) {
-                $dataValuesY[$k] = $k;
-            }
-
-            $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
-            if ($scatterStyle == 'lineMarker') {
-                $seriesPlot->SetLinkPoints();
-                $seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]);
-            } elseif ($scatterStyle == 'smoothMarker') {
-                $spline = new Spline($dataValuesY, $dataValuesX);
-                list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20);
-                $lplot = new LinePlot($splineDataX, $splineDataY);
-                $lplot->SetColor(self::$colourSet[self::$plotColour]);
-
-                $this->graph->Add($lplot);
-            }
-
-            if ($bubble) {
-                $this->formatPointMarker($seriesPlot, 'dot');
-                $seriesPlot->mark->SetColor('black');
-                $seriesPlot->mark->SetSize($bubbleSize);
-            } else {
-                $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
-                $this->formatPointMarker($seriesPlot, $marker);
-            }
-            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
-            $seriesPlot->SetLegend($dataLabel);
-
-            $this->graph->Add($seriesPlot);
-        }
-    }
-
-
-    private function renderPlotRadar($groupID)
-    {
-        $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
-
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $seriesPlots = array();
-
-        //    Loop through each data series in turn
-        for ($i = 0; $i < $seriesCount; ++$i) {
-            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
-            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-            $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
-
-            $dataValues = array();
-            foreach ($dataValuesY as $k => $dataValueY) {
-                $dataValues[$k] = implode(' ', array_reverse($dataValueY));
-            }
-            $tmp = array_shift($dataValues);
-            $dataValues[] = $tmp;
-            $tmp = array_shift($dataValuesX);
-            $dataValuesX[] = $tmp;
-
-            $this->graph->SetTitles(array_reverse($dataValues));
-
-            $seriesPlot = new RadarPlot(array_reverse($dataValuesX));
-
-            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
-            $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
-            if ($radarStyle == 'filled') {
-                $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour]);
-            }
-            $this->formatPointMarker($seriesPlot, $marker);
-            $seriesPlot->SetLegend($dataLabel);
-
-            $this->graph->Add($seriesPlot);
-        }
-    }
-
-
-    private function renderPlotContour($groupID)
-    {
-        $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
-
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $seriesPlots = array();
-
-        $dataValues = array();
-        //    Loop through each data series in turn
-        for ($i = 0; $i < $seriesCount; ++$i) {
-            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
-            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
-
-            $dataValues[$i] = $dataValuesX;
-        }
-        $seriesPlot = new ContourPlot($dataValues);
-
-        $this->graph->Add($seriesPlot);
-    }
-
-
-    private function renderPlotStock($groupID)
-    {
-        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-        $plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
-
-        $dataValues = array();
-        //    Loop through each data series in turn and build the plot arrays
-        foreach ($plotOrder as $i => $v) {
-            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
-            foreach ($dataValuesX as $j => $dataValueX) {
-                $dataValues[$plotOrder[$i]][$j] = $dataValueX;
-            }
-        }
-        if (empty($dataValues)) {
-            return;
-        }
-
-        $dataValuesPlot = array();
-        // Flatten the plot arrays to a single dimensional array to work with jpgraph
-        for ($j = 0; $j < count($dataValues[0]); ++$j) {
-            for ($i = 0; $i < $seriesCount; ++$i) {
-                $dataValuesPlot[] = $dataValues[$i][$j];
-            }
-        }
-
-        // Set the x-axis labels
-        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
-        if ($labelCount > 0) {
-            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
-            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
-            $this->graph->xaxis->SetTickLabels($datasetLabels);
-        }
-
-        $seriesPlot = new StockPlot($dataValuesPlot);
-        $seriesPlot->SetWidth(20);
-
-        $this->graph->Add($seriesPlot);
-    }
-
-
-    private function renderAreaChart($groupCount, $dimensions = '2d')
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
-
-        $this->renderCartesianPlotArea();
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotLine($i, true, false, $dimensions);
-        }
-    }
-
-
-    private function renderLineChart($groupCount, $dimensions = '2d')
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
-
-        $this->renderCartesianPlotArea();
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotLine($i, false, false, $dimensions);
-        }
-    }
-
-
-    private function renderBarChart($groupCount, $dimensions = '2d')
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
-
-        $this->renderCartesianPlotArea();
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotBar($i, $dimensions);
-        }
-    }
-
-
-    private function renderScatterChart($groupCount)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
-
-        $this->renderCartesianPlotArea('linlin');
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotScatter($i, false);
-        }
-    }
-
-
-    private function renderBubbleChart($groupCount)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
-
-        $this->renderCartesianPlotArea('linlin');
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotScatter($i, true);
-        }
-    }
-
-
-    private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php');
-        if ($dimensions == '3d') {
-            require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php');
-        }
-
-        $this->renderPiePlotArea($doughnut);
-
-        $iLimit = ($multiplePlots) ? $groupCount : 1;
-        for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
-            $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
-            $exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
-            if ($groupID == 0) {
-                $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
-                if ($labelCount > 0) {
-                    $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
-                    $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
-                }
-            }
-
-            $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
-            $seriesPlots = array();
-            //    For pie charts, we only display the first series: doughnut charts generally display all series
-            $jLimit = ($multiplePlots) ? $seriesCount : 1;
-            //    Loop through each data series in turn
-            for ($j = 0; $j < $jLimit; ++$j) {
-                $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
-
-                //    Fill in any missing values in the $dataValues array
-                $testCurrentIndex = 0;
-                foreach ($dataValues as $k => $dataValue) {
-                    while ($k != $testCurrentIndex) {
-                        $dataValues[$testCurrentIndex] = null;
-                        ++$testCurrentIndex;
-                    }
-                    ++$testCurrentIndex;
-                }
-
-                if ($dimensions == '3d') {
-                    $seriesPlot = new PiePlot3D($dataValues);
-                } else {
-                    if ($doughnut) {
-                        $seriesPlot = new PiePlotC($dataValues);
-                    } else {
-                        $seriesPlot = new PiePlot($dataValues);
-                    }
-                }
-
-                if ($multiplePlots) {
-                    $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
-                }
-
-                if ($doughnut) {
-                    $seriesPlot->SetMidColor('white');
-                }
-
-                $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
-                if (count($datasetLabels) > 0) {
-                    $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), ''));
-                }
-                if ($dimensions != '3d') {
-                    $seriesPlot->SetGuideLines(false);
-                }
-                if ($j == 0) {
-                    if ($exploded) {
-                        $seriesPlot->ExplodeAll();
-                    }
-                    $seriesPlot->SetLegends($datasetLabels);
-                }
-
-                $this->graph->Add($seriesPlot);
-            }
-        }
-    }
-
-
-    private function renderRadarChart($groupCount)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php');
-
-        $this->renderRadarPlotArea();
-
-        for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
-            $this->renderPlotRadar($groupID);
-        }
-    }
-
-
-    private function renderStockChart($groupCount)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php');
-
-        $this->renderCartesianPlotArea('intint');
-
-        for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
-            $this->renderPlotStock($groupID);
-        }
-    }
-
-
-    private function renderContourChart($groupCount, $dimensions)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
-
-        $this->renderCartesianPlotArea('intint');
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $this->renderPlotContour($i);
-        }
-    }
-
-
-    private function renderCombinationChart($groupCount, $dimensions, $outputDestination)
-    {
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
-        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
-
-        $this->renderCartesianPlotArea();
-
-        for ($i = 0; $i < $groupCount; ++$i) {
-            $dimensions = null;
-            $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
-            switch ($chartType) {
-                case 'area3DChart':
-                    $dimensions = '3d';
-                    // no break
-                case 'areaChart':
-                    $this->renderPlotLine($i, true, true, $dimensions);
-                    break;
-                case 'bar3DChart':
-                    $dimensions = '3d';
-                    // no break
-                case 'barChart':
-                    $this->renderPlotBar($i, $dimensions);
-                    break;
-                case 'line3DChart':
-                    $dimensions = '3d';
-                    // no break
-                case 'lineChart':
-                    $this->renderPlotLine($i, false, true, $dimensions);
-                    break;
-                case 'scatterChart':
-                    $this->renderPlotScatter($i, false);
-                    break;
-                case 'bubbleChart':
-                    $this->renderPlotScatter($i, true);
-                    break;
-                default:
-                    $this->graph = null;
-                    return false;
-            }
-        }
-
-        $this->renderLegend();
-
-        $this->graph->Stroke($outputDestination);
-        return true;
-    }
-
-
-    public function render($outputDestination)
-    {
-        self::$plotColour = 0;
-
-        $groupCount = $this->chart->getPlotArea()->getPlotGroupCount();
-
-        $dimensions = null;
-        if ($groupCount == 1) {
-            $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
-        } else {
-            $chartTypes = array();
-            for ($i = 0; $i < $groupCount; ++$i) {
-                $chartTypes[] = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
-            }
-            $chartTypes = array_unique($chartTypes);
-            if (count($chartTypes) == 1) {
-                $chartType = array_pop($chartTypes);
-            } elseif (count($chartTypes) == 0) {
-                echo 'Chart is not yet implemented<br />';
-                return false;
-            } else {
-                return $this->renderCombinationChart($groupCount, $dimensions, $outputDestination);
-            }
-        }
-
-        switch ($chartType) {
-            case 'area3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'areaChart':
-                $this->renderAreaChart($groupCount, $dimensions);
-                break;
-            case 'bar3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'barChart':
-                $this->renderBarChart($groupCount, $dimensions);
-                break;
-            case 'line3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'lineChart':
-                $this->renderLineChart($groupCount, $dimensions);
-                break;
-            case 'pie3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'pieChart':
-                $this->renderPieChart($groupCount, $dimensions, false, false);
-                break;
-            case 'doughnut3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'doughnutChart':
-                $this->renderPieChart($groupCount, $dimensions, true, true);
-                break;
-            case 'scatterChart':
-                $this->renderScatterChart($groupCount);
-                break;
-            case 'bubbleChart':
-                $this->renderBubbleChart($groupCount);
-                break;
-            case 'radarChart':
-                $this->renderRadarChart($groupCount);
-                break;
-            case 'surface3DChart':
-                $dimensions = '3d';
-                // no break
-            case 'surfaceChart':
-                $this->renderContourChart($groupCount, $dimensions);
-                break;
-            case 'stockChart':
-                $this->renderStockChart($groupCount, $dimensions);
-                break;
-            default:
-                echo $chartType.' is not yet implemented<br />';
-                return false;
-        }
-        $this->renderLegend();
-
-        $this->graph->Stroke($outputDestination);
-        return true;
-    }
-
-
-    /**
-     * Create a new PHPExcel_Chart_Renderer_jpgraph
-     */
-    public function __construct(PHPExcel_Chart $chart)
-    {
-        $this->graph    = null;
-        $this->chart    = $chart;
-    }
-}

+ 0 - 86
libs/PHPExcel/PHPExcel/Chart/Title.php

xqd
@@ -1,86 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Chart_Title
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Chart
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-class PHPExcel_Chart_Title
-{
-
-    /**
-     * Title Caption
-     *
-     * @var string
-     */
-    private $caption = null;
-
-    /**
-     * Title Layout
-     *
-     * @var PHPExcel_Chart_Layout
-     */
-    private $layout = null;
-
-    /**
-     * Create a new PHPExcel_Chart_Title
-     */
-    public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
-    {
-        $this->caption = $caption;
-        $this->layout = $layout;
-    }
-
-    /**
-     * Get caption
-     *
-     * @return string
-     */
-    public function getCaption()
-    {
-        return $this->caption;
-    }
-
-    /**
-     * Set caption
-     *
-     * @param string $caption
-     * @return PHPExcel_Chart_Title
-     */
-    public function setCaption($caption = null)
-    {
-        $this->caption = $caption;
-        
-        return $this;
-    }
-
-    /**
-     * Get Layout
-     *
-     * @return PHPExcel_Chart_Layout
-     */
-    public function getLayout()
-    {
-        return $this->layout;
-    }
-}

+ 0 - 338
libs/PHPExcel/PHPExcel/Comment.php

xqd
@@ -1,338 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Comment
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Comment implements PHPExcel_IComparable
-{
-    /**
-     * Author
-     *
-     * @var string
-     */
-    private $author;
-
-    /**
-     * Rich text comment
-     *
-     * @var PHPExcel_RichText
-     */
-    private $text;
-
-    /**
-     * Comment width (CSS style, i.e. XXpx or YYpt)
-     *
-     * @var string
-     */
-    private $width = '96pt';
-
-    /**
-     * Left margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @var string
-     */
-    private $marginLeft = '59.25pt';
-
-    /**
-     * Top margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @var string
-     */
-    private $marginTop = '1.5pt';
-
-    /**
-     * Visible
-     *
-     * @var boolean
-     */
-    private $visible = false;
-
-    /**
-     * Comment height (CSS style, i.e. XXpx or YYpt)
-     *
-     * @var string
-     */
-    private $height = '55.5pt';
-
-    /**
-     * Comment fill color
-     *
-     * @var PHPExcel_Style_Color
-     */
-    private $fillColor;
-
-    /**
-     * Alignment
-     *
-     * @var string
-     */
-    private $alignment;
-
-    /**
-     * Create a new PHPExcel_Comment
-     *
-     * @throws PHPExcel_Exception
-     */
-    public function __construct()
-    {
-        // Initialise variables
-        $this->author    = 'Author';
-        $this->text      = new PHPExcel_RichText();
-        $this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
-        $this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
-    }
-
-    /**
-     * Get Author
-     *
-     * @return string
-     */
-    public function getAuthor()
-    {
-        return $this->author;
-    }
-
-    /**
-     * Set Author
-     *
-     * @param string $pValue
-     * @return PHPExcel_Comment
-     */
-    public function setAuthor($pValue = '')
-    {
-        $this->author = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Rich text comment
-     *
-     * @return PHPExcel_RichText
-     */
-    public function getText()
-    {
-        return $this->text;
-    }
-
-    /**
-     * Set Rich text comment
-     *
-     * @param PHPExcel_RichText $pValue
-     * @return PHPExcel_Comment
-     */
-    public function setText(PHPExcel_RichText $pValue)
-    {
-        $this->text = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get comment width (CSS style, i.e. XXpx or YYpt)
-     *
-     * @return string
-     */
-    public function getWidth()
-    {
-        return $this->width;
-    }
-
-    /**
-     * Set comment width (CSS style, i.e. XXpx or YYpt)
-     *
-     * @param string $value
-     * @return PHPExcel_Comment
-     */
-    public function setWidth($value = '96pt')
-    {
-        $this->width = $value;
-        return $this;
-    }
-
-    /**
-     * Get comment height (CSS style, i.e. XXpx or YYpt)
-     *
-     * @return string
-     */
-    public function getHeight()
-    {
-        return $this->height;
-    }
-
-    /**
-     * Set comment height (CSS style, i.e. XXpx or YYpt)
-     *
-     * @param string $value
-     * @return PHPExcel_Comment
-     */
-    public function setHeight($value = '55.5pt')
-    {
-        $this->height = $value;
-        return $this;
-    }
-
-    /**
-     * Get left margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @return string
-     */
-    public function getMarginLeft()
-    {
-        return $this->marginLeft;
-    }
-
-    /**
-     * Set left margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @param string $value
-     * @return PHPExcel_Comment
-     */
-    public function setMarginLeft($value = '59.25pt')
-    {
-        $this->marginLeft = $value;
-        return $this;
-    }
-
-    /**
-     * Get top margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @return string
-     */
-    public function getMarginTop()
-    {
-        return $this->marginTop;
-    }
-
-    /**
-     * Set top margin (CSS style, i.e. XXpx or YYpt)
-     *
-     * @param string $value
-     * @return PHPExcel_Comment
-     */
-    public function setMarginTop($value = '1.5pt')
-    {
-        $this->marginTop = $value;
-        return $this;
-    }
-
-    /**
-     * Is the comment visible by default?
-     *
-     * @return boolean
-     */
-    public function getVisible()
-    {
-        return $this->visible;
-    }
-
-    /**
-     * Set comment default visibility
-     *
-     * @param boolean $value
-     * @return PHPExcel_Comment
-     */
-    public function setVisible($value = false)
-    {
-        $this->visible = $value;
-        return $this;
-    }
-
-    /**
-     * Get fill color
-     *
-     * @return PHPExcel_Style_Color
-     */
-    public function getFillColor()
-    {
-        return $this->fillColor;
-    }
-
-    /**
-     * Set Alignment
-     *
-     * @param string $pValue
-     * @return PHPExcel_Comment
-     */
-    public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
-    {
-        $this->alignment = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Alignment
-     *
-     * @return string
-     */
-    public function getAlignment()
-    {
-        return $this->alignment;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        return md5(
-            $this->author .
-            $this->text->getHashCode() .
-            $this->width .
-            $this->height .
-            $this->marginLeft .
-            $this->marginTop .
-            ($this->visible ? 1 : 0) .
-            $this->fillColor->getHashCode() .
-            $this->alignment .
-            __CLASS__
-        );
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-
-    /**
-     * Convert to string
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->text->getPlainText();
-    }
-}

+ 0 - 611
libs/PHPExcel/PHPExcel/DocumentProperties.php

xqd
@@ -1,611 +0,0 @@
-<?php
-
-/**
- * PHPExcel_DocumentProperties
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package    PHPExcel
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_DocumentProperties
-{
-    /** constants */
-    const PROPERTY_TYPE_BOOLEAN = 'b';
-    const PROPERTY_TYPE_INTEGER = 'i';
-    const PROPERTY_TYPE_FLOAT   = 'f';
-    const PROPERTY_TYPE_DATE    = 'd';
-    const PROPERTY_TYPE_STRING  = 's';
-    const PROPERTY_TYPE_UNKNOWN = 'u';
-
-    /**
-     * Creator
-     *
-     * @var string
-     */
-    private $creator = 'Unknown Creator';
-
-    /**
-     * LastModifiedBy
-     *
-     * @var string
-     */
-    private $lastModifiedBy;
-
-    /**
-     * Created
-     *
-     * @var datetime
-     */
-    private $created;
-
-    /**
-     * Modified
-     *
-     * @var datetime
-     */
-    private $modified;
-
-    /**
-     * Title
-     *
-     * @var string
-     */
-    private $title = 'Untitled Spreadsheet';
-
-    /**
-     * Description
-     *
-     * @var string
-     */
-    private $description = '';
-
-    /**
-     * Subject
-     *
-     * @var string
-     */
-    private $subject = '';
-
-    /**
-     * Keywords
-     *
-     * @var string
-     */
-    private $keywords = '';
-
-    /**
-     * Category
-     *
-     * @var string
-     */
-    private $category = '';
-
-    /**
-     * Manager
-     *
-     * @var string
-     */
-    private $manager = '';
-
-    /**
-     * Company
-     *
-     * @var string
-     */
-    private $company = 'Microsoft Corporation';
-
-    /**
-     * Custom Properties
-     *
-     * @var string
-     */
-    private $customProperties = array();
-
-
-    /**
-     * Create a new PHPExcel_DocumentProperties
-     */
-    public function __construct()
-    {
-        // Initialise values
-        $this->lastModifiedBy = $this->creator;
-        $this->created  = time();
-        $this->modified = time();
-    }
-
-    /**
-     * Get Creator
-     *
-     * @return string
-     */
-    public function getCreator()
-    {
-        return $this->creator;
-    }
-
-    /**
-     * Set Creator
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setCreator($pValue = '')
-    {
-        $this->creator = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Last Modified By
-     *
-     * @return string
-     */
-    public function getLastModifiedBy()
-    {
-        return $this->lastModifiedBy;
-    }
-
-    /**
-     * Set Last Modified By
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setLastModifiedBy($pValue = '')
-    {
-        $this->lastModifiedBy = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Created
-     *
-     * @return datetime
-     */
-    public function getCreated()
-    {
-        return $this->created;
-    }
-
-    /**
-     * Set Created
-     *
-     * @param datetime $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setCreated($pValue = null)
-    {
-        if ($pValue === null) {
-            $pValue = time();
-        } elseif (is_string($pValue)) {
-            if (is_numeric($pValue)) {
-                $pValue = intval($pValue);
-            } else {
-                $pValue = strtotime($pValue);
-            }
-        }
-
-        $this->created = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Modified
-     *
-     * @return datetime
-     */
-    public function getModified()
-    {
-        return $this->modified;
-    }
-
-    /**
-     * Set Modified
-     *
-     * @param datetime $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setModified($pValue = null)
-    {
-        if ($pValue === null) {
-            $pValue = time();
-        } elseif (is_string($pValue)) {
-            if (is_numeric($pValue)) {
-                $pValue = intval($pValue);
-            } else {
-                $pValue = strtotime($pValue);
-            }
-        }
-
-        $this->modified = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Title
-     *
-     * @return string
-     */
-    public function getTitle()
-    {
-        return $this->title;
-    }
-
-    /**
-     * Set Title
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setTitle($pValue = '')
-    {
-        $this->title = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Description
-     *
-     * @return string
-     */
-    public function getDescription()
-    {
-        return $this->description;
-    }
-
-    /**
-     * Set Description
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setDescription($pValue = '')
-    {
-        $this->description = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Subject
-     *
-     * @return string
-     */
-    public function getSubject()
-    {
-        return $this->subject;
-    }
-
-    /**
-     * Set Subject
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setSubject($pValue = '')
-    {
-        $this->subject = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Keywords
-     *
-     * @return string
-     */
-    public function getKeywords()
-    {
-        return $this->keywords;
-    }
-
-    /**
-     * Set Keywords
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setKeywords($pValue = '')
-    {
-        $this->keywords = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Category
-     *
-     * @return string
-     */
-    public function getCategory()
-    {
-        return $this->category;
-    }
-
-    /**
-     * Set Category
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setCategory($pValue = '')
-    {
-        $this->category = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Company
-     *
-     * @return string
-     */
-    public function getCompany()
-    {
-        return $this->company;
-    }
-
-    /**
-     * Set Company
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setCompany($pValue = '')
-    {
-        $this->company = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get Manager
-     *
-     * @return string
-     */
-    public function getManager()
-    {
-        return $this->manager;
-    }
-
-    /**
-     * Set Manager
-     *
-     * @param string $pValue
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setManager($pValue = '')
-    {
-        $this->manager = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get a List of Custom Property Names
-     *
-     * @return array of string
-     */
-    public function getCustomProperties()
-    {
-        return array_keys($this->customProperties);
-    }
-
-    /**
-     * Check if a Custom Property is defined
-     *
-     * @param string $propertyName
-     * @return boolean
-     */
-    public function isCustomPropertySet($propertyName)
-    {
-        return isset($this->customProperties[$propertyName]);
-    }
-
-    /**
-     * Get a Custom Property Value
-     *
-     * @param string $propertyName
-     * @return string
-     */
-    public function getCustomPropertyValue($propertyName)
-    {
-        if (isset($this->customProperties[$propertyName])) {
-            return $this->customProperties[$propertyName]['value'];
-        }
-
-    }
-
-    /**
-     * Get a Custom Property Type
-     *
-     * @param string $propertyName
-     * @return string
-     */
-    public function getCustomPropertyType($propertyName)
-    {
-        if (isset($this->customProperties[$propertyName])) {
-            return $this->customProperties[$propertyName]['type'];
-        }
-
-    }
-
-    /**
-     * Set a Custom Property
-     *
-     * @param string $propertyName
-     * @param mixed $propertyValue
-     * @param string $propertyType
-     *      'i'    : Integer
-     *   'f' : Floating Point
-     *   's' : String
-     *   'd' : Date/Time
-     *   'b' : Boolean
-     * @return PHPExcel_DocumentProperties
-     */
-    public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
-    {
-        if (($propertyType === null) || (!in_array($propertyType, array(self::PROPERTY_TYPE_INTEGER,
-                                                                        self::PROPERTY_TYPE_FLOAT,
-                                                                        self::PROPERTY_TYPE_STRING,
-                                                                        self::PROPERTY_TYPE_DATE,
-                                                                        self::PROPERTY_TYPE_BOOLEAN)))) {
-            if ($propertyValue === null) {
-                $propertyType = self::PROPERTY_TYPE_STRING;
-            } elseif (is_float($propertyValue)) {
-                $propertyType = self::PROPERTY_TYPE_FLOAT;
-            } elseif (is_int($propertyValue)) {
-                $propertyType = self::PROPERTY_TYPE_INTEGER;
-            } elseif (is_bool($propertyValue)) {
-                $propertyType = self::PROPERTY_TYPE_BOOLEAN;
-            } else {
-                $propertyType = self::PROPERTY_TYPE_STRING;
-            }
-        }
-
-        $this->customProperties[$propertyName] = array(
-            'value' => $propertyValue,
-            'type' => $propertyType
-        );
-        return $this;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-
-    public static function convertProperty($propertyValue, $propertyType)
-    {
-        switch ($propertyType) {
-            case 'empty':     //    Empty
-                return '';
-                break;
-            case 'null':      //    Null
-                return null;
-                break;
-            case 'i1':        //    1-Byte Signed Integer
-            case 'i2':        //    2-Byte Signed Integer
-            case 'i4':        //    4-Byte Signed Integer
-            case 'i8':        //    8-Byte Signed Integer
-            case 'int':       //    Integer
-                return (int) $propertyValue;
-                break;
-            case 'ui1':       //    1-Byte Unsigned Integer
-            case 'ui2':       //    2-Byte Unsigned Integer
-            case 'ui4':       //    4-Byte Unsigned Integer
-            case 'ui8':       //    8-Byte Unsigned Integer
-            case 'uint':      //    Unsigned Integer
-                return abs((int) $propertyValue);
-                break;
-            case 'r4':        //    4-Byte Real Number
-            case 'r8':        //    8-Byte Real Number
-            case 'decimal':   //    Decimal
-                return (float) $propertyValue;
-                break;
-            case 'lpstr':     //    LPSTR
-            case 'lpwstr':    //    LPWSTR
-            case 'bstr':      //    Basic String
-                return $propertyValue;
-                break;
-            case 'date':      //    Date and Time
-            case 'filetime':  //    File Time
-                return strtotime($propertyValue);
-                break;
-            case 'bool':     //    Boolean
-                return ($propertyValue == 'true') ? true : false;
-                break;
-            case 'cy':       //    Currency
-            case 'error':    //    Error Status Code
-            case 'vector':   //    Vector
-            case 'array':    //    Array
-            case 'blob':     //    Binary Blob
-            case 'oblob':    //    Binary Blob Object
-            case 'stream':   //    Binary Stream
-            case 'ostream':  //    Binary Stream Object
-            case 'storage':  //    Binary Storage
-            case 'ostorage': //    Binary Storage Object
-            case 'vstream':  //    Binary Versioned Stream
-            case 'clsid':    //    Class ID
-            case 'cf':       //    Clipboard Data
-                return $propertyValue;
-                break;
-        }
-        return $propertyValue;
-    }
-
-    public static function convertPropertyType($propertyType)
-    {
-        switch ($propertyType) {
-            case 'i1':       //    1-Byte Signed Integer
-            case 'i2':       //    2-Byte Signed Integer
-            case 'i4':       //    4-Byte Signed Integer
-            case 'i8':       //    8-Byte Signed Integer
-            case 'int':      //    Integer
-            case 'ui1':      //    1-Byte Unsigned Integer
-            case 'ui2':      //    2-Byte Unsigned Integer
-            case 'ui4':      //    4-Byte Unsigned Integer
-            case 'ui8':      //    8-Byte Unsigned Integer
-            case 'uint':     //    Unsigned Integer
-                return self::PROPERTY_TYPE_INTEGER;
-                break;
-            case 'r4':       //    4-Byte Real Number
-            case 'r8':       //    8-Byte Real Number
-            case 'decimal':  //    Decimal
-                return self::PROPERTY_TYPE_FLOAT;
-                break;
-            case 'empty':    //    Empty
-            case 'null':     //    Null
-            case 'lpstr':    //    LPSTR
-            case 'lpwstr':   //    LPWSTR
-            case 'bstr':     //    Basic String
-                return self::PROPERTY_TYPE_STRING;
-                break;
-            case 'date':     //    Date and Time
-            case 'filetime': //    File Time
-                return self::PROPERTY_TYPE_DATE;
-                break;
-            case 'bool':     //    Boolean
-                return self::PROPERTY_TYPE_BOOLEAN;
-                break;
-            case 'cy':       //    Currency
-            case 'error':    //    Error Status Code
-            case 'vector':   //    Vector
-            case 'array':    //    Array
-            case 'blob':     //    Binary Blob
-            case 'oblob':    //    Binary Blob Object
-            case 'stream':   //    Binary Stream
-            case 'ostream':  //    Binary Stream Object
-            case 'storage':  //    Binary Storage
-            case 'ostorage': //    Binary Storage Object
-            case 'vstream':  //    Binary Versioned Stream
-            case 'clsid':    //    Class ID
-            case 'cf':       //    Clipboard Data
-                return self::PROPERTY_TYPE_UNKNOWN;
-                break;
-        }
-        return self::PROPERTY_TYPE_UNKNOWN;
-    }
-}

+ 0 - 222
libs/PHPExcel/PHPExcel/DocumentSecurity.php

xqd
@@ -1,222 +0,0 @@
-<?php
-
-/**
- * PHPExcel_DocumentSecurity
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_DocumentSecurity
-{
-    /**
-     * LockRevision
-     *
-     * @var boolean
-     */
-    private $lockRevision;
-
-    /**
-     * LockStructure
-     *
-     * @var boolean
-     */
-    private $lockStructure;
-
-    /**
-     * LockWindows
-     *
-     * @var boolean
-     */
-    private $lockWindows;
-
-    /**
-     * RevisionsPassword
-     *
-     * @var string
-     */
-    private $revisionsPassword;
-
-    /**
-     * WorkbookPassword
-     *
-     * @var string
-     */
-    private $workbookPassword;
-
-    /**
-     * Create a new PHPExcel_DocumentSecurity
-     */
-    public function __construct()
-    {
-        // Initialise values
-        $this->lockRevision      = false;
-        $this->lockStructure     = false;
-        $this->lockWindows       = false;
-        $this->revisionsPassword = '';
-        $this->workbookPassword  = '';
-    }
-
-    /**
-     * Is some sort of document security enabled?
-     *
-     * @return boolean
-     */
-    public function isSecurityEnabled()
-    {
-        return  $this->lockRevision ||
-                $this->lockStructure ||
-                $this->lockWindows;
-    }
-
-    /**
-     * Get LockRevision
-     *
-     * @return boolean
-     */
-    public function getLockRevision()
-    {
-        return $this->lockRevision;
-    }
-
-    /**
-     * Set LockRevision
-     *
-     * @param boolean $pValue
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function setLockRevision($pValue = false)
-    {
-        $this->lockRevision = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get LockStructure
-     *
-     * @return boolean
-     */
-    public function getLockStructure()
-    {
-        return $this->lockStructure;
-    }
-
-    /**
-     * Set LockStructure
-     *
-     * @param boolean $pValue
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function setLockStructure($pValue = false)
-    {
-        $this->lockStructure = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get LockWindows
-     *
-     * @return boolean
-     */
-    public function getLockWindows()
-    {
-        return $this->lockWindows;
-    }
-
-    /**
-     * Set LockWindows
-     *
-     * @param boolean $pValue
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function setLockWindows($pValue = false)
-    {
-        $this->lockWindows = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get RevisionsPassword (hashed)
-     *
-     * @return string
-     */
-    public function getRevisionsPassword()
-    {
-        return $this->revisionsPassword;
-    }
-
-    /**
-     * Set RevisionsPassword
-     *
-     * @param string     $pValue
-     * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
-    {
-        if (!$pAlreadyHashed) {
-            $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
-        }
-        $this->revisionsPassword = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get WorkbookPassword (hashed)
-     *
-     * @return string
-     */
-    public function getWorkbookPassword()
-    {
-        return $this->workbookPassword;
-    }
-
-    /**
-     * Set WorkbookPassword
-     *
-     * @param string     $pValue
-     * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
-     * @return PHPExcel_DocumentSecurity
-     */
-    public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
-    {
-        if (!$pAlreadyHashed) {
-            $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
-        }
-        $this->workbookPassword = $pValue;
-        return $this;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 54
libs/PHPExcel/PHPExcel/Exception.php

xqd
@@ -1,54 +0,0 @@
-<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-/**
- * PHPExcel_Exception
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Exception extends Exception
-{
-    /**
-     * Error handler callback
-     *
-     * @param mixed $code
-     * @param mixed $string
-     * @param mixed $file
-     * @param mixed $line
-     * @param mixed $context
-     */
-    public static function errorHandlerCallback($code, $string, $file, $line, $context)
-    {
-        $e = new self($string, $code);
-        $e->line = $line;
-        $e->file = $file;
-        throw $e;
-    }
-}

+ 0 - 204
libs/PHPExcel/PHPExcel/HashTable.php

xqd
@@ -1,204 +0,0 @@
-<?php
-
-/**
- * PHPExcel_HashTable
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_HashTable
-{
-    /**
-     * HashTable elements
-     *
-     * @var array
-     */
-    protected $items = array();
-
-    /**
-     * HashTable key map
-     *
-     * @var array
-     */
-    protected $keyMap = array();
-
-    /**
-     * Create a new PHPExcel_HashTable
-     *
-     * @param    PHPExcel_IComparable[] $pSource    Optional source array to create HashTable from
-     * @throws    PHPExcel_Exception
-     */
-    public function __construct($pSource = null)
-    {
-        if ($pSource !== null) {
-            // Create HashTable
-            $this->addFromSource($pSource);
-        }
-    }
-
-    /**
-     * Add HashTable items from source
-     *
-     * @param    PHPExcel_IComparable[] $pSource    Source array to create HashTable from
-     * @throws    PHPExcel_Exception
-     */
-    public function addFromSource($pSource = null)
-    {
-        // Check if an array was passed
-        if ($pSource == null) {
-            return;
-        } elseif (!is_array($pSource)) {
-            throw new PHPExcel_Exception('Invalid array parameter passed.');
-        }
-
-        foreach ($pSource as $item) {
-            $this->add($item);
-        }
-    }
-
-    /**
-     * Add HashTable item
-     *
-     * @param    PHPExcel_IComparable $pSource    Item to add
-     * @throws    PHPExcel_Exception
-     */
-    public function add(PHPExcel_IComparable $pSource = null)
-    {
-        $hash = $pSource->getHashCode();
-        if (!isset($this->items[$hash])) {
-            $this->items[$hash] = $pSource;
-            $this->keyMap[count($this->items) - 1] = $hash;
-        }
-    }
-
-    /**
-     * Remove HashTable item
-     *
-     * @param    PHPExcel_IComparable $pSource    Item to remove
-     * @throws    PHPExcel_Exception
-     */
-    public function remove(PHPExcel_IComparable $pSource = null)
-    {
-        $hash = $pSource->getHashCode();
-        if (isset($this->items[$hash])) {
-            unset($this->items[$hash]);
-
-            $deleteKey = -1;
-            foreach ($this->keyMap as $key => $value) {
-                if ($deleteKey >= 0) {
-                    $this->keyMap[$key - 1] = $value;
-                }
-
-                if ($value == $hash) {
-                    $deleteKey = $key;
-                }
-            }
-            unset($this->keyMap[count($this->keyMap) - 1]);
-        }
-    }
-
-    /**
-     * Clear HashTable
-     *
-     */
-    public function clear()
-    {
-        $this->items = array();
-        $this->keyMap = array();
-    }
-
-    /**
-     * Count
-     *
-     * @return int
-     */
-    public function count()
-    {
-        return count($this->items);
-    }
-
-    /**
-     * Get index for hash code
-     *
-     * @param    string    $pHashCode
-     * @return    int    Index
-     */
-    public function getIndexForHashCode($pHashCode = '')
-    {
-        return array_search($pHashCode, $this->keyMap);
-    }
-
-    /**
-     * Get by index
-     *
-     * @param    int    $pIndex
-     * @return    PHPExcel_IComparable
-     *
-     */
-    public function getByIndex($pIndex = 0)
-    {
-        if (isset($this->keyMap[$pIndex])) {
-            return $this->getByHashCode($this->keyMap[$pIndex]);
-        }
-
-        return null;
-    }
-
-    /**
-     * Get by hashcode
-     *
-     * @param    string    $pHashCode
-     * @return    PHPExcel_IComparable
-     *
-     */
-    public function getByHashCode($pHashCode = '')
-    {
-        if (isset($this->items[$pHashCode])) {
-            return $this->items[$pHashCode];
-        }
-
-        return null;
-    }
-
-    /**
-     * HashTable to array
-     *
-     * @return PHPExcel_IComparable[]
-     */
-    public function toArray()
-    {
-        return $this->items;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            }
-        }
-    }
-}

+ 0 - 808
libs/PHPExcel/PHPExcel/Helper/HTML.php

xqd
@@ -1,808 +0,0 @@
-<?php
-
-class PHPExcel_Helper_HTML
-{
-    protected static $colourMap = array(
-        'aliceblue' => 'f0f8ff',
-        'antiquewhite' => 'faebd7',
-        'antiquewhite1' => 'ffefdb',
-        'antiquewhite2' => 'eedfcc',
-        'antiquewhite3' => 'cdc0b0',
-        'antiquewhite4' => '8b8378',
-        'aqua' => '00ffff',
-        'aquamarine1' => '7fffd4',
-        'aquamarine2' => '76eec6',
-        'aquamarine4' => '458b74',
-        'azure1' => 'f0ffff',
-        'azure2' => 'e0eeee',
-        'azure3' => 'c1cdcd',
-        'azure4' => '838b8b',
-        'beige' => 'f5f5dc',
-        'bisque1' => 'ffe4c4',
-        'bisque2' => 'eed5b7',
-        'bisque3' => 'cdb79e',
-        'bisque4' => '8b7d6b',
-        'black' => '000000',
-        'blanchedalmond' => 'ffebcd',
-        'blue' => '0000ff',
-        'blue1' => '0000ff',
-        'blue2' => '0000ee',
-        'blue4' => '00008b',
-        'blueviolet' => '8a2be2',
-        'brown' => 'a52a2a',
-        'brown1' => 'ff4040',
-        'brown2' => 'ee3b3b',
-        'brown3' => 'cd3333',
-        'brown4' => '8b2323',
-        'burlywood' => 'deb887',
-        'burlywood1' => 'ffd39b',
-        'burlywood2' => 'eec591',
-        'burlywood3' => 'cdaa7d',
-        'burlywood4' => '8b7355',
-        'cadetblue' => '5f9ea0',
-        'cadetblue1' => '98f5ff',
-        'cadetblue2' => '8ee5ee',
-        'cadetblue3' => '7ac5cd',
-        'cadetblue4' => '53868b',
-        'chartreuse1' => '7fff00',
-        'chartreuse2' => '76ee00',
-        'chartreuse3' => '66cd00',
-        'chartreuse4' => '458b00',
-        'chocolate' => 'd2691e',
-        'chocolate1' => 'ff7f24',
-        'chocolate2' => 'ee7621',
-        'chocolate3' => 'cd661d',
-        'coral' => 'ff7f50',
-        'coral1' => 'ff7256',
-        'coral2' => 'ee6a50',
-        'coral3' => 'cd5b45',
-        'coral4' => '8b3e2f',
-        'cornflowerblue' => '6495ed',
-        'cornsilk1' => 'fff8dc',
-        'cornsilk2' => 'eee8cd',
-        'cornsilk3' => 'cdc8b1',
-        'cornsilk4' => '8b8878',
-        'cyan1' => '00ffff',
-        'cyan2' => '00eeee',
-        'cyan3' => '00cdcd',
-        'cyan4' => '008b8b',
-        'darkgoldenrod' => 'b8860b',
-        'darkgoldenrod1' => 'ffb90f',
-        'darkgoldenrod2' => 'eead0e',
-        'darkgoldenrod3' => 'cd950c',
-        'darkgoldenrod4' => '8b6508',
-        'darkgreen' => '006400',
-        'darkkhaki' => 'bdb76b',
-        'darkolivegreen' => '556b2f',
-        'darkolivegreen1' => 'caff70',
-        'darkolivegreen2' => 'bcee68',
-        'darkolivegreen3' => 'a2cd5a',
-        'darkolivegreen4' => '6e8b3d',
-        'darkorange' => 'ff8c00',
-        'darkorange1' => 'ff7f00',
-        'darkorange2' => 'ee7600',
-        'darkorange3' => 'cd6600',
-        'darkorange4' => '8b4500',
-        'darkorchid' => '9932cc',
-        'darkorchid1' => 'bf3eff',
-        'darkorchid2' => 'b23aee',
-        'darkorchid3' => '9a32cd',
-        'darkorchid4' => '68228b',
-        'darksalmon' => 'e9967a',
-        'darkseagreen' => '8fbc8f',
-        'darkseagreen1' => 'c1ffc1',
-        'darkseagreen2' => 'b4eeb4',
-        'darkseagreen3' => '9bcd9b',
-        'darkseagreen4' => '698b69',
-        'darkslateblue' => '483d8b',
-        'darkslategray' => '2f4f4f',
-        'darkslategray1' => '97ffff',
-        'darkslategray2' => '8deeee',
-        'darkslategray3' => '79cdcd',
-        'darkslategray4' => '528b8b',
-        'darkturquoise' => '00ced1',
-        'darkviolet' => '9400d3',
-        'deeppink1' => 'ff1493',
-        'deeppink2' => 'ee1289',
-        'deeppink3' => 'cd1076',
-        'deeppink4' => '8b0a50',
-        'deepskyblue1' => '00bfff',
-        'deepskyblue2' => '00b2ee',
-        'deepskyblue3' => '009acd',
-        'deepskyblue4' => '00688b',
-        'dimgray' => '696969',
-        'dodgerblue1' => '1e90ff',
-        'dodgerblue2' => '1c86ee',
-        'dodgerblue3' => '1874cd',
-        'dodgerblue4' => '104e8b',
-        'firebrick' => 'b22222',
-        'firebrick1' => 'ff3030',
-        'firebrick2' => 'ee2c2c',
-        'firebrick3' => 'cd2626',
-        'firebrick4' => '8b1a1a',
-        'floralwhite' => 'fffaf0',
-        'forestgreen' => '228b22',
-        'fuchsia' => 'ff00ff',
-        'gainsboro' => 'dcdcdc',
-        'ghostwhite' => 'f8f8ff',
-        'gold1' => 'ffd700',
-        'gold2' => 'eec900',
-        'gold3' => 'cdad00',
-        'gold4' => '8b7500',
-        'goldenrod' => 'daa520',
-        'goldenrod1' => 'ffc125',
-        'goldenrod2' => 'eeb422',
-        'goldenrod3' => 'cd9b1d',
-        'goldenrod4' => '8b6914',
-        'gray' => 'bebebe',
-        'gray1' => '030303',
-        'gray10' => '1a1a1a',
-        'gray11' => '1c1c1c',
-        'gray12' => '1f1f1f',
-        'gray13' => '212121',
-        'gray14' => '242424',
-        'gray15' => '262626',
-        'gray16' => '292929',
-        'gray17' => '2b2b2b',
-        'gray18' => '2e2e2e',
-        'gray19' => '303030',
-        'gray2' => '050505',
-        'gray20' => '333333',
-        'gray21' => '363636',
-        'gray22' => '383838',
-        'gray23' => '3b3b3b',
-        'gray24' => '3d3d3d',
-        'gray25' => '404040',
-        'gray26' => '424242',
-        'gray27' => '454545',
-        'gray28' => '474747',
-        'gray29' => '4a4a4a',
-        'gray3' => '080808',
-        'gray30' => '4d4d4d',
-        'gray31' => '4f4f4f',
-        'gray32' => '525252',
-        'gray33' => '545454',
-        'gray34' => '575757',
-        'gray35' => '595959',
-        'gray36' => '5c5c5c',
-        'gray37' => '5e5e5e',
-        'gray38' => '616161',
-        'gray39' => '636363',
-        'gray4' => '0a0a0a',
-        'gray40' => '666666',
-        'gray41' => '696969',
-        'gray42' => '6b6b6b',
-        'gray43' => '6e6e6e',
-        'gray44' => '707070',
-        'gray45' => '737373',
-        'gray46' => '757575',
-        'gray47' => '787878',
-        'gray48' => '7a7a7a',
-        'gray49' => '7d7d7d',
-        'gray5' => '0d0d0d',
-        'gray50' => '7f7f7f',
-        'gray51' => '828282',
-        'gray52' => '858585',
-        'gray53' => '878787',
-        'gray54' => '8a8a8a',
-        'gray55' => '8c8c8c',
-        'gray56' => '8f8f8f',
-        'gray57' => '919191',
-        'gray58' => '949494',
-        'gray59' => '969696',
-        'gray6' => '0f0f0f',
-        'gray60' => '999999',
-        'gray61' => '9c9c9c',
-        'gray62' => '9e9e9e',
-        'gray63' => 'a1a1a1',
-        'gray64' => 'a3a3a3',
-        'gray65' => 'a6a6a6',
-        'gray66' => 'a8a8a8',
-        'gray67' => 'ababab',
-        'gray68' => 'adadad',
-        'gray69' => 'b0b0b0',
-        'gray7' => '121212',
-        'gray70' => 'b3b3b3',
-        'gray71' => 'b5b5b5',
-        'gray72' => 'b8b8b8',
-        'gray73' => 'bababa',
-        'gray74' => 'bdbdbd',
-        'gray75' => 'bfbfbf',
-        'gray76' => 'c2c2c2',
-        'gray77' => 'c4c4c4',
-        'gray78' => 'c7c7c7',
-        'gray79' => 'c9c9c9',
-        'gray8' => '141414',
-        'gray80' => 'cccccc',
-        'gray81' => 'cfcfcf',
-        'gray82' => 'd1d1d1',
-        'gray83' => 'd4d4d4',
-        'gray84' => 'd6d6d6',
-        'gray85' => 'd9d9d9',
-        'gray86' => 'dbdbdb',
-        'gray87' => 'dedede',
-        'gray88' => 'e0e0e0',
-        'gray89' => 'e3e3e3',
-        'gray9' => '171717',
-        'gray90' => 'e5e5e5',
-        'gray91' => 'e8e8e8',
-        'gray92' => 'ebebeb',
-        'gray93' => 'ededed',
-        'gray94' => 'f0f0f0',
-        'gray95' => 'f2f2f2',
-        'gray97' => 'f7f7f7',
-        'gray98' => 'fafafa',
-        'gray99' => 'fcfcfc',
-        'green' => '00ff00',
-        'green1' => '00ff00',
-        'green2' => '00ee00',
-        'green3' => '00cd00',
-        'green4' => '008b00',
-        'greenyellow' => 'adff2f',
-        'honeydew1' => 'f0fff0',
-        'honeydew2' => 'e0eee0',
-        'honeydew3' => 'c1cdc1',
-        'honeydew4' => '838b83',
-        'hotpink' => 'ff69b4',
-        'hotpink1' => 'ff6eb4',
-        'hotpink2' => 'ee6aa7',
-        'hotpink3' => 'cd6090',
-        'hotpink4' => '8b3a62',
-        'indianred' => 'cd5c5c',
-        'indianred1' => 'ff6a6a',
-        'indianred2' => 'ee6363',
-        'indianred3' => 'cd5555',
-        'indianred4' => '8b3a3a',
-        'ivory1' => 'fffff0',
-        'ivory2' => 'eeeee0',
-        'ivory3' => 'cdcdc1',
-        'ivory4' => '8b8b83',
-        'khaki' => 'f0e68c',
-        'khaki1' => 'fff68f',
-        'khaki2' => 'eee685',
-        'khaki3' => 'cdc673',
-        'khaki4' => '8b864e',
-        'lavender' => 'e6e6fa',
-        'lavenderblush1' => 'fff0f5',
-        'lavenderblush2' => 'eee0e5',
-        'lavenderblush3' => 'cdc1c5',
-        'lavenderblush4' => '8b8386',
-        'lawngreen' => '7cfc00',
-        'lemonchiffon1' => 'fffacd',
-        'lemonchiffon2' => 'eee9bf',
-        'lemonchiffon3' => 'cdc9a5',
-        'lemonchiffon4' => '8b8970',
-        'light' => 'eedd82',
-        'lightblue' => 'add8e6',
-        'lightblue1' => 'bfefff',
-        'lightblue2' => 'b2dfee',
-        'lightblue3' => '9ac0cd',
-        'lightblue4' => '68838b',
-        'lightcoral' => 'f08080',
-        'lightcyan1' => 'e0ffff',
-        'lightcyan2' => 'd1eeee',
-        'lightcyan3' => 'b4cdcd',
-        'lightcyan4' => '7a8b8b',
-        'lightgoldenrod1' => 'ffec8b',
-        'lightgoldenrod2' => 'eedc82',
-        'lightgoldenrod3' => 'cdbe70',
-        'lightgoldenrod4' => '8b814c',
-        'lightgoldenrodyellow' => 'fafad2',
-        'lightgray' => 'd3d3d3',
-        'lightpink' => 'ffb6c1',
-        'lightpink1' => 'ffaeb9',
-        'lightpink2' => 'eea2ad',
-        'lightpink3' => 'cd8c95',
-        'lightpink4' => '8b5f65',
-        'lightsalmon1' => 'ffa07a',
-        'lightsalmon2' => 'ee9572',
-        'lightsalmon3' => 'cd8162',
-        'lightsalmon4' => '8b5742',
-        'lightseagreen' => '20b2aa',
-        'lightskyblue' => '87cefa',
-        'lightskyblue1' => 'b0e2ff',
-        'lightskyblue2' => 'a4d3ee',
-        'lightskyblue3' => '8db6cd',
-        'lightskyblue4' => '607b8b',
-        'lightslateblue' => '8470ff',
-        'lightslategray' => '778899',
-        'lightsteelblue' => 'b0c4de',
-        'lightsteelblue1' => 'cae1ff',
-        'lightsteelblue2' => 'bcd2ee',
-        'lightsteelblue3' => 'a2b5cd',
-        'lightsteelblue4' => '6e7b8b',
-        'lightyellow1' => 'ffffe0',
-        'lightyellow2' => 'eeeed1',
-        'lightyellow3' => 'cdcdb4',
-        'lightyellow4' => '8b8b7a',
-        'lime' => '00ff00',
-        'limegreen' => '32cd32',
-        'linen' => 'faf0e6',
-        'magenta' => 'ff00ff',
-        'magenta2' => 'ee00ee',
-        'magenta3' => 'cd00cd',
-        'magenta4' => '8b008b',
-        'maroon' => 'b03060',
-        'maroon1' => 'ff34b3',
-        'maroon2' => 'ee30a7',
-        'maroon3' => 'cd2990',
-        'maroon4' => '8b1c62',
-        'medium' => '66cdaa',
-        'mediumaquamarine' => '66cdaa',
-        'mediumblue' => '0000cd',
-        'mediumorchid' => 'ba55d3',
-        'mediumorchid1' => 'e066ff',
-        'mediumorchid2' => 'd15fee',
-        'mediumorchid3' => 'b452cd',
-        'mediumorchid4' => '7a378b',
-        'mediumpurple' => '9370db',
-        'mediumpurple1' => 'ab82ff',
-        'mediumpurple2' => '9f79ee',
-        'mediumpurple3' => '8968cd',
-        'mediumpurple4' => '5d478b',
-        'mediumseagreen' => '3cb371',
-        'mediumslateblue' => '7b68ee',
-        'mediumspringgreen' => '00fa9a',
-        'mediumturquoise' => '48d1cc',
-        'mediumvioletred' => 'c71585',
-        'midnightblue' => '191970',
-        'mintcream' => 'f5fffa',
-        'mistyrose1' => 'ffe4e1',
-        'mistyrose2' => 'eed5d2',
-        'mistyrose3' => 'cdb7b5',
-        'mistyrose4' => '8b7d7b',
-        'moccasin' => 'ffe4b5',
-        'navajowhite1' => 'ffdead',
-        'navajowhite2' => 'eecfa1',
-        'navajowhite3' => 'cdb38b',
-        'navajowhite4' => '8b795e',
-        'navy' => '000080',
-        'navyblue' => '000080',
-        'oldlace' => 'fdf5e6',
-        'olive' => '808000',
-        'olivedrab' => '6b8e23',
-        'olivedrab1' => 'c0ff3e',
-        'olivedrab2' => 'b3ee3a',
-        'olivedrab4' => '698b22',
-        'orange' => 'ffa500',
-        'orange1' => 'ffa500',
-        'orange2' => 'ee9a00',
-        'orange3' => 'cd8500',
-        'orange4' => '8b5a00',
-        'orangered1' => 'ff4500',
-        'orangered2' => 'ee4000',
-        'orangered3' => 'cd3700',
-        'orangered4' => '8b2500',
-        'orchid' => 'da70d6',
-        'orchid1' => 'ff83fa',
-        'orchid2' => 'ee7ae9',
-        'orchid3' => 'cd69c9',
-        'orchid4' => '8b4789',
-        'pale' => 'db7093',
-        'palegoldenrod' => 'eee8aa',
-        'palegreen' => '98fb98',
-        'palegreen1' => '9aff9a',
-        'palegreen2' => '90ee90',
-        'palegreen3' => '7ccd7c',
-        'palegreen4' => '548b54',
-        'paleturquoise' => 'afeeee',
-        'paleturquoise1' => 'bbffff',
-        'paleturquoise2' => 'aeeeee',
-        'paleturquoise3' => '96cdcd',
-        'paleturquoise4' => '668b8b',
-        'palevioletred' => 'db7093',
-        'palevioletred1' => 'ff82ab',
-        'palevioletred2' => 'ee799f',
-        'palevioletred3' => 'cd6889',
-        'palevioletred4' => '8b475d',
-        'papayawhip' => 'ffefd5',
-        'peachpuff1' => 'ffdab9',
-        'peachpuff2' => 'eecbad',
-        'peachpuff3' => 'cdaf95',
-        'peachpuff4' => '8b7765',
-        'pink' => 'ffc0cb',
-        'pink1' => 'ffb5c5',
-        'pink2' => 'eea9b8',
-        'pink3' => 'cd919e',
-        'pink4' => '8b636c',
-        'plum' => 'dda0dd',
-        'plum1' => 'ffbbff',
-        'plum2' => 'eeaeee',
-        'plum3' => 'cd96cd',
-        'plum4' => '8b668b',
-        'powderblue' => 'b0e0e6',
-        'purple' => 'a020f0',
-        'rebeccapurple' => '663399',
-        'purple1' => '9b30ff',
-        'purple2' => '912cee',
-        'purple3' => '7d26cd',
-        'purple4' => '551a8b',
-        'red' => 'ff0000',
-        'red1' => 'ff0000',
-        'red2' => 'ee0000',
-        'red3' => 'cd0000',
-        'red4' => '8b0000',
-        'rosybrown' => 'bc8f8f',
-        'rosybrown1' => 'ffc1c1',
-        'rosybrown2' => 'eeb4b4',
-        'rosybrown3' => 'cd9b9b',
-        'rosybrown4' => '8b6969',
-        'royalblue' => '4169e1',
-        'royalblue1' => '4876ff',
-        'royalblue2' => '436eee',
-        'royalblue3' => '3a5fcd',
-        'royalblue4' => '27408b',
-        'saddlebrown' => '8b4513',
-        'salmon' => 'fa8072',
-        'salmon1' => 'ff8c69',
-        'salmon2' => 'ee8262',
-        'salmon3' => 'cd7054',
-        'salmon4' => '8b4c39',
-        'sandybrown' => 'f4a460',
-        'seagreen1' => '54ff9f',
-        'seagreen2' => '4eee94',
-        'seagreen3' => '43cd80',
-        'seagreen4' => '2e8b57',
-        'seashell1' => 'fff5ee',
-        'seashell2' => 'eee5de',
-        'seashell3' => 'cdc5bf',
-        'seashell4' => '8b8682',
-        'sienna' => 'a0522d',
-        'sienna1' => 'ff8247',
-        'sienna2' => 'ee7942',
-        'sienna3' => 'cd6839',
-        'sienna4' => '8b4726',
-        'silver' => 'c0c0c0',
-        'skyblue' => '87ceeb',
-        'skyblue1' => '87ceff',
-        'skyblue2' => '7ec0ee',
-        'skyblue3' => '6ca6cd',
-        'skyblue4' => '4a708b',
-        'slateblue' => '6a5acd',
-        'slateblue1' => '836fff',
-        'slateblue2' => '7a67ee',
-        'slateblue3' => '6959cd',
-        'slateblue4' => '473c8b',
-        'slategray' => '708090',
-        'slategray1' => 'c6e2ff',
-        'slategray2' => 'b9d3ee',
-        'slategray3' => '9fb6cd',
-        'slategray4' => '6c7b8b',
-        'snow1' => 'fffafa',
-        'snow2' => 'eee9e9',
-        'snow3' => 'cdc9c9',
-        'snow4' => '8b8989',
-        'springgreen1' => '00ff7f',
-        'springgreen2' => '00ee76',
-        'springgreen3' => '00cd66',
-        'springgreen4' => '008b45',
-        'steelblue' => '4682b4',
-        'steelblue1' => '63b8ff',
-        'steelblue2' => '5cacee',
-        'steelblue3' => '4f94cd',
-        'steelblue4' => '36648b',
-        'tan' => 'd2b48c',
-        'tan1' => 'ffa54f',
-        'tan2' => 'ee9a49',
-        'tan3' => 'cd853f',
-        'tan4' => '8b5a2b',
-        'teal' => '008080',
-        'thistle' => 'd8bfd8',
-        'thistle1' => 'ffe1ff',
-        'thistle2' => 'eed2ee',
-        'thistle3' => 'cdb5cd',
-        'thistle4' => '8b7b8b',
-        'tomato1' => 'ff6347',
-        'tomato2' => 'ee5c42',
-        'tomato3' => 'cd4f39',
-        'tomato4' => '8b3626',
-        'turquoise' => '40e0d0',
-        'turquoise1' => '00f5ff',
-        'turquoise2' => '00e5ee',
-        'turquoise3' => '00c5cd',
-        'turquoise4' => '00868b',
-        'violet' => 'ee82ee',
-        'violetred' => 'd02090',
-        'violetred1' => 'ff3e96',
-        'violetred2' => 'ee3a8c',
-        'violetred3' => 'cd3278',
-        'violetred4' => '8b2252',
-        'wheat' => 'f5deb3',
-        'wheat1' => 'ffe7ba',
-        'wheat2' => 'eed8ae',
-        'wheat3' => 'cdba96',
-        'wheat4' => '8b7e66',
-        'white' => 'ffffff',
-        'whitesmoke' => 'f5f5f5',
-        'yellow' => 'ffff00',
-        'yellow1' => 'ffff00',
-        'yellow2' => 'eeee00',
-        'yellow3' => 'cdcd00',
-        'yellow4' => '8b8b00',
-        'yellowgreen' => '9acd32',
-    );
-
-    protected $face;
-    protected $size;
-    protected $color;
-
-    protected $bold = false;
-    protected $italic = false;
-    protected $underline = false;
-    protected $superscript = false;
-    protected $subscript = false;
-    protected $strikethrough = false;
-
-    protected $startTagCallbacks = array(
-        'font' => 'startFontTag',
-        'b' => 'startBoldTag',
-        'strong' => 'startBoldTag',
-        'i' => 'startItalicTag',
-        'em' => 'startItalicTag',
-        'u' => 'startUnderlineTag',
-        'ins' => 'startUnderlineTag',
-        'del' => 'startStrikethruTag',
-        'sup' => 'startSuperscriptTag',
-        'sub' => 'startSubscriptTag',
-    );
-
-    protected $endTagCallbacks = array(
-        'font' => 'endFontTag',
-        'b' => 'endBoldTag',
-        'strong' => 'endBoldTag',
-        'i' => 'endItalicTag',
-        'em' => 'endItalicTag',
-        'u' => 'endUnderlineTag',
-        'ins' => 'endUnderlineTag',
-        'del' => 'endStrikethruTag',
-        'sup' => 'endSuperscriptTag',
-        'sub' => 'endSubscriptTag',
-        'br' => 'breakTag',
-        'p' => 'breakTag',
-        'h1' => 'breakTag',
-        'h2' => 'breakTag',
-        'h3' => 'breakTag',
-        'h4' => 'breakTag',
-        'h5' => 'breakTag',
-        'h6' => 'breakTag',
-    );
-
-    protected $stack = array();
-
-    protected $stringData = '';
-
-    protected $richTextObject;
-
-    protected function initialise()
-    {
-        $this->face = $this->size = $this->color = null;
-        $this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
-
-        $this->stack = array();
-
-        $this->stringData = '';
-    }
-
-    public function toRichTextObject($html)
-    {
-        $this->initialise();
-
-        //  Create a new DOM object
-        $dom = new \DOMDocument;
-        //  Load the HTML file into the DOM object
-        //  Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
-        $loaded = @$dom->loadHTML($html);
-
-        //  Discard excess white space
-        $dom->preserveWhiteSpace = false;
-
-        $this->richTextObject = new PHPExcel_RichText();;
-        $this->parseElements($dom);
-
-        // Clean any further spurious whitespace
-        $this->cleanWhitespace();
-
-        return $this->richTextObject;
-    }
-
-    protected function cleanWhitespace()
-    {
-        foreach ($this->richTextObject->getRichTextElements() as $key => $element) {
-            $text = $element->getText();
-            // Trim any leading spaces on the first run
-            if ($key == 0) {
-                $text = ltrim($text);
-            }
-            // Trim any spaces immediately after a line break
-            $text = preg_replace('/\n */mu', "\n", $text);
-            $element->setText($text);
-        }
-    }
-
-    protected function buildTextRun()
-    {
-        $text = $this->stringData;
-        if (trim($text) === '') {
-            return;
-        }
-
-        $richtextRun = $this->richTextObject->createTextRun($this->stringData);
-        if ($this->face) {
-            $richtextRun->getFont()->setName($this->face);
-        }
-        if ($this->size) {
-            $richtextRun->getFont()->setSize($this->size);
-        }
-        if ($this->color) {
-            $richtextRun->getFont()->setColor(new PHPExcel_Style_Color('ff' . $this->color));
-        }
-        if ($this->bold) {
-            $richtextRun->getFont()->setBold(true);
-        }
-        if ($this->italic) {
-            $richtextRun->getFont()->setItalic(true);
-        }
-        if ($this->underline) {
-            $richtextRun->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
-        }
-        if ($this->superscript) {
-            $richtextRun->getFont()->setSuperScript(true);
-        }
-        if ($this->subscript) {
-            $richtextRun->getFont()->setSubScript(true);
-        }
-        if ($this->strikethrough) {
-            $richtextRun->getFont()->setStrikethrough(true);
-        }
-        $this->stringData = '';
-    }
-
-    protected function rgbToColour($rgb)
-    {
-        preg_match_all('/\d+/', $rgb, $values);
-        foreach ($values[0] as &$value) {
-            $value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
-        }
-        return implode($values[0]);
-    }
-
-    protected function colourNameLookup($rgb)
-    {
-        return self::$colourMap[$rgb];
-    }
-
-    protected function startFontTag($tag)
-    {
-        foreach ($tag->attributes as $attribute) {
-            $attributeName = strtolower($attribute->name);
-            $attributeValue = $attribute->value;
-
-            if ($attributeName == 'color') {
-                if (preg_match('/rgb\s*\(/', $attributeValue)) {
-                    $this->$attributeName = $this->rgbToColour($attributeValue);
-                } elseif (strpos(trim($attributeValue), '#') === 0) {
-                    $this->$attributeName = ltrim($attributeValue, '#');
-                } else {
-                    $this->$attributeName = $this->colourNameLookup($attributeValue);
-                }
-            } else {
-                $this->$attributeName = $attributeValue;
-            }
-        }
-    }
-
-    protected function endFontTag()
-    {
-        $this->face = $this->size = $this->color = null;
-    }
-
-    protected function startBoldTag()
-    {
-        $this->bold = true;
-    }
-
-    protected function endBoldTag()
-    {
-        $this->bold = false;
-    }
-
-    protected function startItalicTag()
-    {
-        $this->italic = true;
-    }
-
-    protected function endItalicTag()
-    {
-        $this->italic = false;
-    }
-
-    protected function startUnderlineTag()
-    {
-        $this->underline = true;
-    }
-
-    protected function endUnderlineTag()
-    {
-        $this->underline = false;
-    }
-
-    protected function startSubscriptTag()
-    {
-        $this->subscript = true;
-    }
-
-    protected function endSubscriptTag()
-    {
-        $this->subscript = false;
-    }
-
-    protected function startSuperscriptTag()
-    {
-        $this->superscript = true;
-    }
-
-    protected function endSuperscriptTag()
-    {
-        $this->superscript = false;
-    }
-
-    protected function startStrikethruTag()
-    {
-        $this->strikethrough = true;
-    }
-
-    protected function endStrikethruTag()
-    {
-        $this->strikethrough = false;
-    }
-
-    protected function breakTag()
-    {
-        $this->stringData .= "\n";
-    }
-
-    protected function parseTextNode(DOMText $textNode)
-    {
-        $domText = preg_replace(
-            '/\s+/u',
-            ' ',
-            str_replace(array("\r", "\n"), ' ', $textNode->nodeValue)
-        );
-        $this->stringData .= $domText;
-        $this->buildTextRun();
-    }
-
-    protected function handleCallback($element, $callbackTag, $callbacks)
-    {
-        if (isset($callbacks[$callbackTag])) {
-            $elementHandler = $callbacks[$callbackTag];
-            if (method_exists($this, $elementHandler)) {
-                call_user_func(array($this, $elementHandler), $element);
-            }
-        }
-    }
-
-    protected function parseElementNode(DOMElement $element)
-    {
-        $callbackTag = strtolower($element->nodeName);
-        $this->stack[] = $callbackTag;
-
-        $this->handleCallback($element, $callbackTag, $this->startTagCallbacks);
-
-        $this->parseElements($element);
-        array_pop($this->stack);
-
-        $this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
-    }
-
-    protected function parseElements(DOMNode $element)
-    {
-        foreach ($element->childNodes as $child) {
-            if ($child instanceof DOMText) {
-                $this->parseTextNode($child);
-            } elseif ($child instanceof DOMElement) {
-                $this->parseElementNode($child);
-            }
-        }
-    }
-}

+ 0 - 34
libs/PHPExcel/PHPExcel/IComparable.php

xqd
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * PHPExcel_IComparable
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-interface PHPExcel_IComparable
-{
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode();
-}

+ 0 - 289
libs/PHPExcel/PHPExcel/IOFactory.php

xqd
@@ -1,289 +0,0 @@
-<?php
-
-/**    PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_IOFactory
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_IOFactory
-{
-    /**
-     * Search locations
-     *
-     * @var    array
-     * @access    private
-     * @static
-     */
-    private static $searchLocations = array(
-        array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
-        array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
-    );
-
-    /**
-     * Autoresolve classes
-     *
-     * @var    array
-     * @access    private
-     * @static
-     */
-    private static $autoResolveClasses = array(
-        'Excel2007',
-        'Excel5',
-        'Excel2003XML',
-        'OOCalc',
-        'SYLK',
-        'Gnumeric',
-        'HTML',
-        'CSV',
-    );
-
-    /**
-     *    Private constructor for PHPExcel_IOFactory
-     */
-    private function __construct()
-    {
-    }
-
-    /**
-     * Get search locations
-     *
-     * @static
-     * @access    public
-     * @return    array
-     */
-    public static function getSearchLocations()
-    {
-        return self::$searchLocations;
-    }
-
-    /**
-     * Set search locations
-     *
-     * @static
-     * @access    public
-     * @param    array $value
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function setSearchLocations($value)
-    {
-        if (is_array($value)) {
-            self::$searchLocations = $value;
-        } else {
-            throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
-        }
-    }
-
-    /**
-     * Add search location
-     *
-     * @static
-     * @access    public
-     * @param    string $type        Example: IWriter
-     * @param    string $location    Example: PHPExcel/Writer/{0}.php
-     * @param    string $classname     Example: PHPExcel_Writer_{0}
-     */
-    public static function addSearchLocation($type = '', $location = '', $classname = '')
-    {
-        self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
-    }
-
-    /**
-     * Create PHPExcel_Writer_IWriter
-     *
-     * @static
-     * @access    public
-     * @param    PHPExcel $phpExcel
-     * @param    string  $writerType    Example: Excel2007
-     * @return    PHPExcel_Writer_IWriter
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function createWriter(PHPExcel $phpExcel, $writerType = '')
-    {
-        // Search type
-        $searchType = 'IWriter';
-
-        // Include class
-        foreach (self::$searchLocations as $searchLocation) {
-            if ($searchLocation['type'] == $searchType) {
-                $className = str_replace('{0}', $writerType, $searchLocation['class']);
-
-                $instance = new $className($phpExcel);
-                if ($instance !== null) {
-                    return $instance;
-                }
-            }
-        }
-
-        // Nothing found...
-        throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
-    }
-
-    /**
-     * Create PHPExcel_Reader_IReader
-     *
-     * @static
-     * @access    public
-     * @param    string $readerType    Example: Excel2007
-     * @return    PHPExcel_Reader_IReader
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function createReader($readerType = '')
-    {
-        // Search type
-        $searchType = 'IReader';
-
-        // Include class
-        foreach (self::$searchLocations as $searchLocation) {
-            if ($searchLocation['type'] == $searchType) {
-                $className = str_replace('{0}', $readerType, $searchLocation['class']);
-
-                $instance = new $className();
-                if ($instance !== null) {
-                    return $instance;
-                }
-            }
-        }
-
-        // Nothing found...
-        throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
-    }
-
-    /**
-     * Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution
-     *
-     * @static
-     * @access public
-     * @param     string         $pFilename        The name of the spreadsheet file
-     * @return    PHPExcel
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function load($pFilename)
-    {
-        $reader = self::createReaderForFile($pFilename);
-        return $reader->load($pFilename);
-    }
-
-    /**
-     * Identify file type using automatic PHPExcel_Reader_IReader resolution
-     *
-     * @static
-     * @access public
-     * @param     string         $pFilename        The name of the spreadsheet file to identify
-     * @return    string
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function identify($pFilename)
-    {
-        $reader = self::createReaderForFile($pFilename);
-        $className = get_class($reader);
-        $classType = explode('_', $className);
-        unset($reader);
-        return array_pop($classType);
-    }
-
-    /**
-     * Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution
-     *
-     * @static
-     * @access    public
-     * @param     string         $pFilename        The name of the spreadsheet file
-     * @return    PHPExcel_Reader_IReader
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public static function createReaderForFile($pFilename)
-    {
-        // First, lucky guess by inspecting file extension
-        $pathinfo = pathinfo($pFilename);
-
-        $extensionType = null;
-        if (isset($pathinfo['extension'])) {
-            switch (strtolower($pathinfo['extension'])) {
-                case 'xlsx':            //    Excel (OfficeOpenXML) Spreadsheet
-                case 'xlsm':            //    Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded)
-                case 'xltx':            //    Excel (OfficeOpenXML) Template
-                case 'xltm':            //    Excel (OfficeOpenXML) Macro Template (macros will be discarded)
-                    $extensionType = 'Excel2007';
-                    break;
-                case 'xls':                //    Excel (BIFF) Spreadsheet
-                case 'xlt':                //    Excel (BIFF) Template
-                    $extensionType = 'Excel5';
-                    break;
-                case 'ods':                //    Open/Libre Offic Calc
-                case 'ots':                //    Open/Libre Offic Calc Template
-                    $extensionType = 'OOCalc';
-                    break;
-                case 'slk':
-                    $extensionType = 'SYLK';
-                    break;
-                case 'xml':                //    Excel 2003 SpreadSheetML
-                    $extensionType = 'Excel2003XML';
-                    break;
-                case 'gnumeric':
-                    $extensionType = 'Gnumeric';
-                    break;
-                case 'htm':
-                case 'html':
-                    $extensionType = 'HTML';
-                    break;
-                case 'csv':
-                    // Do nothing
-                    // We must not try to use CSV reader since it loads
-                    // all files including Excel files etc.
-                    break;
-                default:
-                    break;
-            }
-
-            if ($extensionType !== null) {
-                $reader = self::createReader($extensionType);
-                // Let's see if we are lucky
-                if (isset($reader) && $reader->canRead($pFilename)) {
-                    return $reader;
-                }
-            }
-        }
-
-        // If we reach here then "lucky guess" didn't give any result
-        // Try walking through all the options in self::$autoResolveClasses
-        foreach (self::$autoResolveClasses as $autoResolveClass) {
-            //    Ignore our original guess, we know that won't work
-            if ($autoResolveClass !== $extensionType) {
-                $reader = self::createReader($autoResolveClass);
-                if ($reader->canRead($pFilename)) {
-                    return $reader;
-                }
-            }
-        }
-
-        throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
-    }
-}

+ 0 - 249
libs/PHPExcel/PHPExcel/NamedRange.php

xqd
@@ -1,249 +0,0 @@
-<?php
-
-/**
- * PHPExcel_NamedRange
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_NamedRange
-{
-    /**
-     * Range name
-     *
-     * @var string
-     */
-    private $name;
-
-    /**
-     * Worksheet on which the named range can be resolved
-     *
-     * @var PHPExcel_Worksheet
-     */
-    private $worksheet;
-
-    /**
-     * Range of the referenced cells
-     *
-     * @var string
-     */
-    private $range;
-
-    /**
-     * Is the named range local? (i.e. can only be used on $this->worksheet)
-     *
-     * @var bool
-     */
-    private $localOnly;
-
-    /**
-     * Scope
-     *
-     * @var PHPExcel_Worksheet
-     */
-    private $scope;
-
-    /**
-     * Create a new NamedRange
-     *
-     * @param string $pName
-     * @param PHPExcel_Worksheet $pWorksheet
-     * @param string $pRange
-     * @param bool $pLocalOnly
-     * @param PHPExcel_Worksheet|null $pScope    Scope. Only applies when $pLocalOnly = true. Null for global scope.
-     * @throws PHPExcel_Exception
-     */
-    public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
-    {
-        // Validate data
-        if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
-            throw new PHPExcel_Exception('Parameters can not be null.');
-        }
-
-        // Set local members
-        $this->name       = $pName;
-        $this->worksheet  = $pWorksheet;
-        $this->range      = $pRange;
-        $this->localOnly  = $pLocalOnly;
-        $this->scope      = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null;
-    }
-
-    /**
-     * Get name
-     *
-     * @return string
-     */
-    public function getName()
-    {
-        return $this->name;
-    }
-
-    /**
-     * Set name
-     *
-     * @param string $value
-     * @return PHPExcel_NamedRange
-     */
-    public function setName($value = null)
-    {
-        if ($value !== null) {
-            // Old title
-            $oldTitle = $this->name;
-
-            // Re-attach
-            if ($this->worksheet !== null) {
-                $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
-            }
-            $this->name = $value;
-
-            if ($this->worksheet !== null) {
-                $this->worksheet->getParent()->addNamedRange($this);
-            }
-
-            // New title
-            $newTitle = $this->name;
-            PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
-        }
-        return $this;
-    }
-
-    /**
-     * Get worksheet
-     *
-     * @return PHPExcel_Worksheet
-     */
-    public function getWorksheet()
-    {
-        return $this->worksheet;
-    }
-
-    /**
-     * Set worksheet
-     *
-     * @param PHPExcel_Worksheet $value
-     * @return PHPExcel_NamedRange
-     */
-    public function setWorksheet(PHPExcel_Worksheet $value = null)
-    {
-        if ($value !== null) {
-            $this->worksheet = $value;
-        }
-        return $this;
-    }
-
-    /**
-     * Get range
-     *
-     * @return string
-     */
-    public function getRange()
-    {
-        return $this->range;
-    }
-
-    /**
-     * Set range
-     *
-     * @param string $value
-     * @return PHPExcel_NamedRange
-     */
-    public function setRange($value = null)
-    {
-        if ($value !== null) {
-            $this->range = $value;
-        }
-        return $this;
-    }
-
-    /**
-     * Get localOnly
-     *
-     * @return bool
-     */
-    public function getLocalOnly()
-    {
-        return $this->localOnly;
-    }
-
-    /**
-     * Set localOnly
-     *
-     * @param bool $value
-     * @return PHPExcel_NamedRange
-     */
-    public function setLocalOnly($value = false)
-    {
-        $this->localOnly = $value;
-        $this->scope = $value ? $this->worksheet : null;
-        return $this;
-    }
-
-    /**
-     * Get scope
-     *
-     * @return PHPExcel_Worksheet|null
-     */
-    public function getScope()
-    {
-        return $this->scope;
-    }
-
-    /**
-     * Set scope
-     *
-     * @param PHPExcel_Worksheet|null $value
-     * @return PHPExcel_NamedRange
-     */
-    public function setScope(PHPExcel_Worksheet $value = null)
-    {
-        $this->scope = $value;
-        $this->localOnly = ($value == null) ? false : true;
-        return $this;
-    }
-
-    /**
-     * Resolve a named range to a regular cell range
-     *
-     * @param string $pNamedRange Named range
-     * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
-     * @return PHPExcel_NamedRange
-     */
-    public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
-    {
-        return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 289
libs/PHPExcel/PHPExcel/Reader/Abstract.php

xqd
@@ -1,289 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_Abstract
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Read data only?
-     * Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
-     *        or whether it should read both data and formatting
-     *
-     * @var    boolean
-     */
-    protected $readDataOnly = false;
-
-    /**
-     * Read empty cells?
-     * Identifies whether the Reader should read data values for cells all cells, or should ignore cells containing
-     *         null value or empty string
-     *
-     * @var    boolean
-     */
-    protected $readEmptyCells = true;
-
-    /**
-     * Read charts that are defined in the workbook?
-     * Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
-     *
-     * @var    boolean
-     */
-    protected $includeCharts = false;
-
-    /**
-     * Restrict which sheets should be loaded?
-     * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
-     *
-     * @var array of string
-     */
-    protected $loadSheetsOnly;
-
-    /**
-     * PHPExcel_Reader_IReadFilter instance
-     *
-     * @var PHPExcel_Reader_IReadFilter
-     */
-    protected $readFilter;
-
-    protected $fileHandle = null;
-
-
-    /**
-     * Read data only?
-     *        If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
-     *        If false (the default) it will read data and formatting.
-     *
-     * @return    boolean
-     */
-    public function getReadDataOnly()
-    {
-        return $this->readDataOnly;
-    }
-
-    /**
-     * Set read data only
-     *        Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
-     *        Set to false (the default) to advise the Reader to read both data and formatting for cells.
-     *
-     * @param    boolean    $pValue
-     *
-     * @return    PHPExcel_Reader_IReader
-     */
-    public function setReadDataOnly($pValue = false)
-    {
-        $this->readDataOnly = $pValue;
-        return $this;
-    }
-
-    /**
-     * Read empty cells?
-     *        If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
-     *        If false it will not read data for cells containing a null value or an empty string.
-     *
-     * @return    boolean
-     */
-    public function getReadEmptyCells()
-    {
-        return $this->readEmptyCells;
-    }
-
-    /**
-     * Set read empty cells
-     *        Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
-     *        Set to false to advise the Reader to ignore cells containing a null value or an empty string.
-     *
-     * @param    boolean    $pValue
-     *
-     * @return    PHPExcel_Reader_IReader
-     */
-    public function setReadEmptyCells($pValue = true)
-    {
-        $this->readEmptyCells = $pValue;
-        return $this;
-    }
-
-    /**
-     * Read charts in workbook?
-     *        If this is true, then the Reader will include any charts that exist in the workbook.
-     *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
-     *        If false (the default) it will ignore any charts defined in the workbook file.
-     *
-     * @return    boolean
-     */
-    public function getIncludeCharts()
-    {
-        return $this->includeCharts;
-    }
-
-    /**
-     * Set read charts in workbook
-     *        Set to true, to advise the Reader to include any charts that exist in the workbook.
-     *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
-     *        Set to false (the default) to discard charts.
-     *
-     * @param    boolean    $pValue
-     *
-     * @return    PHPExcel_Reader_IReader
-     */
-    public function setIncludeCharts($pValue = false)
-    {
-        $this->includeCharts = (boolean) $pValue;
-        return $this;
-    }
-
-    /**
-     * Get which sheets to load
-     * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
-     *        indicating that all worksheets in the workbook should be loaded.
-     *
-     * @return mixed
-     */
-    public function getLoadSheetsOnly()
-    {
-        return $this->loadSheetsOnly;
-    }
-
-    /**
-     * Set which sheets to load
-     *
-     * @param mixed $value
-     *        This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
-     *        If NULL, then it tells the Reader to read all worksheets in the workbook
-     *
-     * @return PHPExcel_Reader_IReader
-     */
-    public function setLoadSheetsOnly($value = null)
-    {
-        if ($value === null) {
-            return $this->setLoadAllSheets();
-        }
-
-        $this->loadSheetsOnly = is_array($value) ? $value : array($value);
-        return $this;
-    }
-
-    /**
-     * Set all sheets to load
-     *        Tells the Reader to load all worksheets from the workbook.
-     *
-     * @return PHPExcel_Reader_IReader
-     */
-    public function setLoadAllSheets()
-    {
-        $this->loadSheetsOnly = null;
-        return $this;
-    }
-
-    /**
-     * Read filter
-     *
-     * @return PHPExcel_Reader_IReadFilter
-     */
-    public function getReadFilter()
-    {
-        return $this->readFilter;
-    }
-
-    /**
-     * Set read filter
-     *
-     * @param PHPExcel_Reader_IReadFilter $pValue
-     * @return PHPExcel_Reader_IReader
-     */
-    public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue)
-    {
-        $this->readFilter = $pValue;
-        return $this;
-    }
-
-    /**
-     * Open file for reading
-     *
-     * @param string $pFilename
-     * @throws    PHPExcel_Reader_Exception
-     * @return resource
-     */
-    protected function openFile($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename) || !is_readable($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        // Open file
-        $this->fileHandle = fopen($pFilename, 'r');
-        if ($this->fileHandle === false) {
-            throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
-        }
-    }
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-        // Check if file exists
-        try {
-            $this->openFile($pFilename);
-        } catch (Exception $e) {
-            return false;
-        }
-
-        $readable = $this->isValidFormat();
-        fclose($this->fileHandle);
-        return $readable;
-    }
-
-    /**
-     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
-     *
-     * @param     string         $xml
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function securityScan($xml)
-    {
-        $pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
-        if (preg_match($pattern, $xml)) {
-            throw new PHPExcel_Reader_Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
-        }
-        return $xml;
-    }
-
-    /**
-     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
-     *
-     * @param     string         $filestream
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function securityScanFile($filestream)
-    {
-        return $this->securityScan(file_get_contents($filestream));
-    }
-}

+ 0 - 406
libs/PHPExcel/PHPExcel/Reader/CSV.php

xqd
@@ -1,406 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_CSV
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Input encoding
-     *
-     * @access    private
-     * @var    string
-     */
-    private $inputEncoding = 'UTF-8';
-
-    /**
-     * Delimiter
-     *
-     * @access    private
-     * @var string
-     */
-    private $delimiter = ',';
-
-    /**
-     * Enclosure
-     *
-     * @access    private
-     * @var    string
-     */
-    private $enclosure = '"';
-
-    /**
-     * Sheet index to read
-     *
-     * @access    private
-     * @var    int
-     */
-    private $sheetIndex = 0;
-
-    /**
-     * Load rows contiguously
-     *
-     * @access    private
-     * @var    int
-     */
-    private $contiguous = false;
-
-    /**
-     * Row counter for loading rows contiguously
-     *
-     * @var    int
-     */
-    private $contiguousRow = -1;
-
-
-    /**
-     * Create a new PHPExcel_Reader_CSV
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-    /**
-     * Validate that the current file is a CSV file
-     *
-     * @return boolean
-     */
-    protected function isValidFormat()
-    {
-        return true;
-    }
-
-    /**
-     * Set input encoding
-     *
-     * @param string $pValue Input encoding
-     */
-    public function setInputEncoding($pValue = 'UTF-8')
-    {
-        $this->inputEncoding = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get input encoding
-     *
-     * @return string
-     */
-    public function getInputEncoding()
-    {
-        return $this->inputEncoding;
-    }
-
-    /**
-     * Move filepointer past any BOM marker
-     *
-     */
-    protected function skipBOM()
-    {
-        rewind($this->fileHandle);
-
-        switch ($this->inputEncoding) {
-            case 'UTF-8':
-                fgets($this->fileHandle, 4) == "\xEF\xBB\xBF" ?
-                    fseek($this->fileHandle, 3) : fseek($this->fileHandle, 0);
-                break;
-            case 'UTF-16LE':
-                fgets($this->fileHandle, 3) == "\xFF\xFE" ?
-                    fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0);
-                break;
-            case 'UTF-16BE':
-                fgets($this->fileHandle, 3) == "\xFE\xFF" ?
-                    fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0);
-                break;
-            case 'UTF-32LE':
-                fgets($this->fileHandle, 5) == "\xFF\xFE\x00\x00" ?
-                    fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0);
-                break;
-            case 'UTF-32BE':
-                fgets($this->fileHandle, 5) == "\x00\x00\xFE\xFF" ?
-                    fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0);
-                break;
-            default:
-                break;
-        }
-    }
-
-    /**
-     * Identify any separator that is explicitly set in the file
-     *
-     */
-    protected function checkSeparator()
-    {
-        $line = fgets($this->fileHandle);
-        if ($line === false) {
-            return;
-        }
-
-        if ((strlen(trim($line, "\r\n")) == 5) && (stripos($line, 'sep=') === 0)) {
-            $this->delimiter = substr($line, 4, 1);
-            return;
-        }
-        return $this->skipBOM();
-    }
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param     string         $pFilename
-     * @throws    PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Open file
-        $this->openFile($pFilename);
-        if (!$this->isValidFormat()) {
-            fclose($this->fileHandle);
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-        $fileHandle = $this->fileHandle;
-
-        // Skip BOM, if any
-        $this->skipBOM();
-        $this->checkSeparator();
-
-        $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );
-
-        $worksheetInfo = array();
-        $worksheetInfo[0]['worksheetName'] = 'Worksheet';
-        $worksheetInfo[0]['lastColumnLetter'] = 'A';
-        $worksheetInfo[0]['lastColumnIndex'] = 0;
-        $worksheetInfo[0]['totalRows'] = 0;
-        $worksheetInfo[0]['totalColumns'] = 0;
-
-        // Loop through each line of the file in turn
-        while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
-            $worksheetInfo[0]['totalRows']++;
-            $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
-        }
-
-        $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
-        $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
-
-        // Close file
-        fclose($fileHandle);
-
-        return $worksheetInfo;
-    }
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return PHPExcel
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param     string         $pFilename
-     * @param    PHPExcel    $objPHPExcel
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        $lineEnding = ini_get('auto_detect_line_endings');
-        ini_set('auto_detect_line_endings', true);
-
-        // Open file
-        $this->openFile($pFilename);
-        if (!$this->isValidFormat()) {
-            fclose($this->fileHandle);
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-        $fileHandle = $this->fileHandle;
-
-        // Skip BOM, if any
-        $this->skipBOM();
-        $this->checkSeparator();
-
-        // Create new PHPExcel object
-        while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
-            $objPHPExcel->createSheet();
-        }
-        $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
-
-        $escapeEnclosures = array( "\\" . $this->enclosure,
-                                   $this->enclosure . $this->enclosure
-                                 );
-
-        // Set our starting row based on whether we're in contiguous mode or not
-        $currentRow = 1;
-        if ($this->contiguous) {
-            $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow;
-        }
-
-        // Loop through each line of the file in turn
-        while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
-            $columnLetter = 'A';
-            foreach ($rowData as $rowDatum) {
-                if ($rowDatum != '' && $this->readFilter->readCell($columnLetter, $currentRow)) {
-                    // Unescape enclosures
-                    $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum);
-
-                    // Convert encoding if necessary
-                    if ($this->inputEncoding !== 'UTF-8') {
-                        $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
-                    }
-
-                    // Set cell value
-                    $sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum);
-                }
-                ++$columnLetter;
-            }
-            ++$currentRow;
-        }
-
-        // Close file
-        fclose($fileHandle);
-
-        if ($this->contiguous) {
-            $this->contiguousRow = $currentRow;
-        }
-
-        ini_set('auto_detect_line_endings', $lineEnding);
-
-        // Return
-        return $objPHPExcel;
-    }
-
-    /**
-     * Get delimiter
-     *
-     * @return string
-     */
-    public function getDelimiter()
-    {
-        return $this->delimiter;
-    }
-
-    /**
-     * Set delimiter
-     *
-     * @param    string    $pValue        Delimiter, defaults to ,
-     * @return    PHPExcel_Reader_CSV
-     */
-    public function setDelimiter($pValue = ',')
-    {
-        $this->delimiter = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get enclosure
-     *
-     * @return string
-     */
-    public function getEnclosure()
-    {
-        return $this->enclosure;
-    }
-
-    /**
-     * Set enclosure
-     *
-     * @param    string    $pValue        Enclosure, defaults to "
-     * @return PHPExcel_Reader_CSV
-     */
-    public function setEnclosure($pValue = '"')
-    {
-        if ($pValue == '') {
-            $pValue = '"';
-        }
-        $this->enclosure = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get sheet index
-     *
-     * @return integer
-     */
-    public function getSheetIndex()
-    {
-        return $this->sheetIndex;
-    }
-
-    /**
-     * Set sheet index
-     *
-     * @param    integer        $pValue        Sheet index
-     * @return PHPExcel_Reader_CSV
-     */
-    public function setSheetIndex($pValue = 0)
-    {
-        $this->sheetIndex = $pValue;
-        return $this;
-    }
-
-    /**
-     * Set Contiguous
-     *
-     * @param boolean $contiguous
-     */
-    public function setContiguous($contiguous = false)
-    {
-        $this->contiguous = (bool) $contiguous;
-        if (!$contiguous) {
-            $this->contiguousRow = -1;
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get Contiguous
-     *
-     * @return boolean
-     */
-    public function getContiguous()
-    {
-        return $this->contiguous;
-    }
-}

+ 0 - 51
libs/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php

xqd
@@ -1,51 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_DefaultReadFilter
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
-{
-    /**
-     * Should this cell be read?
-     *
-     * @param    $column           Column address (as a string value like "A", or "IV")
-     * @param    $row              Row number
-     * @param    $worksheetName    Optional worksheet name
-     * @return   boolean
-     */
-    public function readCell($column, $row, $worksheetName = '')
-    {
-        return true;
-    }
-}

+ 0 - 801
libs/PHPExcel/PHPExcel/Reader/Excel2003XML.php

xqd
@@ -1,801 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_Excel2003XML
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Formats
-     *
-     * @var array
-     */
-    protected $styles = array();
-
-    /**
-     * Character set used in the file
-     *
-     * @var string
-     */
-    protected $charSet = 'UTF-8';
-
-    /**
-     * Create a new PHPExcel_Reader_Excel2003XML
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-
-        //    Office                    xmlns:o="urn:schemas-microsoft-com:office:office"
-        //    Excel                    xmlns:x="urn:schemas-microsoft-com:office:excel"
-        //    XML Spreadsheet            xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
-        //    Spreadsheet component    xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
-        //    XML schema                 xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
-        //    XML data type            xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
-        //    MS-persist recordset    xmlns:rs="urn:schemas-microsoft-com:rowset"
-        //    Rowset                    xmlns:z="#RowsetSchema"
-        //
-
-        $signature = array(
-                '<?xml version="1.0"',
-                '<?mso-application progid="Excel.Sheet"?>'
-            );
-
-        // Open file
-        $this->openFile($pFilename);
-        $fileHandle = $this->fileHandle;
-        
-        // Read sample data (first 2 KB will do)
-        $data = fread($fileHandle, 2048);
-        fclose($fileHandle);
-
-        $valid = true;
-        foreach ($signature as $match) {
-            // every part of the signature must be present
-            if (strpos($data, $match) === false) {
-                $valid = false;
-                break;
-            }
-        }
-
-        //    Retrieve charset encoding
-        if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
-            $this->charSet = strtoupper($matches[1]);
-        }
-//        echo 'Character Set is ', $this->charSet,'<br />';
-
-        return $valid;
-    }
-
-
-    /**
-     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
-     *
-     * @param     string         $pFilename
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function listWorksheetNames($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-        if (!$this->canRead($pFilename)) {
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-
-        $worksheetNames = array();
-
-        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespaces = $xml->getNamespaces(true);
-
-        $xml_ss = $xml->children($namespaces['ss']);
-        foreach ($xml_ss->Worksheet as $worksheet) {
-            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
-            $worksheetNames[] = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
-        }
-
-        return $worksheetNames;
-    }
-
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetInfo = array();
-
-        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespaces = $xml->getNamespaces(true);
-
-        $worksheetID = 1;
-        $xml_ss = $xml->children($namespaces['ss']);
-        foreach ($xml_ss->Worksheet as $worksheet) {
-            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
-
-            $tmpInfo = array();
-            $tmpInfo['worksheetName'] = '';
-            $tmpInfo['lastColumnLetter'] = 'A';
-            $tmpInfo['lastColumnIndex'] = 0;
-            $tmpInfo['totalRows'] = 0;
-            $tmpInfo['totalColumns'] = 0;
-
-            if (isset($worksheet_ss['Name'])) {
-                $tmpInfo['worksheetName'] = (string) $worksheet_ss['Name'];
-            } else {
-                $tmpInfo['worksheetName'] = "Worksheet_{$worksheetID}";
-            }
-
-            if (isset($worksheet->Table->Row)) {
-                $rowIndex = 0;
-
-                foreach ($worksheet->Table->Row as $rowData) {
-                    $columnIndex = 0;
-                    $rowHasData = false;
-
-                    foreach ($rowData->Cell as $cell) {
-                        if (isset($cell->Data)) {
-                            $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
-                            $rowHasData = true;
-                        }
-
-                        ++$columnIndex;
-                    }
-
-                    ++$rowIndex;
-
-                    if ($rowHasData) {
-                        $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
-                    }
-                }
-            }
-
-            $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-            $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
-
-            $worksheetInfo[] = $tmpInfo;
-            ++$worksheetID;
-        }
-
-        return $worksheetInfo;
-    }
-
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-        $objPHPExcel->removeSheetByIndex(0);
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
-    {
-        $styleAttributeValue = strtolower($styleAttributeValue);
-        foreach ($styleList as $style) {
-            if ($styleAttributeValue == strtolower($style)) {
-                $styleAttributeValue = $style;
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * pixel units to excel width units(units of 1/256th of a character width)
-     * @param pxs
-     * @return
-     */
-    protected static function pixel2WidthUnits($pxs)
-    {
-        $UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
-
-        $widthUnits = 256 * ($pxs / 7);
-        $widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
-        return $widthUnits;
-    }
-
-    /**
-     * excel width units(units of 1/256th of a character width) to pixel units
-     * @param widthUnits
-     * @return
-     */
-    protected static function widthUnits2Pixel($widthUnits)
-    {
-        $pixels = ($widthUnits / 256) * 7;
-        $offsetWidthUnits = $widthUnits % 256;
-        $pixels += round($offsetWidthUnits / (256 / 7));
-        return $pixels;
-    }
-
-    protected static function hex2str($hex)
-    {
-        return chr(hexdec($hex[1]));
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param     string         $pFilename
-     * @param    PHPExcel    $objPHPExcel
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        $fromFormats    = array('\-', '\ ');
-        $toFormats      = array('-', ' ');
-
-        $underlineStyles = array (
-            PHPExcel_Style_Font::UNDERLINE_NONE,
-            PHPExcel_Style_Font::UNDERLINE_DOUBLE,
-            PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING,
-            PHPExcel_Style_Font::UNDERLINE_SINGLE,
-            PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING
-        );
-        $verticalAlignmentStyles = array (
-            PHPExcel_Style_Alignment::VERTICAL_BOTTOM,
-            PHPExcel_Style_Alignment::VERTICAL_TOP,
-            PHPExcel_Style_Alignment::VERTICAL_CENTER,
-            PHPExcel_Style_Alignment::VERTICAL_JUSTIFY
-        );
-        $horizontalAlignmentStyles = array (
-            PHPExcel_Style_Alignment::HORIZONTAL_GENERAL,
-            PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
-            PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
-            PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
-            PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS,
-            PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY
-        );
-
-        $timezoneObj = new DateTimeZone('Europe/London');
-        $GMT = new DateTimeZone('UTC');
-
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        if (!$this->canRead($pFilename)) {
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-
-        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespaces = $xml->getNamespaces(true);
-
-        $docProps = $objPHPExcel->getProperties();
-        if (isset($xml->DocumentProperties[0])) {
-            foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
-                switch ($propertyName) {
-                    case 'Title':
-                        $docProps->setTitle(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Subject':
-                        $docProps->setSubject(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Author':
-                        $docProps->setCreator(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Created':
-                        $creationDate = strtotime($propertyValue);
-                        $docProps->setCreated($creationDate);
-                        break;
-                    case 'LastAuthor':
-                        $docProps->setLastModifiedBy(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'LastSaved':
-                        $lastSaveDate = strtotime($propertyValue);
-                        $docProps->setModified($lastSaveDate);
-                        break;
-                    case 'Company':
-                        $docProps->setCompany(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Category':
-                        $docProps->setCategory(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Manager':
-                        $docProps->setManager(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Keywords':
-                        $docProps->setKeywords(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                    case 'Description':
-                        $docProps->setDescription(self::convertStringEncoding($propertyValue, $this->charSet));
-                        break;
-                }
-            }
-        }
-        if (isset($xml->CustomDocumentProperties)) {
-            foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
-                $propertyAttributes = $propertyValue->attributes($namespaces['dt']);
-                $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::hex2str', $propertyName);
-                $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
-                switch ((string) $propertyAttributes) {
-                    case 'string':
-                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
-                        $propertyValue = trim($propertyValue);
-                        break;
-                    case 'boolean':
-                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
-                        $propertyValue = (bool) $propertyValue;
-                        break;
-                    case 'integer':
-                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
-                        $propertyValue = intval($propertyValue);
-                        break;
-                    case 'float':
-                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
-                        $propertyValue = floatval($propertyValue);
-                        break;
-                    case 'dateTime.tz':
-                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
-                        $propertyValue = strtotime(trim($propertyValue));
-                        break;
-                }
-                $docProps->setCustomProperty($propertyName, $propertyValue, $propertyType);
-            }
-        }
-
-        foreach ($xml->Styles[0] as $style) {
-            $style_ss = $style->attributes($namespaces['ss']);
-            $styleID = (string) $style_ss['ID'];
-//            echo 'Style ID = '.$styleID.'<br />';
-            $this->styles[$styleID] = (isset($this->styles['Default'])) ? $this->styles['Default'] : array();
-            foreach ($style as $styleType => $styleData) {
-                $styleAttributes = $styleData->attributes($namespaces['ss']);
-//                echo $styleType.'<br />';
-                switch ($styleType) {
-                    case 'Alignment':
-                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
-//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
-                            $styleAttributeValue = (string) $styleAttributeValue;
-                            switch ($styleAttributeKey) {
-                                case 'Vertical':
-                                    if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
-                                        $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
-                                    }
-                                    break;
-                                case 'Horizontal':
-                                    if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
-                                        $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
-                                    }
-                                    break;
-                                case 'WrapText':
-                                    $this->styles[$styleID]['alignment']['wrap'] = true;
-                                    break;
-                            }
-                        }
-                        break;
-                    case 'Borders':
-                        foreach ($styleData->Border as $borderStyle) {
-                            $borderAttributes = $borderStyle->attributes($namespaces['ss']);
-                            $thisBorder = array();
-                            foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
-//                                    echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
-                                switch ($borderStyleKey) {
-                                    case 'LineStyle':
-                                        $thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
-//                                                $thisBorder['style'] = $borderStyleValue;
-                                        break;
-                                    case 'Weight':
-//                                                $thisBorder['style'] = $borderStyleValue;
-                                        break;
-                                    case 'Position':
-                                        $borderPosition = strtolower($borderStyleValue);
-                                        break;
-                                    case 'Color':
-                                        $borderColour = substr($borderStyleValue, 1);
-                                        $thisBorder['color']['rgb'] = $borderColour;
-                                        break;
-                                }
-                            }
-                            if (!empty($thisBorder)) {
-                                if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
-                                    $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder;
-                                }
-                            }
-                        }
-                        break;
-                    case 'Font':
-                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
-//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
-                            $styleAttributeValue = (string) $styleAttributeValue;
-                            switch ($styleAttributeKey) {
-                                case 'FontName':
-                                    $this->styles[$styleID]['font']['name'] = $styleAttributeValue;
-                                    break;
-                                case 'Size':
-                                    $this->styles[$styleID]['font']['size'] = $styleAttributeValue;
-                                    break;
-                                case 'Color':
-                                    $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
-                                    break;
-                                case 'Bold':
-                                    $this->styles[$styleID]['font']['bold'] = true;
-                                    break;
-                                case 'Italic':
-                                    $this->styles[$styleID]['font']['italic'] = true;
-                                    break;
-                                case 'Underline':
-                                    if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
-                                        $this->styles[$styleID]['font']['underline'] = $styleAttributeValue;
-                                    }
-                                    break;
-                            }
-                        }
-                        break;
-                    case 'Interior':
-                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
-//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
-                            switch ($styleAttributeKey) {
-                                case 'Color':
-                                    $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
-                                    break;
-                            }
-                        }
-                        break;
-                    case 'NumberFormat':
-                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
-//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
-                            $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
-                            switch ($styleAttributeValue) {
-                                case 'Short Date':
-                                    $styleAttributeValue = 'dd/mm/yyyy';
-                                    break;
-                            }
-                            if ($styleAttributeValue > '') {
-                                $this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
-                            }
-                        }
-                        break;
-                    case 'Protection':
-                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
-//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
-                        }
-                        break;
-                }
-            }
-//            print_r($this->styles[$styleID]);
-//            echo '<hr />';
-        }
-//        echo '<hr />';
-
-        $worksheetID = 0;
-        $xml_ss = $xml->children($namespaces['ss']);
-
-        foreach ($xml_ss->Worksheet as $worksheet) {
-            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
-
-            if ((isset($this->loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
-                (!in_array($worksheet_ss['Name'], $this->loadSheetsOnly))) {
-                continue;
-            }
-
-//            echo '<h3>Worksheet: ', $worksheet_ss['Name'],'<h3>';
-//
-            // Create new Worksheet
-            $objPHPExcel->createSheet();
-            $objPHPExcel->setActiveSheetIndex($worksheetID);
-            if (isset($worksheet_ss['Name'])) {
-                $worksheetName = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
-                //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
-                //        formula cells... during the load, all formulae should be correct, and we're simply bringing
-                //        the worksheet name in line with the formula, not the reverse
-                $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
-            }
-
-            $columnID = 'A';
-            if (isset($worksheet->Table->Column)) {
-                foreach ($worksheet->Table->Column as $columnData) {
-                    $columnData_ss = $columnData->attributes($namespaces['ss']);
-                    if (isset($columnData_ss['Index'])) {
-                        $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
-                    }
-                    if (isset($columnData_ss['Width'])) {
-                        $columnWidth = $columnData_ss['Width'];
-//                        echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
-                        $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
-                    }
-                    ++$columnID;
-                }
-            }
-
-            $rowID = 1;
-            if (isset($worksheet->Table->Row)) {
-                $additionalMergedCells = 0;
-                foreach ($worksheet->Table->Row as $rowData) {
-                    $rowHasData = false;
-                    $row_ss = $rowData->attributes($namespaces['ss']);
-                    if (isset($row_ss['Index'])) {
-                        $rowID = (integer) $row_ss['Index'];
-                    }
-//                    echo '<b>Row '.$rowID.'</b><br />';
-
-                    $columnID = 'A';
-                    foreach ($rowData->Cell as $cell) {
-                        $cell_ss = $cell->attributes($namespaces['ss']);
-                        if (isset($cell_ss['Index'])) {
-                            $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
-                        }
-                        $cellRange = $columnID.$rowID;
-
-                        if ($this->getReadFilter() !== null) {
-                            if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
-                                continue;
-                            }
-                        }
-
-                        if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
-                            $columnTo = $columnID;
-                            if (isset($cell_ss['MergeAcross'])) {
-                                $additionalMergedCells += (int)$cell_ss['MergeAcross'];
-                                $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
-                            }
-                            $rowTo = $rowID;
-                            if (isset($cell_ss['MergeDown'])) {
-                                $rowTo = $rowTo + $cell_ss['MergeDown'];
-                            }
-                            $cellRange .= ':'.$columnTo.$rowTo;
-                            $objPHPExcel->getActiveSheet()->mergeCells($cellRange);
-                        }
-
-                        $cellIsSet = $hasCalculatedValue = false;
-                        $cellDataFormula = '';
-                        if (isset($cell_ss['Formula'])) {
-                            $cellDataFormula = $cell_ss['Formula'];
-                            // added this as a check for array formulas
-                            if (isset($cell_ss['ArrayRange'])) {
-                                $cellDataCSEFormula = $cell_ss['ArrayRange'];
-//                                echo "found an array formula at ".$columnID.$rowID."<br />";
-                            }
-                            $hasCalculatedValue = true;
-                        }
-                        if (isset($cell->Data)) {
-                            $cellValue = $cellData = $cell->Data;
-                            $type = PHPExcel_Cell_DataType::TYPE_NULL;
-                            $cellData_ss = $cellData->attributes($namespaces['ss']);
-                            if (isset($cellData_ss['Type'])) {
-                                $cellDataType = $cellData_ss['Type'];
-                                switch ($cellDataType) {
-                                    /*
-                                    const TYPE_STRING        = 's';
-                                    const TYPE_FORMULA        = 'f';
-                                    const TYPE_NUMERIC        = 'n';
-                                    const TYPE_BOOL            = 'b';
-                                    const TYPE_NULL            = 'null';
-                                    const TYPE_INLINE        = 'inlineStr';
-                                    const TYPE_ERROR        = 'e';
-                                    */
-                                    case 'String':
-                                        $cellValue = self::convertStringEncoding($cellValue, $this->charSet);
-                                        $type = PHPExcel_Cell_DataType::TYPE_STRING;
-                                        break;
-                                    case 'Number':
-                                        $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                        $cellValue = (float) $cellValue;
-                                        if (floor($cellValue) == $cellValue) {
-                                            $cellValue = (integer) $cellValue;
-                                        }
-                                        break;
-                                    case 'Boolean':
-                                        $type = PHPExcel_Cell_DataType::TYPE_BOOL;
-                                        $cellValue = ($cellValue != 0);
-                                        break;
-                                    case 'DateTime':
-                                        $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                        $cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
-                                        break;
-                                    case 'Error':
-                                        $type = PHPExcel_Cell_DataType::TYPE_ERROR;
-                                        break;
-                                }
-                            }
-
-                            if ($hasCalculatedValue) {
-//                                echo 'FORMULA<br />';
-                                $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
-                                $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
-                                if (substr($cellDataFormula, 0, 3) == 'of:') {
-                                    $cellDataFormula = substr($cellDataFormula, 3);
-//                                    echo 'Before: ', $cellDataFormula,'<br />';
-                                    $temp = explode('"', $cellDataFormula);
-                                    $key = false;
-                                    foreach ($temp as &$value) {
-                                        //    Only replace in alternate array entries (i.e. non-quoted blocks)
-                                        if ($key = !$key) {
-                                            $value = str_replace(array('[.', '.', ']'), '', $value);
-                                        }
-                                    }
-                                } else {
-                                    //    Convert R1C1 style references to A1 style references (but only when not quoted)
-//                                    echo 'Before: ', $cellDataFormula,'<br />';
-                                    $temp = explode('"', $cellDataFormula);
-                                    $key = false;
-                                    foreach ($temp as &$value) {
-                                        //    Only replace in alternate array entries (i.e. non-quoted blocks)
-                                        if ($key = !$key) {
-                                            preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE);
-                                            //    Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
-                                            //        through the formula from left to right. Reversing means that we work right to left.through
-                                            //        the formula
-                                            $cellReferences = array_reverse($cellReferences);
-                                            //    Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
-                                            //        then modify the formula to use that new reference
-                                            foreach ($cellReferences as $cellReference) {
-                                                $rowReference = $cellReference[2][0];
-                                                //    Empty R reference is the current row
-                                                if ($rowReference == '') {
-                                                    $rowReference = $rowID;
-                                                }
-                                                //    Bracketed R references are relative to the current row
-                                                if ($rowReference{0} == '[') {
-                                                    $rowReference = $rowID + trim($rowReference, '[]');
-                                                }
-                                                $columnReference = $cellReference[4][0];
-                                                //    Empty C reference is the current column
-                                                if ($columnReference == '') {
-                                                    $columnReference = $columnNumber;
-                                                }
-                                                //    Bracketed C references are relative to the current column
-                                                if ($columnReference{0} == '[') {
-                                                    $columnReference = $columnNumber + trim($columnReference, '[]');
-                                                }
-                                                $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
-                                                $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
-                                            }
-                                        }
-                                    }
-                                }
-                                unset($value);
-                                //    Then rebuild the formula string
-                                $cellDataFormula = implode('"', $temp);
-//                                echo 'After: ', $cellDataFormula,'<br />';
-                            }
-
-//                            echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
-//
-                            $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type);
-                            if ($hasCalculatedValue) {
-//                                echo 'Formula result is '.$cellValue.'<br />';
-                                $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
-                            }
-                            $cellIsSet = $rowHasData = true;
-                        }
-
-                        if (isset($cell->Comment)) {
-//                            echo '<b>comment found</b><br />';
-                            $commentAttributes = $cell->Comment->attributes($namespaces['ss']);
-                            $author = 'unknown';
-                            if (isset($commentAttributes->Author)) {
-                                $author = (string)$commentAttributes->Author;
-//                                echo 'Author: ', $author,'<br />';
-                            }
-                            $node = $cell->Comment->Data->asXML();
-//                            $annotation = str_replace('html:','',substr($node,49,-10));
-//                            echo $annotation,'<br />';
-                            $annotation = strip_tags($node);
-//                            echo 'Annotation: ', $annotation,'<br />';
-                            $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation));
-                        }
-
-                        if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
-                            $style = (string) $cell_ss['StyleID'];
-//                            echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
-                            if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
-//                                echo 'Cell '.$columnID.$rowID.'<br />';
-//                                print_r($this->styles[$style]);
-//                                echo '<br />';
-                                if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
-                                    $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
-                                }
-                                $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]);
-                            }
-                        }
-                        ++$columnID;
-                        while ($additionalMergedCells > 0) {
-                            ++$columnID;
-                            $additionalMergedCells--;
-                        }
-                    }
-
-                    if ($rowHasData) {
-                        if (isset($row_ss['StyleID'])) {
-                            $rowStyle = $row_ss['StyleID'];
-                        }
-                        if (isset($row_ss['Height'])) {
-                            $rowHeight = $row_ss['Height'];
-//                            echo '<b>Setting row height to '.$rowHeight.'</b><br />';
-                            $objPHPExcel->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
-                        }
-                    }
-
-                    ++$rowID;
-                }
-            }
-            ++$worksheetID;
-        }
-
-        // Return
-        return $objPHPExcel;
-    }
-
-
-    protected static function convertStringEncoding($string, $charset)
-    {
-        if ($charset != 'UTF-8') {
-            return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset);
-        }
-        return $string;
-    }
-
-
-    protected function parseRichText($is = '')
-    {
-        $value = new PHPExcel_RichText();
-
-        $value->createText(self::convertStringEncoding($is, $this->charSet));
-
-        return $value;
-    }
-}

+ 0 - 2051
libs/PHPExcel/PHPExcel/Reader/Excel2007.php

xqd
@@ -1,2051 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_Excel2007
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * PHPExcel_ReferenceHelper instance
-     *
-     * @var PHPExcel_ReferenceHelper
-     */
-    private $referenceHelper = null;
-
-    /**
-     * PHPExcel_Reader_Excel2007_Theme instance
-     *
-     * @var PHPExcel_Reader_Excel2007_Theme
-     */
-    private static $theme = null;
-
-    /**
-     * Create a new PHPExcel_Reader_Excel2007 instance
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-        $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
-    }
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        // Check if zip class exists
-//        if (!class_exists($zipClass, false)) {
-//            throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
-//        }
-
-        $xl = false;
-        // Load file
-        $zip = new $zipClass;
-        if ($zip->open($pFilename) === true) {
-            // check if it is an OOXML archive
-            $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-            if ($rels !== false) {
-                foreach ($rels->Relationship as $rel) {
-                    switch ($rel["Type"]) {
-                        case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
-                            if (basename($rel["Target"]) == 'workbook.xml') {
-                                $xl = true;
-                            }
-                            break;
-
-                    }
-                }
-            }
-            $zip->close();
-        }
-
-        return $xl;
-    }
-
-
-    /**
-     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
-     *
-     * @param     string         $pFilename
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function listWorksheetNames($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetNames = array();
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        $zip->open($pFilename);
-
-        //    The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
-        $rels = simplexml_load_string(
-            $this->securityScan($this->getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
-        ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-        foreach ($rels->Relationship as $rel) {
-            switch ($rel["Type"]) {
-                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
-                    $xmlWorkbook = simplexml_load_string(
-                        $this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
-                    );  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-
-                    if ($xmlWorkbook->sheets) {
-                        foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
-                            // Check if sheet should be skipped
-                            $worksheetNames[] = (string) $eleSheet["name"];
-                        }
-                    }
-            }
-        }
-
-        $zip->close();
-
-        return $worksheetNames;
-    }
-
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetInfo = array();
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        $zip->open($pFilename);
-
-        $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-        foreach ($rels->Relationship as $rel) {
-            if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
-                $dir = dirname($rel["Target"]);
-                $relsWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
-
-                $worksheets = array();
-                foreach ($relsWorkbook->Relationship as $ele) {
-                    if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
-                        $worksheets[(string) $ele["Id"]] = $ele["Target"];
-                    }
-                }
-
-                $xmlWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-                if ($xmlWorkbook->sheets) {
-                    $dir = dirname($rel["Target"]);
-                    foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
-                        $tmpInfo = array(
-                            'worksheetName' => (string) $eleSheet["name"],
-                            'lastColumnLetter' => 'A',
-                            'lastColumnIndex' => 0,
-                            'totalRows' => 0,
-                            'totalColumns' => 0,
-                        );
-
-                        $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
-
-                        $xml = new XMLReader();
-                        $res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
-                        $xml->setParserProperty(2, true);
-
-                        $currCells = 0;
-                        while ($xml->read()) {
-                            if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) {
-                                $row = $xml->getAttribute('r');
-                                $tmpInfo['totalRows'] = $row;
-                                $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
-                                $currCells = 0;
-                            } elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) {
-                                $currCells++;
-                            }
-                        }
-                        $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
-                        $xml->close();
-
-                        $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
-                        $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-
-                        $worksheetInfo[] = $tmpInfo;
-                    }
-                }
-            }
-        }
-
-        $zip->close();
-
-        return $worksheetInfo;
-    }
-
-    private static function castToBoolean($c)
-    {
-//        echo 'Initial Cast to Boolean', PHP_EOL;
-        $value = isset($c->v) ? (string) $c->v : null;
-        if ($value == '0') {
-            return false;
-        } elseif ($value == '1') {
-            return true;
-        } else {
-            return (bool)$c->v;
-        }
-        return $value;
-    }
-
-    private static function castToError($c)
-    {
-//        echo 'Initial Cast to Error', PHP_EOL;
-        return isset($c->v) ? (string) $c->v : null;
-    }
-
-    private static function castToString($c)
-    {
-//        echo 'Initial Cast to String, PHP_EOL;
-        return isset($c->v) ? (string) $c->v : null;
-    }
-
-    private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
-    {
-//        echo 'Formula', PHP_EOL;
-//        echo '$c->f is ', $c->f, PHP_EOL;
-        $cellDataType       = 'f';
-        $value              = "={$c->f}";
-        $calculatedValue    = self::$castBaseType($c);
-
-        // Shared formula?
-        if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') {
-//            echo 'SHARED FORMULA', PHP_EOL;
-            $instance = (string)$c->f['si'];
-
-//            echo 'Instance ID = ', $instance, PHP_EOL;
-//
-//            echo 'Shared Formula Array:', PHP_EOL;
-//            print_r($sharedFormulas);
-            if (!isset($sharedFormulas[(string)$c->f['si']])) {
-//                echo 'SETTING NEW SHARED FORMULA', PHP_EOL;
-//                echo 'Master is ', $r, PHP_EOL;
-//                echo 'Formula is ', $value, PHP_EOL;
-                $sharedFormulas[$instance] = array('master' => $r, 'formula' => $value);
-//                echo 'New Shared Formula Array:', PHP_EOL;
-//                print_r($sharedFormulas);
-            } else {
-//                echo 'GETTING SHARED FORMULA', PHP_EOL;
-//                echo 'Master is ', $sharedFormulas[$instance]['master'], PHP_EOL;
-//                echo 'Formula is ', $sharedFormulas[$instance]['formula'], PHP_EOL;
-                $master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
-                $current = PHPExcel_Cell::coordinateFromString($r);
-
-                $difference = array(0, 0);
-                $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]);
-                $difference[1] = $current[1] - $master[1];
-
-                $value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
-//                echo 'Adjusted Formula is ', $value, PHP_EOL;
-            }
-        }
-    }
-
-
-    private function getFromZipArchive($archive, $fileName = '')
-    {
-        // Root-relative paths
-        if (strpos($fileName, '//') !== false) {
-            $fileName = substr($fileName, strpos($fileName, '//') + 1);
-        }
-        $fileName = PHPExcel_Shared_File::realpath($fileName);
-
-        // Sadly, some 3rd party xlsx generators don't use consistent case for filenaming
-        //    so we need to load case-insensitively from the zip file
-        
-        // Apache POI fixes
-        $contents = $archive->getFromIndex(
-            $archive->locateName($fileName, ZIPARCHIVE::FL_NOCASE)
-        );
-        if ($contents === false) {
-            $contents = $archive->getFromIndex(
-                $archive->locateName(substr($fileName, 1), ZIPARCHIVE::FL_NOCASE)
-            );
-        }
-
-        return $contents;
-    }
-
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return  PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        // Initialisations
-        $excel = new PHPExcel;
-        $excel->removeSheetByIndex(0);
-        if (!$this->readDataOnly) {
-            $excel->removeCellStyleXfByIndex(0); // remove the default style
-            $excel->removeCellXfByIndex(0); // remove the default style
-        }
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        $zip->open($pFilename);
-
-        //    Read the theme first, because we need the colour scheme when reading the styles
-        $wbRels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-        foreach ($wbRels->Relationship as $rel) {
-            switch ($rel["Type"]) {
-                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
-                    $themeOrderArray = array('lt1', 'dk1', 'lt2', 'dk2');
-                    $themeOrderAdditional = count($themeOrderArray);
-
-                    $xmlTheme = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "xl/{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                    if (is_object($xmlTheme)) {
-                        $xmlThemeName = $xmlTheme->attributes();
-                        $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
-                        $themeName = (string)$xmlThemeName['name'];
-
-                        $colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
-                        $colourSchemeName = (string)$colourScheme['name'];
-                        $colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
-
-                        $themeColours = array();
-                        foreach ($colourScheme as $k => $xmlColour) {
-                            $themePos = array_search($k, $themeOrderArray);
-                            if ($themePos === false) {
-                                $themePos = $themeOrderAdditional++;
-                            }
-                            if (isset($xmlColour->sysClr)) {
-                                $xmlColourData = $xmlColour->sysClr->attributes();
-                                $themeColours[$themePos] = $xmlColourData['lastClr'];
-                            } elseif (isset($xmlColour->srgbClr)) {
-                                $xmlColourData = $xmlColour->srgbClr->attributes();
-                                $themeColours[$themePos] = $xmlColourData['val'];
-                            }
-                        }
-                        self::$theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours);
-                    }
-                    break;
-            }
-        }
-
-        $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-        foreach ($rels->Relationship as $rel) {
-            switch ($rel["Type"]) {
-                case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
-                    $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                    if (is_object($xmlCore)) {
-                        $xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
-                        $xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
-                        $xmlCore->registerXPathNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
-                        $docProps = $excel->getProperties();
-                        $docProps->setCreator((string) self::getArrayItem($xmlCore->xpath("dc:creator")));
-                        $docProps->setLastModifiedBy((string) self::getArrayItem($xmlCore->xpath("cp:lastModifiedBy")));
-                        $docProps->setCreated(strtotime(self::getArrayItem($xmlCore->xpath("dcterms:created")))); //! respect xsi:type
-                        $docProps->setModified(strtotime(self::getArrayItem($xmlCore->xpath("dcterms:modified")))); //! respect xsi:type
-                        $docProps->setTitle((string) self::getArrayItem($xmlCore->xpath("dc:title")));
-                        $docProps->setDescription((string) self::getArrayItem($xmlCore->xpath("dc:description")));
-                        $docProps->setSubject((string) self::getArrayItem($xmlCore->xpath("dc:subject")));
-                        $docProps->setKeywords((string) self::getArrayItem($xmlCore->xpath("cp:keywords")));
-                        $docProps->setCategory((string) self::getArrayItem($xmlCore->xpath("cp:category")));
-                    }
-                    break;
-                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
-                    $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                    if (is_object($xmlCore)) {
-                        $docProps = $excel->getProperties();
-                        if (isset($xmlCore->Company)) {
-                            $docProps->setCompany((string) $xmlCore->Company);
-                        }
-                        if (isset($xmlCore->Manager)) {
-                            $docProps->setManager((string) $xmlCore->Manager);
-                        }
-                    }
-                    break;
-                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
-                    $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                    if (is_object($xmlCore)) {
-                        $docProps = $excel->getProperties();
-                        foreach ($xmlCore as $xmlProperty) {
-                            $cellDataOfficeAttributes = $xmlProperty->attributes();
-                            if (isset($cellDataOfficeAttributes['name'])) {
-                                $propertyName = (string) $cellDataOfficeAttributes['name'];
-                                $cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
-                                $attributeType = $cellDataOfficeChildren->getName();
-                                $attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
-                                $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType);
-                                $attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType);
-                                $docProps->setCustomProperty($propertyName, $attributeValue, $attributeType);
-                            }
-                        }
-                    }
-                    break;
-                //Ribbon
-                case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility":
-                    $customUI = $rel['Target'];
-                    if (!is_null($customUI)) {
-                        $this->readRibbon($excel, $customUI, $zip);
-                    }
-                    break;
-                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
-                    $dir = dirname($rel["Target"]);
-                    $relsWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                    $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
-
-                    $sharedStrings = array();
-                    $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
-                    $xmlStrings = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-                    if (isset($xmlStrings) && isset($xmlStrings->si)) {
-                        foreach ($xmlStrings->si as $val) {
-                            if (isset($val->t)) {
-                                $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t);
-                            } elseif (isset($val->r)) {
-                                $sharedStrings[] = $this->parseRichText($val);
-                            }
-                        }
-                    }
-
-                    $worksheets = array();
-                    $macros = $customUI = null;
-                    foreach ($relsWorkbook->Relationship as $ele) {
-                        switch ($ele['Type']) {
-                            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
-                                $worksheets[(string) $ele["Id"]] = $ele["Target"];
-                                break;
-                            // a vbaProject ? (: some macros)
-                            case "http://schemas.microsoft.com/office/2006/relationships/vbaProject":
-                                $macros = $ele["Target"];
-                                break;
-                        }
-                    }
-
-                    if (!is_null($macros)) {
-                        $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin
-                        if ($macrosCode !== false) {
-                            $excel->setMacrosCode($macrosCode);
-                            $excel->setHasMacros(true);
-                            //short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir
-                            $Certificate = $this->getFromZipArchive($zip, 'xl/vbaProjectSignature.bin');
-                            if ($Certificate !== false) {
-                                $excel->setMacrosCertificate($Certificate);
-                            }
-                        }
-                    }
-                    $styles     = array();
-                    $cellStyles = array();
-                    $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
-                    $xmlStyles = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                    //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-
-                    $numFmts = null;
-                    if ($xmlStyles && $xmlStyles->numFmts[0]) {
-                        $numFmts = $xmlStyles->numFmts[0];
-                    }
-                    if (isset($numFmts) && ($numFmts !== null)) {
-                        $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-                    }
-                    if (!$this->readDataOnly && $xmlStyles) {
-                        foreach ($xmlStyles->cellXfs->xf as $xf) {
-                            $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
-                            if ($xf["numFmtId"]) {
-                                if (isset($numFmts)) {
-                                    $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
-
-                                    if (isset($tmpNumFmt["formatCode"])) {
-                                        $numFmt = (string) $tmpNumFmt["formatCode"];
-                                    }
-                                }
-
-                                // We shouldn't override any of the built-in MS Excel values (values below id 164)
-                                //  But there's a lot of naughty homebrew xlsx writers that do use "reserved" id values that aren't actually used
-                                //  So we make allowance for them rather than lose formatting masks
-                                if ((int)$xf["numFmtId"] < 164 && PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]) !== '') {
-                                    $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
-                                }
-                            }
-                            $quotePrefix = false;
-                            if (isset($xf["quotePrefix"])) {
-                                $quotePrefix = (boolean) $xf["quotePrefix"];
-                            }
-
-                            $style = (object) array(
-                                "numFmt" => $numFmt,
-                                "font" => $xmlStyles->fonts->font[intval($xf["fontId"])],
-                                "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])],
-                                "border" => $xmlStyles->borders->border[intval($xf["borderId"])],
-                                "alignment" => $xf->alignment,
-                                "protection" => $xf->protection,
-                                "quotePrefix" => $quotePrefix,
-                            );
-                            $styles[] = $style;
-
-                            // add style to cellXf collection
-                            $objStyle = new PHPExcel_Style;
-                            self::readStyle($objStyle, $style);
-                            $excel->addCellXf($objStyle);
-                        }
-
-                        foreach ($xmlStyles->cellStyleXfs->xf as $xf) {
-                            $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
-                            if ($numFmts && $xf["numFmtId"]) {
-                                $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
-                                if (isset($tmpNumFmt["formatCode"])) {
-                                    $numFmt = (string) $tmpNumFmt["formatCode"];
-                                } elseif ((int)$xf["numFmtId"] < 165) {
-                                    $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
-                                }
-                            }
-
-                            $cellStyle = (object) array(
-                                "numFmt" => $numFmt,
-                                "font" => $xmlStyles->fonts->font[intval($xf["fontId"])],
-                                "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])],
-                                "border" => $xmlStyles->borders->border[intval($xf["borderId"])],
-                                "alignment" => $xf->alignment,
-                                "protection" => $xf->protection,
-                                "quotePrefix" => $quotePrefix,
-                            );
-                            $cellStyles[] = $cellStyle;
-
-                            // add style to cellStyleXf collection
-                            $objStyle = new PHPExcel_Style;
-                            self::readStyle($objStyle, $cellStyle);
-                            $excel->addCellStyleXf($objStyle);
-                        }
-                    }
-
-                    $dxfs = array();
-                    if (!$this->readDataOnly && $xmlStyles) {
-                        //    Conditional Styles
-                        if ($xmlStyles->dxfs) {
-                            foreach ($xmlStyles->dxfs->dxf as $dxf) {
-                                $style = new PHPExcel_Style(false, true);
-                                self::readStyle($style, $dxf);
-                                $dxfs[] = $style;
-                            }
-                        }
-                        //    Cell Styles
-                        if ($xmlStyles->cellStyles) {
-                            foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
-                                if (intval($cellStyle['builtinId']) == 0) {
-                                    if (isset($cellStyles[intval($cellStyle['xfId'])])) {
-                                        // Set default style
-                                        $style = new PHPExcel_Style;
-                                        self::readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
-
-                                        // normal style, currently not using it for anything
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    $xmlWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-
-                    // Set base date
-                    if ($xmlWorkbook->workbookPr) {
-                        PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
-                        if (isset($xmlWorkbook->workbookPr['date1904'])) {
-                            if (self::boolean((string) $xmlWorkbook->workbookPr['date1904'])) {
-                                PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
-                            }
-                        }
-                    }
-
-                    $sheetId = 0; // keep track of new sheet id in final workbook
-                    $oldSheetId = -1; // keep track of old sheet id in final workbook
-                    $countSkippedSheets = 0; // keep track of number of skipped sheets
-                    $mapSheetId = array(); // mapping of sheet ids from old to new
-
-                    $charts = $chartDetails = array();
-
-                    if ($xmlWorkbook->sheets) {
-                        foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
-                            ++$oldSheetId;
-
-                            // Check if sheet should be skipped
-                            if (isset($this->loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->loadSheetsOnly)) {
-                                ++$countSkippedSheets;
-                                $mapSheetId[$oldSheetId] = null;
-                                continue;
-                            }
-
-                            // Map old sheet id in original workbook to new sheet id.
-                            // They will differ if loadSheetsOnly() is being used
-                            $mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets;
-
-                            // Load sheet
-                            $docSheet = $excel->createSheet();
-                            //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet
-                            //        references in formula cells... during the load, all formulae should be correct,
-                            //        and we're simply bringing the worksheet name in line with the formula, not the
-                            //        reverse
-                            $docSheet->setTitle((string) $eleSheet["name"], false);
-                            $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
-                            $xmlSheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-
-                            $sharedFormulas = array();
-
-                            if (isset($eleSheet["state"]) && (string) $eleSheet["state"] != '') {
-                                $docSheet->setSheetState((string) $eleSheet["state"]);
-                            }
-
-                            if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) {
-                                if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
-                                    $docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale']));
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
-                                    $docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView['view'])) {
-                                    $docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
-                                    $docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines']));
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) {
-                                    $docSheet->setShowRowColHeaders(self::boolean((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders']));
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) {
-                                    $docSheet->setRightToLeft(self::boolean((string)$xmlSheet->sheetViews->sheetView['rightToLeft']));
-                                }
-                                if (isset($xmlSheet->sheetViews->sheetView->pane)) {
-                                    if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) {
-                                        $docSheet->freezePane((string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell']);
-                                    } else {
-                                        $xSplit = 0;
-                                        $ySplit = 0;
-
-                                        if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) {
-                                            $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']);
-                                        }
-
-                                        if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) {
-                                            $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']);
-                                        }
-
-                                        $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit);
-                                    }
-                                }
-
-                                if (isset($xmlSheet->sheetViews->sheetView->selection)) {
-                                    if (isset($xmlSheet->sheetViews->sheetView->selection['sqref'])) {
-                                        $sqref = (string)$xmlSheet->sheetViews->sheetView->selection['sqref'];
-                                        $sqref = explode(' ', $sqref);
-                                        $sqref = $sqref[0];
-                                        $docSheet->setSelectedCells($sqref);
-                                    }
-                                }
-                            }
-
-                            if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) {
-                                if (isset($xmlSheet->sheetPr->tabColor['rgb'])) {
-                                    $docSheet->getTabColor()->setARGB((string)$xmlSheet->sheetPr->tabColor['rgb']);
-                                }
-                            }
-                            if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr['codeName'])) {
-                                $docSheet->setCodeName((string) $xmlSheet->sheetPr['codeName']);
-                            }
-                            if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) {
-                                if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) &&
-                                    !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryRight'])) {
-                                    $docSheet->setShowSummaryRight(false);
-                                } else {
-                                    $docSheet->setShowSummaryRight(true);
-                                }
-
-                                if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) &&
-                                    !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryBelow'])) {
-                                    $docSheet->setShowSummaryBelow(false);
-                                } else {
-                                    $docSheet->setShowSummaryBelow(true);
-                                }
-                            }
-
-                            if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) {
-                                if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) &&
-                                    !self::boolean((string) $xmlSheet->sheetPr->pageSetUpPr['fitToPage'])) {
-                                    $docSheet->getPageSetup()->setFitToPage(false);
-                                } else {
-                                    $docSheet->getPageSetup()->setFitToPage(true);
-                                }
-                            }
-
-                            if (isset($xmlSheet->sheetFormatPr)) {
-                                if (isset($xmlSheet->sheetFormatPr['customHeight']) &&
-                                    self::boolean((string) $xmlSheet->sheetFormatPr['customHeight']) &&
-                                    isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) {
-                                    $docSheet->getDefaultRowDimension()->setRowHeight((float)$xmlSheet->sheetFormatPr['defaultRowHeight']);
-                                }
-                                if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) {
-                                    $docSheet->getDefaultColumnDimension()->setWidth((float)$xmlSheet->sheetFormatPr['defaultColWidth']);
-                                }
-                                if (isset($xmlSheet->sheetFormatPr['zeroHeight']) &&
-                                    ((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) {
-                                    $docSheet->getDefaultRowDimension()->setZeroHeight(true);
-                                }
-                            }
-
-                            if (isset($xmlSheet->cols) && !$this->readDataOnly) {
-                                foreach ($xmlSheet->cols->col as $col) {
-                                    for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) {
-                                        if ($col["style"] && !$this->readDataOnly) {
-                                            $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"]));
-                                        }
-                                        if (self::boolean($col["bestFit"])) {
-                                            //$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
-                                        }
-                                        if (self::boolean($col["hidden"])) {
-                                        // echo PHPExcel_Cell::stringFromColumnIndex($i), ': HIDDEN COLUMN',PHP_EOL;
-                                            $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(false);
-                                        }
-                                        if (self::boolean($col["collapsed"])) {
-                                            $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(true);
-                                        }
-                                        if ($col["outlineLevel"] > 0) {
-                                            $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"]));
-                                        }
-                                        $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setWidth(floatval($col["width"]));
-
-                                        if (intval($col["max"]) == 16384) {
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-
-                            if (isset($xmlSheet->printOptions) && !$this->readDataOnly) {
-                                if (self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) {
-                                    $docSheet->setShowGridlines(true);
-                                }
-                                if (self::boolean((string) $xmlSheet->printOptions['gridLines'])) {
-                                    $docSheet->setPrintGridlines(true);
-                                }
-                                if (self::boolean((string) $xmlSheet->printOptions['horizontalCentered'])) {
-                                    $docSheet->getPageSetup()->setHorizontalCentered(true);
-                                }
-                                if (self::boolean((string) $xmlSheet->printOptions['verticalCentered'])) {
-                                    $docSheet->getPageSetup()->setVerticalCentered(true);
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) {
-                                foreach ($xmlSheet->sheetData->row as $row) {
-                                    if ($row["ht"] && !$this->readDataOnly) {
-                                        $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"]));
-                                    }
-                                    if (self::boolean($row["hidden"]) && !$this->readDataOnly) {
-                                        $docSheet->getRowDimension(intval($row["r"]))->setVisible(false);
-                                    }
-                                    if (self::boolean($row["collapsed"])) {
-                                        $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(true);
-                                    }
-                                    if ($row["outlineLevel"] > 0) {
-                                        $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
-                                    }
-                                    if ($row["s"] && !$this->readDataOnly) {
-                                        $docSheet->getRowDimension(intval($row["r"]))->setXfIndex(intval($row["s"]));
-                                    }
-
-                                    foreach ($row->c as $c) {
-                                        $r                     = (string) $c["r"];
-                                        $cellDataType         = (string) $c["t"];
-                                        $value                = null;
-                                        $calculatedValue     = null;
-
-                                        // Read cell?
-                                        if ($this->getReadFilter() !== null) {
-                                            $coordinates = PHPExcel_Cell::coordinateFromString($r);
-
-                                            if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
-                                                continue;
-                                            }
-                                        }
-
-    //                                    echo 'Reading cell ', $coordinates[0], $coordinates[1], PHP_EOL;
-    //                                    print_r($c);
-    //                                    echo PHP_EOL;
-    //                                    echo 'Cell Data Type is ', $cellDataType, ': ';
-    //
-                                        // Read cell!
-                                        switch ($cellDataType) {
-                                            case "s":
-    //                                            echo 'String', PHP_EOL;
-                                                if ((string)$c->v != '') {
-                                                    $value = $sharedStrings[intval($c->v)];
-
-                                                    if ($value instanceof PHPExcel_RichText) {
-                                                        $value = clone $value;
-                                                    }
-                                                } else {
-                                                    $value = '';
-                                                }
-                                                break;
-                                            case "b":
-    //                                            echo 'Boolean', PHP_EOL;
-                                                if (!isset($c->f)) {
-                                                    $value = self::castToBoolean($c);
-                                                } else {
-                                                    // Formula
-                                                    $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToBoolean');
-                                                    if (isset($c->f['t'])) {
-                                                        $att = array();
-                                                        $att = $c->f;
-                                                        $docSheet->getCell($r)->setFormulaAttributes($att);
-                                                    }
-    //                                                echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
-                                                }
-                                                break;
-                                            case "inlineStr":
-//                                                echo 'Inline String', PHP_EOL;
-                                                if (isset($c->f)) {
-                                                    $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError');
-                                                } else {
-                                                    $value = $this->parseRichText($c->is);
-                                                }
-                                                break;
-                                            case "e":
-    //                                            echo 'Error', PHP_EOL;
-                                                if (!isset($c->f)) {
-                                                    $value = self::castToError($c);
-                                                } else {
-                                                    // Formula
-                                                    $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError');
-    //                                                echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
-                                                }
-                                                break;
-                                            default:
-//                                                echo 'Default', PHP_EOL;
-                                                if (!isset($c->f)) {
-    //                                                echo 'Not a Formula', PHP_EOL;
-                                                    $value = self::castToString($c);
-                                                } else {
-    //                                                echo 'Treat as Formula', PHP_EOL;
-                                                    // Formula
-                                                    $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToString');
-    //                                                echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
-                                                }
-                                                break;
-                                        }
-    //                                    echo 'Value is ', $value, PHP_EOL;
-
-                                        // Check for numeric values
-                                        if (is_numeric($value) && $cellDataType != 's') {
-                                            if ($value == (int)$value) {
-                                                $value = (int)$value;
-                                            } elseif ($value == (float)$value) {
-                                                $value = (float)$value;
-                                            } elseif ($value == (double)$value) {
-                                                $value = (double)$value;
-                                            }
-                                        }
-
-                                        // Rich text?
-                                        if ($value instanceof PHPExcel_RichText && $this->readDataOnly) {
-                                            $value = $value->getPlainText();
-                                        }
-
-                                        $cell = $docSheet->getCell($r);
-                                        // Assign value
-                                        if ($cellDataType != '') {
-                                            $cell->setValueExplicit($value, $cellDataType);
-                                        } else {
-                                            $cell->setValue($value);
-                                        }
-                                        if ($calculatedValue !== null) {
-                                            $cell->setCalculatedValue($calculatedValue);
-                                        }
-
-                                        // Style information?
-                                        if ($c["s"] && !$this->readDataOnly) {
-                                            // no style index means 0, it seems
-                                            $cell->setXfIndex(isset($styles[intval($c["s"])]) ?
-                                                intval($c["s"]) : 0);
-                                        }
-                                    }
-                                }
-                            }
-
-                            $conditionals = array();
-                            if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
-                                foreach ($xmlSheet->conditionalFormatting as $conditional) {
-                                    foreach ($conditional->cfRule as $cfRule) {
-                                        if (((string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) {
-                                            $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
-                                        }
-                                    }
-                                }
-
-                                foreach ($conditionals as $ref => $cfRules) {
-                                    ksort($cfRules);
-                                    $conditionalStyles = array();
-                                    foreach ($cfRules as $cfRule) {
-                                        $objConditional = new PHPExcel_Style_Conditional();
-                                        $objConditional->setConditionType((string)$cfRule["type"]);
-                                        $objConditional->setOperatorType((string)$cfRule["operator"]);
-
-                                        if ((string)$cfRule["text"] != '') {
-                                            $objConditional->setText((string)$cfRule["text"]);
-                                        }
-
-                                        if (count($cfRule->formula) > 1) {
-                                            foreach ($cfRule->formula as $formula) {
-                                                $objConditional->addCondition((string)$formula);
-                                            }
-                                        } else {
-                                            $objConditional->addCondition((string)$cfRule->formula);
-                                        }
-                                        $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]);
-                                        $conditionalStyles[] = $objConditional;
-                                    }
-
-                                    // Extract all cell references in $ref
-                                    $cellBlocks = explode(' ', str_replace('$', '', strtoupper($ref)));
-                                    foreach ($cellBlocks as $cellBlock) {
-                                        $docSheet->getStyle($cellBlock)->setConditionalStyles($conditionalStyles);
-                                    }
-                                }
-                            }
-
-                            $aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells");
-                            if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
-                                foreach ($aKeys as $key) {
-                                    $method = "set" . ucfirst($key);
-                                    $docSheet->getProtection()->$method(self::boolean((string) $xmlSheet->sheetProtection[$key]));
-                                }
-                            }
-
-                            if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
-                                $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true);
-                                if ($xmlSheet->protectedRanges->protectedRange) {
-                                    foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) {
-                                        $docSheet->protectCells((string) $protectedRange["sqref"], (string) $protectedRange["password"], true);
-                                    }
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->autoFilter && !$this->readDataOnly) {
-                                $autoFilterRange = (string) $xmlSheet->autoFilter["ref"];
-                                if (strpos($autoFilterRange, ':') !== false) {
-                                    $autoFilter = $docSheet->getAutoFilter();
-                                    $autoFilter->setRange($autoFilterRange);
-
-                                    foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
-                                        $column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]);
-                                        //    Check for standard filters
-                                        if ($filterColumn->filters) {
-                                            $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
-                                            $filters = $filterColumn->filters;
-                                            if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
-                                                //    Operator is undefined, but always treated as EQUAL
-                                                $column->createRule()->setRule(null, '')->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
-                                            }
-                                            //    Standard filters are always an OR join, so no join rule needs to be set
-                                            //    Entries can be either filter elements
-                                            foreach ($filters->filter as $filterRule) {
-                                                //    Operator is undefined, but always treated as EQUAL
-                                                $column->createRule()->setRule(null, (string) $filterRule["val"])->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
-                                            }
-                                            //    Or Date Group elements
-                                            foreach ($filters->dateGroupItem as $dateGroupItem) {
-                                                $column->createRule()->setRule(
-                                                    //    Operator is undefined, but always treated as EQUAL
-                                                    null,
-                                                    array(
-                                                        'year' => (string) $dateGroupItem["year"],
-                                                        'month' => (string) $dateGroupItem["month"],
-                                                        'day' => (string) $dateGroupItem["day"],
-                                                        'hour' => (string) $dateGroupItem["hour"],
-                                                        'minute' => (string) $dateGroupItem["minute"],
-                                                        'second' => (string) $dateGroupItem["second"],
-                                                    ),
-                                                    (string) $dateGroupItem["dateTimeGrouping"]
-                                                )
-                                                ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
-                                            }
-                                        }
-                                        //    Check for custom filters
-                                        if ($filterColumn->customFilters) {
-                                            $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
-                                            $customFilters = $filterColumn->customFilters;
-                                            //    Custom filters can an AND or an OR join;
-                                            //        and there should only ever be one or two entries
-                                            if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) {
-                                                $column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
-                                            }
-                                            foreach ($customFilters->customFilter as $filterRule) {
-                                                $column->createRule()->setRule(
-                                                    (string) $filterRule["operator"],
-                                                    (string) $filterRule["val"]
-                                                )
-                                                ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
-                                            }
-                                        }
-                                        //    Check for dynamic filters
-                                        if ($filterColumn->dynamicFilter) {
-                                            $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
-                                            //    We should only ever have one dynamic filter
-                                            foreach ($filterColumn->dynamicFilter as $filterRule) {
-                                                $column->createRule()->setRule(
-                                                    //    Operator is undefined, but always treated as EQUAL
-                                                    null,
-                                                    (string) $filterRule["val"],
-                                                    (string) $filterRule["type"]
-                                                )
-                                                ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
-                                                if (isset($filterRule["val"])) {
-                                                    $column->setAttribute('val', (string) $filterRule["val"]);
-                                                }
-                                                if (isset($filterRule["maxVal"])) {
-                                                    $column->setAttribute('maxVal', (string) $filterRule["maxVal"]);
-                                                }
-                                            }
-                                        }
-                                        //    Check for dynamic filters
-                                        if ($filterColumn->top10) {
-                                            $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
-                                            //    We should only ever have one top10 filter
-                                            foreach ($filterColumn->top10 as $filterRule) {
-                                                $column->createRule()->setRule(
-                                                    (((isset($filterRule["percent"])) && ($filterRule["percent"] == 1))
-                                                        ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT
-                                                        : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
-                                                    ),
-                                                    (string) $filterRule["val"],
-                                                    (((isset($filterRule["top"])) && ($filterRule["top"] == 1))
-                                                        ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
-                                                        : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
-                                                    )
-                                                )
-                                                ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->readDataOnly) {
-                                foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
-                                    $mergeRef = (string) $mergeCell["ref"];
-                                    if (strpos($mergeRef, ':') !== false) {
-                                        $docSheet->mergeCells((string) $mergeCell["ref"]);
-                                    }
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->pageMargins && !$this->readDataOnly) {
-                                $docPageMargins = $docSheet->getPageMargins();
-                                $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"]));
-                                $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"]));
-                                $docPageMargins->setTop(floatval($xmlSheet->pageMargins["top"]));
-                                $docPageMargins->setBottom(floatval($xmlSheet->pageMargins["bottom"]));
-                                $docPageMargins->setHeader(floatval($xmlSheet->pageMargins["header"]));
-                                $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"]));
-                            }
-
-                            if ($xmlSheet && $xmlSheet->pageSetup && !$this->readDataOnly) {
-                                $docPageSetup = $docSheet->getPageSetup();
-
-                                if (isset($xmlSheet->pageSetup["orientation"])) {
-                                    $docPageSetup->setOrientation((string) $xmlSheet->pageSetup["orientation"]);
-                                }
-                                if (isset($xmlSheet->pageSetup["paperSize"])) {
-                                    $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"]));
-                                }
-                                if (isset($xmlSheet->pageSetup["scale"])) {
-                                    $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), false);
-                                }
-                                if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) >= 0) {
-                                    $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), false);
-                                }
-                                if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) >= 0) {
-                                    $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false);
-                                }
-                                if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) &&
-                                    self::boolean((string) $xmlSheet->pageSetup["useFirstPageNumber"])) {
-                                    $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup["firstPageNumber"]));
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->headerFooter && !$this->readDataOnly) {
-                                $docHeaderFooter = $docSheet->getHeaderFooter();
-
-                                if (isset($xmlSheet->headerFooter["differentOddEven"]) &&
-                                    self::boolean((string)$xmlSheet->headerFooter["differentOddEven"])) {
-                                    $docHeaderFooter->setDifferentOddEven(true);
-                                } else {
-                                    $docHeaderFooter->setDifferentOddEven(false);
-                                }
-                                if (isset($xmlSheet->headerFooter["differentFirst"]) &&
-                                    self::boolean((string)$xmlSheet->headerFooter["differentFirst"])) {
-                                    $docHeaderFooter->setDifferentFirst(true);
-                                } else {
-                                    $docHeaderFooter->setDifferentFirst(false);
-                                }
-                                if (isset($xmlSheet->headerFooter["scaleWithDoc"]) &&
-                                    !self::boolean((string)$xmlSheet->headerFooter["scaleWithDoc"])) {
-                                    $docHeaderFooter->setScaleWithDocument(false);
-                                } else {
-                                    $docHeaderFooter->setScaleWithDocument(true);
-                                }
-                                if (isset($xmlSheet->headerFooter["alignWithMargins"]) &&
-                                    !self::boolean((string)$xmlSheet->headerFooter["alignWithMargins"])) {
-                                    $docHeaderFooter->setAlignWithMargins(false);
-                                } else {
-                                    $docHeaderFooter->setAlignWithMargins(true);
-                                }
-
-                                $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader);
-                                $docHeaderFooter->setOddFooter((string) $xmlSheet->headerFooter->oddFooter);
-                                $docHeaderFooter->setEvenHeader((string) $xmlSheet->headerFooter->evenHeader);
-                                $docHeaderFooter->setEvenFooter((string) $xmlSheet->headerFooter->evenFooter);
-                                $docHeaderFooter->setFirstHeader((string) $xmlSheet->headerFooter->firstHeader);
-                                $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter);
-                            }
-
-                            if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->readDataOnly) {
-                                foreach ($xmlSheet->rowBreaks->brk as $brk) {
-                                    if ($brk["man"]) {
-                                        $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW);
-                                    }
-                                }
-                            }
-                            if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->readDataOnly) {
-                                foreach ($xmlSheet->colBreaks->brk as $brk) {
-                                    if ($brk["man"]) {
-                                        $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex((string) $brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN);
-                                    }
-                                }
-                            }
-
-                            if ($xmlSheet && $xmlSheet->dataValidations && !$this->readDataOnly) {
-                                foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) {
-                                    // Uppercase coordinate
-                                    $range = strtoupper($dataValidation["sqref"]);
-                                    $rangeSet = explode(' ', $range);
-                                    foreach ($rangeSet as $range) {
-                                        $stRange = $docSheet->shrinkRangeToFit($range);
-
-                                        // Extract all cell references in $range
-                                        foreach (PHPExcel_Cell::extractAllCellReferencesInRange($stRange) as $reference) {
-                                            // Create validation
-                                            $docValidation = $docSheet->getCell($reference)->getDataValidation();
-                                            $docValidation->setType((string) $dataValidation["type"]);
-                                            $docValidation->setErrorStyle((string) $dataValidation["errorStyle"]);
-                                            $docValidation->setOperator((string) $dataValidation["operator"]);
-                                            $docValidation->setAllowBlank($dataValidation["allowBlank"] != 0);
-                                            $docValidation->setShowDropDown($dataValidation["showDropDown"] == 0);
-                                            $docValidation->setShowInputMessage($dataValidation["showInputMessage"] != 0);
-                                            $docValidation->setShowErrorMessage($dataValidation["showErrorMessage"] != 0);
-                                            $docValidation->setErrorTitle((string) $dataValidation["errorTitle"]);
-                                            $docValidation->setError((string) $dataValidation["error"]);
-                                            $docValidation->setPromptTitle((string) $dataValidation["promptTitle"]);
-                                            $docValidation->setPrompt((string) $dataValidation["prompt"]);
-                                            $docValidation->setFormula1((string) $dataValidation->formula1);
-                                            $docValidation->setFormula2((string) $dataValidation->formula2);
-                                        }
-                                    }
-                                }
-                            }
-
-                            // Add hyperlinks
-                            $hyperlinks = array();
-                            if (!$this->readDataOnly) {
-                                // Locate hyperlink relations
-                                if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
-                                    $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                    foreach ($relsWorksheet->Relationship as $ele) {
-                                        if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
-                                            $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
-                                        }
-                                    }
-                                }
-
-                                // Loop through hyperlinks
-                                if ($xmlSheet && $xmlSheet->hyperlinks) {
-                                    foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink) {
-                                        // Link url
-                                        $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships');
-
-                                        foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) {
-                                            $cell = $docSheet->getCell($cellReference);
-                                            if (isset($linkRel['id'])) {
-                                                $hyperlinkUrl = $hyperlinks[ (string)$linkRel['id'] ];
-                                                if (isset($hyperlink['location'])) {
-                                                    $hyperlinkUrl .= '#' . (string) $hyperlink['location'];
-                                                }
-                                                $cell->getHyperlink()->setUrl($hyperlinkUrl);
-                                            } elseif (isset($hyperlink['location'])) {
-                                                $cell->getHyperlink()->setUrl('sheet://' . (string)$hyperlink['location']);
-                                            }
-
-                                            // Tooltip
-                                            if (isset($hyperlink['tooltip'])) {
-                                                $cell->getHyperlink()->setTooltip((string)$hyperlink['tooltip']);
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-
-                            // Add comments
-                            $comments = array();
-                            $vmlComments = array();
-                            if (!$this->readDataOnly) {
-                                // Locate comment relations
-                                if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
-                                    $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                    foreach ($relsWorksheet->Relationship as $ele) {
-                                        if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
-                                            $comments[(string)$ele["Id"]] = (string)$ele["Target"];
-                                        }
-                                        if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
-                                            $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"];
-                                        }
-                                    }
-                                }
-
-                                // Loop through comments
-                                foreach ($comments as $relName => $relPath) {
-                                    // Load comments file
-                                    $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
-                                    $commentsFile = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-
-                                    // Utility variables
-                                    $authors = array();
-
-                                    // Loop through authors
-                                    foreach ($commentsFile->authors->author as $author) {
-                                        $authors[] = (string)$author;
-                                    }
-
-                                    // Loop through contents
-                                    foreach ($commentsFile->commentList->comment as $comment) {
-                                        if (!empty($comment['authorId'])) {
-                                            $docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
-                                        }
-                                        $docSheet->getComment((string)$comment['ref'])->setText($this->parseRichText($comment->text));
-                                    }
-                                }
-
-                                // Loop through VML comments
-                                foreach ($vmlComments as $relName => $relPath) {
-                                    // Load VML comments file
-                                    $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
-                                    $vmlCommentsFile = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                                    $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
-
-                                    $shapes = $vmlCommentsFile->xpath('//v:shape');
-                                    foreach ($shapes as $shape) {
-                                        $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
-
-                                        if (isset($shape['style'])) {
-                                            $style        = (string)$shape['style'];
-                                            $fillColor    = strtoupper(substr((string)$shape['fillcolor'], 1));
-                                            $column       = null;
-                                            $row          = null;
-
-                                            $clientData   = $shape->xpath('.//x:ClientData');
-                                            if (is_array($clientData) && !empty($clientData)) {
-                                                $clientData   = $clientData[0];
-
-                                                if (isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note') {
-                                                    $temp = $clientData->xpath('.//x:Row');
-                                                    if (is_array($temp)) {
-                                                        $row = $temp[0];
-                                                    }
-
-                                                    $temp = $clientData->xpath('.//x:Column');
-                                                    if (is_array($temp)) {
-                                                        $column = $temp[0];
-                                                    }
-                                                }
-                                            }
-
-                                            if (($column !== null) && ($row !== null)) {
-                                                // Set comment properties
-                                                $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1);
-                                                $comment->getFillColor()->setRGB($fillColor);
-
-                                                // Parse style
-                                                $styleArray = explode(';', str_replace(' ', '', $style));
-                                                foreach ($styleArray as $stylePair) {
-                                                    $stylePair = explode(':', $stylePair);
-
-                                                    if ($stylePair[0] == 'margin-left') {
-                                                        $comment->setMarginLeft($stylePair[1]);
-                                                    }
-                                                    if ($stylePair[0] == 'margin-top') {
-                                                        $comment->setMarginTop($stylePair[1]);
-                                                    }
-                                                    if ($stylePair[0] == 'width') {
-                                                        $comment->setWidth($stylePair[1]);
-                                                    }
-                                                    if ($stylePair[0] == 'height') {
-                                                        $comment->setHeight($stylePair[1]);
-                                                    }
-                                                    if ($stylePair[0] == 'visibility') {
-                                                        $comment->setVisible($stylePair[1] == 'visible');
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-
-                                // Header/footer images
-                                if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->readDataOnly) {
-                                    if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
-                                        $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                        $vmlRelationship = '';
-
-                                        foreach ($relsWorksheet->Relationship as $ele) {
-                                            if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
-                                                $vmlRelationship = self::dirAdd("$dir/$fileWorksheet", $ele["Target"]);
-                                            }
-                                        }
-
-                                        if ($vmlRelationship != '') {
-                                            // Fetch linked images
-                                            $relsVML = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                            $drawings = array();
-                                            foreach ($relsVML->Relationship as $ele) {
-                                                if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
-                                                    $drawings[(string) $ele["Id"]] = self::dirAdd($vmlRelationship, $ele["Target"]);
-                                                }
-                                            }
-
-                                            // Fetch VML document
-                                            $vmlDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $vmlRelationship)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                                            $vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
-
-                                            $hfImages = array();
-
-                                            $shapes = $vmlDrawing->xpath('//v:shape');
-                                            foreach ($shapes as $idx => $shape) {
-                                                $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
-                                                $imageData = $shape->xpath('//v:imagedata');
-                                                $imageData = $imageData[$idx];
-
-                                                $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office');
-                                                $style = self::toCSSArray((string)$shape['style']);
-
-                                                $hfImages[ (string)$shape['id'] ] = new PHPExcel_Worksheet_HeaderFooterDrawing();
-                                                if (isset($imageData['title'])) {
-                                                    $hfImages[ (string)$shape['id'] ]->setName((string)$imageData['title']);
-                                                }
-
-                                                $hfImages[ (string)$shape['id'] ]->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $drawings[(string)$imageData['relid']], false);
-                                                $hfImages[ (string)$shape['id'] ]->setResizeProportional(false);
-                                                $hfImages[ (string)$shape['id'] ]->setWidth($style['width']);
-                                                $hfImages[ (string)$shape['id'] ]->setHeight($style['height']);
-                                                if (isset($style['margin-left'])) {
-                                                    $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']);
-                                                }
-                                                $hfImages[ (string)$shape['id'] ]->setOffsetY($style['margin-top']);
-                                                $hfImages[ (string)$shape['id'] ]->setResizeProportional(true);
-                                            }
-
-                                            $docSheet->getHeaderFooter()->setImages($hfImages);
-                                        }
-                                    }
-                                }
-
-                            }
-
-                            // TODO: Autoshapes from twoCellAnchors!
-                            if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
-                                $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                $drawings = array();
-                                foreach ($relsWorksheet->Relationship as $ele) {
-                                    if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
-                                        $drawings[(string) $ele["Id"]] = self::dirAdd("$dir/$fileWorksheet", $ele["Target"]);
-                                    }
-                                }
-                                if ($xmlSheet->drawing && !$this->readDataOnly) {
-                                    foreach ($xmlSheet->drawing as $drawing) {
-                                        $fileDrawing = $drawings[(string) self::getArrayItem($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
-                                        $relsDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
-                                        $images = array();
-
-                                        if ($relsDrawing && $relsDrawing->Relationship) {
-                                            foreach ($relsDrawing->Relationship as $ele) {
-                                                if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
-                                                    $images[(string) $ele["Id"]] = self::dirAdd($fileDrawing, $ele["Target"]);
-                                                } elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
-                                                    if ($this->includeCharts) {
-                                                        $charts[self::dirAdd($fileDrawing, $ele["Target"])] = array(
-                                                            'id'        => (string) $ele["Id"],
-                                                            'sheet'    => $docSheet->getTitle()
-                                                        );
-                                                    }
-                                                }
-                                            }
-                                        }
-                                        $xmlDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $fileDrawing)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
-
-                                        if ($xmlDrawing->oneCellAnchor) {
-                                            foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
-                                                if ($oneCellAnchor->pic->blipFill) {
-                                                    $blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
-                                                    $xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
-                                                    $outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
-                                                    $objDrawing = new PHPExcel_Worksheet_Drawing;
-                                                    $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
-                                                    $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
-                                                    $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::getArrayItem($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
-                                                    $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
-                                                    $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
-                                                    $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
-                                                    $objDrawing->setResizeProportional(false);
-                                                    $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cx")));
-                                                    $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cy")));
-                                                    if ($xfrm) {
-                                                        $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
-                                                    }
-                                                    if ($outerShdw) {
-                                                        $shadow = $objDrawing->getShadow();
-                                                        $shadow->setVisible(true);
-                                                        $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "blurRad")));
-                                                        $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "dist")));
-                                                        $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), "dir")));
-                                                        $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), "algn"));
-                                                        $shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), "val"));
-                                                        $shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
-                                                    }
-                                                    $objDrawing->setWorksheet($docSheet);
-                                                } else {
-                                                    //    ? Can charts be positioned with a oneCellAnchor ?
-                                                    $coordinates    = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1);
-                                                    $offsetX        = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff);
-                                                    $offsetY        = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff);
-                                                    $width          = PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cx"));
-                                                    $height         = PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cy"));
-                                                }
-                                            }
-                                        }
-                                        if ($xmlDrawing->twoCellAnchor) {
-                                            foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
-                                                if ($twoCellAnchor->pic->blipFill) {
-                                                    $blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
-                                                    $xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
-                                                    $outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
-                                                    $objDrawing = new PHPExcel_Worksheet_Drawing;
-                                                    $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
-                                                    $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
-                                                    $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::getArrayItem($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
-                                                    $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1));
-                                                    $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff));
-                                                    $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff));
-                                                    $objDrawing->setResizeProportional(false);
-
-                                                    if ($xfrm) {
-                                                        $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cx")));
-                                                        $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cy")));
-                                                        $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
-                                                    }
-                                                    if ($outerShdw) {
-                                                        $shadow = $objDrawing->getShadow();
-                                                        $shadow->setVisible(true);
-                                                        $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "blurRad")));
-                                                        $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "dist")));
-                                                        $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), "dir")));
-                                                        $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), "algn"));
-                                                        $shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), "val"));
-                                                        $shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
-                                                    }
-                                                    $objDrawing->setWorksheet($docSheet);
-                                                } elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) {
-                                                    $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
-                                                    $fromOffsetX    = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
-                                                    $fromOffsetY    = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
-                                                    $toCoordinate   = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
-                                                    $toOffsetX      = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff);
-                                                    $toOffsetY      = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
-                                                    $graphic        = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
-                                                    $chartRef       = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
-                                                    $thisChart      = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
-
-                                                    $chartDetails[$docSheet->getTitle().'!'.$thisChart] = array(
-                                                        'fromCoordinate'    => $fromCoordinate,
-                                                        'fromOffsetX'       => $fromOffsetX,
-                                                        'fromOffsetY'       => $fromOffsetY,
-                                                        'toCoordinate'      => $toCoordinate,
-                                                        'toOffsetX'         => $toOffsetX,
-                                                        'toOffsetY'         => $toOffsetY,
-                                                        'worksheetTitle'    => $docSheet->getTitle()
-                                                    );
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-
-                            // Loop through definedNames
-                            if ($xmlWorkbook->definedNames) {
-                                foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
-                                    // Extract range
-                                    $extractedRange = (string)$definedName;
-                                    $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
-                                    if (($spos = strpos($extractedRange, '!')) !== false) {
-                                        $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
-                                    } else {
-                                        $extractedRange = str_replace('$', '', $extractedRange);
-                                    }
-
-                                    // Valid range?
-                                    if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') {
-                                        continue;
-                                    }
-
-                                    // Some definedNames are only applicable if we are on the same sheet...
-                                    if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) {
-                                        // Switch on type
-                                        switch ((string)$definedName['name']) {
-                                            case '_xlnm._FilterDatabase':
-                                                if ((string)$definedName['hidden'] !== '1') {
-                                                    $extractedRange = explode(',', $extractedRange);
-                                                    foreach ($extractedRange as $range) {
-                                                        $autoFilterRange = $range;
-                                                        if (strpos($autoFilterRange, ':') !== false) {
-                                                            $docSheet->getAutoFilter()->setRange($autoFilterRange);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case '_xlnm.Print_Titles':
-                                                // Split $extractedRange
-                                                $extractedRange = explode(',', $extractedRange);
-
-                                                // Set print titles
-                                                foreach ($extractedRange as $range) {
-                                                    $matches = array();
-                                                    $range = str_replace('$', '', $range);
-
-                                                    // check for repeating columns, e g. 'A:A' or 'A:D'
-                                                    if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
-                                                        $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
-                                                    } elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
-                                                        // check for repeating rows, e.g. '1:1' or '1:5'
-                                                        $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
-                                                    }
-                                                }
-                                                break;
-                                            case '_xlnm.Print_Area':
-                                                $rangeSets = explode(',', $extractedRange);        // FIXME: what if sheetname contains comma?
-                                                $newRangeSets = array();
-                                                foreach ($rangeSets as $rangeSet) {
-                                                    $range = explode('!', $rangeSet);    // FIXME: what if sheetname contains exclamation mark?
-                                                    $rangeSet = isset($range[1]) ? $range[1] : $range[0];
-                                                    if (strpos($rangeSet, ':') === false) {
-                                                        $rangeSet = $rangeSet . ':' . $rangeSet;
-                                                    }
-                                                    $newRangeSets[] = str_replace('$', '', $rangeSet);
-                                                }
-                                                $docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
-                                                break;
-
-                                            default:
-                                                break;
-                                        }
-                                    }
-                                }
-                            }
-
-                            // Next sheet id
-                            ++$sheetId;
-                        }
-
-                        // Loop through definedNames
-                        if ($xmlWorkbook->definedNames) {
-                            foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
-                                // Extract range
-                                $extractedRange = (string)$definedName;
-                                $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
-                                if (($spos = strpos($extractedRange, '!')) !== false) {
-                                    $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
-                                } else {
-                                    $extractedRange = str_replace('$', '', $extractedRange);
-                                }
-
-                                // Valid range?
-                                if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') {
-                                    continue;
-                                }
-
-                                // Some definedNames are only applicable if we are on the same sheet...
-                                if ((string)$definedName['localSheetId'] != '') {
-                                    // Local defined name
-                                    // Switch on type
-                                    switch ((string)$definedName['name']) {
-                                        case '_xlnm._FilterDatabase':
-                                        case '_xlnm.Print_Titles':
-                                        case '_xlnm.Print_Area':
-                                            break;
-                                        default:
-                                            if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) {
-                                                $range = explode('!', (string)$definedName);
-                                                if (count($range) == 2) {
-                                                    $range[0] = str_replace("''", "'", $range[0]);
-                                                    $range[0] = str_replace("'", "", $range[0]);
-                                                    if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) {
-                                                        $extractedRange = str_replace('$', '', $range[1]);
-                                                        $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]);
-                                                        $excel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope));
-                                                    }
-                                                }
-                                            }
-                                            break;
-                                    }
-                                } elseif (!isset($definedName['localSheetId'])) {
-                                    // "Global" definedNames
-                                    $locatedSheet = null;
-                                    $extractedSheetName = '';
-                                    if (strpos((string)$definedName, '!') !== false) {
-                                        // Extract sheet name
-                                        $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle((string)$definedName, true);
-                                        $extractedSheetName = $extractedSheetName[0];
-
-                                        // Locate sheet
-                                        $locatedSheet = $excel->getSheetByName($extractedSheetName);
-
-                                        // Modify range
-                                        $range = explode('!', $extractedRange);
-                                        $extractedRange = isset($range[1]) ? $range[1] : $range[0];
-                                    }
-
-                                    if ($locatedSheet !== null) {
-                                        $excel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false));
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    if ((!$this->readDataOnly) || (!empty($this->loadSheetsOnly))) {
-                        // active sheet index
-                        $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index
-
-                        // keep active sheet index if sheet is still loaded, else first sheet is set as the active
-                        if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) {
-                            $excel->setActiveSheetIndex($mapSheetId[$activeTab]);
-                        } else {
-                            if ($excel->getSheetCount() == 0) {
-                                $excel->createSheet();
-                            }
-                            $excel->setActiveSheetIndex(0);
-                        }
-                    }
-                    break;
-            }
-        }
-
-        if (!$this->readDataOnly) {
-            $contentTypes = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-            foreach ($contentTypes->Override as $contentType) {
-                switch ($contentType["ContentType"]) {
-                    case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
-                        if ($this->includeCharts) {
-                            $chartEntryRef = ltrim($contentType['PartName'], '/');
-                            $chartElements = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                            $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
-
-//                            echo 'Chart ', $chartEntryRef, '<br />';
-//                            var_dump($charts[$chartEntryRef]);
-//
-                            if (isset($charts[$chartEntryRef])) {
-                                $chartPositionRef = $charts[$chartEntryRef]['sheet'].'!'.$charts[$chartEntryRef]['id'];
-//                                echo 'Position Ref ', $chartPositionRef, '<br />';
-                                if (isset($chartDetails[$chartPositionRef])) {
-//                                    var_dump($chartDetails[$chartPositionRef]);
-
-                                    $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
-                                    $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
-                                    $objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']);
-                                    $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], $chartDetails[$chartPositionRef]['toOffsetX'], $chartDetails[$chartPositionRef]['toOffsetY']);
-                                }
-                            }
-                        }
-                }
-            }
-        }
-
-        $zip->close();
-
-        return $excel;
-    }
-
-    private static function readColor($color, $background = false)
-    {
-        if (isset($color["rgb"])) {
-            return (string)$color["rgb"];
-        } elseif (isset($color["indexed"])) {
-            return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
-        } elseif (isset($color["theme"])) {
-            if (self::$theme !== null) {
-                $returnColour = self::$theme->getColourByIndex((int)$color["theme"]);
-                if (isset($color["tint"])) {
-                    $tintAdjust = (float) $color["tint"];
-                    $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust);
-                }
-                return 'FF'.$returnColour;
-            }
-        }
-
-        if ($background) {
-            return 'FFFFFFFF';
-        }
-        return 'FF000000';
-    }
-
-    private static function readStyle($docStyle, $style)
-    {
-        // format code
-//        if (isset($style->numFmt)) {
-//            if (isset($style->numFmt['formatCode'])) {
-//                $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
-//            } else {
-                $docStyle->getNumberFormat()->setFormatCode($style->numFmt);
-//            }
-//        }
-
-        // font
-        if (isset($style->font)) {
-            $docStyle->getFont()->setName((string) $style->font->name["val"]);
-            $docStyle->getFont()->setSize((string) $style->font->sz["val"]);
-            if (isset($style->font->b)) {
-                $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || self::boolean((string) $style->font->b["val"]));
-            }
-            if (isset($style->font->i)) {
-                $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || self::boolean((string) $style->font->i["val"]));
-            }
-            if (isset($style->font->strike)) {
-                $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || self::boolean((string) $style->font->strike["val"]));
-            }
-            $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color));
-
-            if (isset($style->font->u) && !isset($style->font->u["val"])) {
-                $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
-            } elseif (isset($style->font->u) && isset($style->font->u["val"])) {
-                $docStyle->getFont()->setUnderline((string)$style->font->u["val"]);
-            }
-
-            if (isset($style->font->vertAlign) && isset($style->font->vertAlign["val"])) {
-                $vertAlign = strtolower((string)$style->font->vertAlign["val"]);
-                if ($vertAlign == 'superscript') {
-                    $docStyle->getFont()->setSuperScript(true);
-                }
-                if ($vertAlign == 'subscript') {
-                    $docStyle->getFont()->setSubScript(true);
-                }
-            }
-        }
-
-        // fill
-        if (isset($style->fill)) {
-            if ($style->fill->gradientFill) {
-                $gradientFill = $style->fill->gradientFill[0];
-                if (!empty($gradientFill["type"])) {
-                    $docStyle->getFill()->setFillType((string) $gradientFill["type"]);
-                }
-                $docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
-                $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
-                $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath("sml:stop[@position=0]"))->color));
-                $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath("sml:stop[@position=1]"))->color));
-            } elseif ($style->fill->patternFill) {
-                $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
-                $docStyle->getFill()->setFillType($patternType);
-                if ($style->fill->patternFill->fgColor) {
-                    $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true));
-                } else {
-                    $docStyle->getFill()->getStartColor()->setARGB('FF000000');
-                }
-                if ($style->fill->patternFill->bgColor) {
-                    $docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true));
-                }
-            }
-        }
-
-        // border
-        if (isset($style->border)) {
-            $diagonalUp = self::boolean((string) $style->border["diagonalUp"]);
-            $diagonalDown = self::boolean((string) $style->border["diagonalDown"]);
-            if (!$diagonalUp && !$diagonalDown) {
-                $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE);
-            } elseif ($diagonalUp && !$diagonalDown) {
-                $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP);
-            } elseif (!$diagonalUp && $diagonalDown) {
-                $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN);
-            } else {
-                $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH);
-            }
-            self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
-            self::readBorder($docStyle->getBorders()->getRight(), $style->border->right);
-            self::readBorder($docStyle->getBorders()->getTop(), $style->border->top);
-            self::readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom);
-            self::readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal);
-        }
-
-        // alignment
-        if (isset($style->alignment)) {
-            $docStyle->getAlignment()->setHorizontal((string) $style->alignment["horizontal"]);
-            $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]);
-
-            $textRotation = 0;
-            if ((int)$style->alignment["textRotation"] <= 90) {
-                $textRotation = (int)$style->alignment["textRotation"];
-            } elseif ((int)$style->alignment["textRotation"] > 90) {
-                $textRotation = 90 - (int)$style->alignment["textRotation"];
-            }
-
-            $docStyle->getAlignment()->setTextRotation(intval($textRotation));
-            $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment["wrapText"]));
-            $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment["shrinkToFit"]));
-            $docStyle->getAlignment()->setIndent(intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0);
-            $docStyle->getAlignment()->setReadorder(intval((string)$style->alignment["readingOrder"]) > 0 ? intval((string)$style->alignment["readingOrder"]) : 0);
-        }
-
-        // protection
-        if (isset($style->protection)) {
-            if (isset($style->protection['locked'])) {
-                if (self::boolean((string) $style->protection['locked'])) {
-                    $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
-                } else {
-                    $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
-                }
-            }
-
-            if (isset($style->protection['hidden'])) {
-                if (self::boolean((string) $style->protection['hidden'])) {
-                    $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
-                } else {
-                    $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
-                }
-            }
-        }
-
-        // top-level style settings
-        if (isset($style->quotePrefix)) {
-            $docStyle->setQuotePrefix($style->quotePrefix);
-        }
-    }
-
-    private static function readBorder($docBorder, $eleBorder)
-    {
-        if (isset($eleBorder["style"])) {
-            $docBorder->setBorderStyle((string) $eleBorder["style"]);
-        }
-        if (isset($eleBorder->color)) {
-            $docBorder->getColor()->setARGB(self::readColor($eleBorder->color));
-        }
-    }
-
-    private function parseRichText($is = null)
-    {
-        $value = new PHPExcel_RichText();
-
-        if (isset($is->t)) {
-            $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $is->t));
-        } else {
-            if (is_object($is->r)) {
-                foreach ($is->r as $run) {
-                    if (!isset($run->rPr)) {
-                        $objText = $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t));
-
-                    } else {
-                        $objText = $value->createTextRun(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t));
-
-                        if (isset($run->rPr->rFont["val"])) {
-                            $objText->getFont()->setName((string) $run->rPr->rFont["val"]);
-                        }
-                        if (isset($run->rPr->sz["val"])) {
-                            $objText->getFont()->setSize((string) $run->rPr->sz["val"]);
-                        }
-                        if (isset($run->rPr->color)) {
-                            $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($run->rPr->color)));
-                        }
-                        if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) ||
-                            (isset($run->rPr->b) && !isset($run->rPr->b["val"]))) {
-                            $objText->getFont()->setBold(true);
-                        }
-                        if ((isset($run->rPr->i["val"]) && self::boolean((string) $run->rPr->i["val"])) ||
-                            (isset($run->rPr->i) && !isset($run->rPr->i["val"]))) {
-                            $objText->getFont()->setItalic(true);
-                        }
-                        if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) {
-                            $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]);
-                            if ($vertAlign == 'superscript') {
-                                $objText->getFont()->setSuperScript(true);
-                            }
-                            if ($vertAlign == 'subscript') {
-                                $objText->getFont()->setSubScript(true);
-                            }
-                        }
-                        if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) {
-                            $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
-                        } elseif (isset($run->rPr->u) && isset($run->rPr->u["val"])) {
-                            $objText->getFont()->setUnderline((string)$run->rPr->u["val"]);
-                        }
-                        if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) ||
-                            (isset($run->rPr->strike) && !isset($run->rPr->strike["val"]))) {
-                            $objText->getFont()->setStrikethrough(true);
-                        }
-                    }
-                }
-            }
-        }
-
-        return $value;
-    }
-
-    private function readRibbon($excel, $customUITarget, $zip)
-    {
-        $baseDir = dirname($customUITarget);
-        $nameCustomUI = basename($customUITarget);
-        // get the xml file (ribbon)
-        $localRibbon = $this->getFromZipArchive($zip, $customUITarget);
-        $customUIImagesNames = array();
-        $customUIImagesBinaries = array();
-        // something like customUI/_rels/customUI.xml.rels
-        $pathRels = $baseDir . '/_rels/' . $nameCustomUI . '.rels';
-        $dataRels = $this->getFromZipArchive($zip, $pathRels);
-        if ($dataRels) {
-            // exists and not empty if the ribbon have some pictures (other than internal MSO)
-            $UIRels = simplexml_load_string($this->securityScan($dataRels), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-            if ($UIRels) {
-                // we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
-                foreach ($UIRels->Relationship as $ele) {
-                    if ($ele["Type"] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') {
-                        // an image ?
-                        $customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target'];
-                        $customUIImagesBinaries[(string)$ele['Target']] = $this->getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']);
-                    }
-                }
-            }
-        }
-        if ($localRibbon) {
-            $excel->setRibbonXMLData($customUITarget, $localRibbon);
-            if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) {
-                $excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries);
-            } else {
-                $excel->setRibbonBinObjects(null);
-            }
-        } else {
-            $excel->setRibbonXMLData(null);
-            $excel->setRibbonBinObjects(null);
-        }
-    }
-
-    private static function getArrayItem($array, $key = 0)
-    {
-        return (isset($array[$key]) ? $array[$key] : null);
-    }
-
-    private static function dirAdd($base, $add)
-    {
-        return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
-    }
-
-    private static function toCSSArray($style)
-    {
-        $style = str_replace(array("\r","\n"), "", $style);
-
-        $temp = explode(';', $style);
-        $style = array();
-        foreach ($temp as $item) {
-            $item = explode(':', $item);
-
-            if (strpos($item[1], 'px') !== false) {
-                $item[1] = str_replace('px', '', $item[1]);
-            }
-            if (strpos($item[1], 'pt') !== false) {
-                $item[1] = str_replace('pt', '', $item[1]);
-                $item[1] = PHPExcel_Shared_Font::fontSizeToPixels($item[1]);
-            }
-            if (strpos($item[1], 'in') !== false) {
-                $item[1] = str_replace('in', '', $item[1]);
-                $item[1] = PHPExcel_Shared_Font::inchSizeToPixels($item[1]);
-            }
-            if (strpos($item[1], 'cm') !== false) {
-                $item[1] = str_replace('cm', '', $item[1]);
-                $item[1] = PHPExcel_Shared_Font::centimeterSizeToPixels($item[1]);
-            }
-
-            $style[$item[0]] = $item[1];
-        }
-
-        return $style;
-    }
-
-    private static function boolean($value = null)
-    {
-        if (is_object($value)) {
-            $value = (string) $value;
-        }
-        if (is_numeric($value)) {
-            return (bool) $value;
-        }
-        return ($value === 'true' || $value === 'TRUE');
-    }
-}

+ 0 - 520
libs/PHPExcel/PHPExcel/Reader/Excel2007/Chart.php

xqd
@@ -1,520 +0,0 @@
-<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category    PHPExcel
- * @package        PHPExcel_Reader_Excel2007
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version        ##VERSION##, ##DATE##
- */
-
-/**
- * PHPExcel_Reader_Excel2007_Chart
- *
- * @category    PHPExcel
- * @package        PHPExcel_Reader_Excel2007
- * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Reader_Excel2007_Chart
-{
-    private static function getAttribute($component, $name, $format)
-    {
-        $attributes = $component->attributes();
-        if (isset($attributes[$name])) {
-            if ($format == 'string') {
-                return (string) $attributes[$name];
-            } elseif ($format == 'integer') {
-                return (integer) $attributes[$name];
-            } elseif ($format == 'boolean') {
-                return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
-            } else {
-                return (float) $attributes[$name];
-            }
-        }
-        return null;
-    }
-
-
-    private static function readColor($color, $background = false)
-    {
-        if (isset($color["rgb"])) {
-            return (string)$color["rgb"];
-        } elseif (isset($color["indexed"])) {
-            return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
-        }
-    }
-
-    public static function readChart($chartElements, $chartName)
-    {
-        $namespacesChartMeta = $chartElements->getNamespaces(true);
-        $chartElementsC = $chartElements->children($namespacesChartMeta['c']);
-
-        $XaxisLabel = $YaxisLabel = $legend = $title = null;
-        $dispBlanksAs = $plotVisOnly = null;
-
-        foreach ($chartElementsC as $chartElementKey => $chartElement) {
-            switch ($chartElementKey) {
-                case "chart":
-                    foreach ($chartElement as $chartDetailsKey => $chartDetails) {
-                        $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
-                        switch ($chartDetailsKey) {
-                            case "plotArea":
-                                $plotAreaLayout = $XaxisLable = $YaxisLable = null;
-                                $plotSeries = $plotAttributes = array();
-                                foreach ($chartDetails as $chartDetailKey => $chartDetail) {
-                                    switch ($chartDetailKey) {
-                                        case "layout":
-                                            $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
-                                            break;
-                                        case "catAx":
-                                            if (isset($chartDetail->title)) {
-                                                $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
-                                            }
-                                            break;
-                                        case "dateAx":
-                                            if (isset($chartDetail->title)) {
-                                                $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
-                                            }
-                                            break;
-                                        case "valAx":
-                                            if (isset($chartDetail->title)) {
-                                                $YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
-                                            }
-                                            break;
-                                        case "barChart":
-                                        case "bar3DChart":
-                                            $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string');
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotDirection($barDirection);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "lineChart":
-                                        case "line3DChart":
-                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "areaChart":
-                                        case "area3DChart":
-                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "doughnutChart":
-                                        case "pieChart":
-                                        case "pie3DChart":
-                                            $explosion = isset($chartDetail->ser->explosion);
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotStyle($explosion);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "scatterChart":
-                                            $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string');
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotStyle($scatterStyle);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "bubbleChart":
-                                            $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer');
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotStyle($bubbleScale);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "radarChart":
-                                            $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string');
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotStyle($radarStyle);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "surfaceChart":
-                                        case "surface3DChart":
-                                            $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean');
-                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotSer->setPlotStyle($wireFrame);
-                                            $plotSeries[] = $plotSer;
-                                            $plotAttributes = self::readChartAttributes($chartDetail);
-                                            break;
-                                        case "stockChart":
-                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
-                                            $plotAttributes = self::readChartAttributes($plotAreaLayout);
-                                            break;
-                                    }
-                                }
-                                if ($plotAreaLayout == null) {
-                                    $plotAreaLayout = new PHPExcel_Chart_Layout();
-                                }
-                                $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
-                                self::setChartAttributes($plotAreaLayout, $plotAttributes);
-                                break;
-                            case "plotVisOnly":
-                                $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string');
-                                break;
-                            case "dispBlanksAs":
-                                $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string');
-                                break;
-                            case "title":
-                                $title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title');
-                                break;
-                            case "legend":
-                                $legendPos = 'r';
-                                $legendLayout = null;
-                                $legendOverlay = false;
-                                foreach ($chartDetails as $chartDetailKey => $chartDetail) {
-                                    switch ($chartDetailKey) {
-                                        case "legendPos":
-                                            $legendPos = self::getAttribute($chartDetail, 'val', 'string');
-                                            break;
-                                        case "overlay":
-                                            $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean');
-                                            break;
-                                        case "layout":
-                                            $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
-                                            break;
-                                    }
-                                }
-                                $legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay);
-                                break;
-                        }
-                    }
-            }
-        }
-        $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
-
-        return $chart;
-    }
-
-    private static function chartTitle($titleDetails, $namespacesChartMeta, $type)
-    {
-        $caption = array();
-        $titleLayout = null;
-        foreach ($titleDetails as $titleDetailKey => $chartDetail) {
-            switch ($titleDetailKey) {
-                case "tx":
-                    $titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
-                    foreach ($titleDetails as $titleKey => $titleDetail) {
-                        switch ($titleKey) {
-                            case "p":
-                                $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
-                                $caption[] = self::parseRichText($titleDetailPart);
-                        }
-                    }
-                    break;
-                case "layout":
-                    $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta);
-                    break;
-            }
-        }
-
-        return new PHPExcel_Chart_Title($caption, $titleLayout);
-    }
-
-    private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
-    {
-        if (!isset($chartDetail->manualLayout)) {
-            return null;
-        }
-        $details = $chartDetail->manualLayout->children($namespacesChartMeta['c']);
-        if (is_null($details)) {
-            return null;
-        }
-        $layout = array();
-        foreach ($details as $detailKey => $detail) {
-//            echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
-            $layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
-        }
-        return new PHPExcel_Chart_Layout($layout);
-    }
-
-    private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
-    {
-        $multiSeriesType = null;
-        $smoothLine = false;
-        $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
-
-        $seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
-        foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
-            switch ($seriesDetailKey) {
-                case "grouping":
-                    $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string');
-                    break;
-                case "ser":
-                    $marker = null;
-                    foreach ($seriesDetails as $seriesKey => $seriesDetail) {
-                        switch ($seriesKey) {
-                            case "idx":
-                                $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
-                                break;
-                            case "order":
-                                $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer');
-                                $plotOrder[$seriesIndex] = $seriesOrder;
-                                break;
-                            case "tx":
-                                $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
-                                break;
-                            case "marker":
-                                $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string');
-                                break;
-                            case "smooth":
-                                $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean');
-                                break;
-                            case "cat":
-                                $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
-                                break;
-                            case "val":
-                                $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
-                                break;
-                            case "xVal":
-                                $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
-                                break;
-                            case "yVal":
-                                $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
-                                break;
-                        }
-                    }
-            }
-        }
-        return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
-    }
-
-
-    private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false)
-    {
-        if (isset($seriesDetail->strRef)) {
-            $seriesSource = (string) $seriesDetail->strRef->f;
-            $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
-
-            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
-        } elseif (isset($seriesDetail->numRef)) {
-            $seriesSource = (string) $seriesDetail->numRef->f;
-            $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
-
-            return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
-        } elseif (isset($seriesDetail->multiLvlStrRef)) {
-            $seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
-            $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
-            $seriesData['pointCount'] = count($seriesData['dataValues']);
-
-            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
-        } elseif (isset($seriesDetail->multiLvlNumRef)) {
-            $seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
-            $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
-            $seriesData['pointCount'] = count($seriesData['dataValues']);
-
-            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
-        }
-        return null;
-    }
-
-
-    private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n')
-    {
-        $seriesVal = array();
-        $formatCode = '';
-        $pointCount = 0;
-
-        foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
-            switch ($seriesValueIdx) {
-                case 'ptCount':
-                    $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
-                    break;
-                case 'formatCode':
-                    $formatCode = (string) $seriesValue;
-                    break;
-                case 'pt':
-                    $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
-                    if ($dataType == 's') {
-                        $seriesVal[$pointVal] = (string) $seriesValue->v;
-                    } else {
-                        $seriesVal[$pointVal] = (float) $seriesValue->v;
-                    }
-                    break;
-            }
-        }
-
-        return array(
-            'formatCode'    => $formatCode,
-            'pointCount'    => $pointCount,
-            'dataValues'    => $seriesVal
-        );
-    }
-
-    private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n')
-    {
-        $seriesVal = array();
-        $formatCode = '';
-        $pointCount = 0;
-
-        foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
-            foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
-                switch ($seriesValueIdx) {
-                    case 'ptCount':
-                        $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
-                        break;
-                    case 'formatCode':
-                        $formatCode = (string) $seriesValue;
-                        break;
-                    case 'pt':
-                        $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
-                        if ($dataType == 's') {
-                            $seriesVal[$pointVal][] = (string) $seriesValue->v;
-                        } else {
-                            $seriesVal[$pointVal][] = (float) $seriesValue->v;
-                        }
-                        break;
-                }
-            }
-        }
-
-        return array(
-            'formatCode'    => $formatCode,
-            'pointCount'    => $pointCount,
-            'dataValues'    => $seriesVal
-        );
-    }
-
-    private static function parseRichText($titleDetailPart = null)
-    {
-        $value = new PHPExcel_RichText();
-
-        foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
-            if (isset($titleDetailElement->t)) {
-                $objText = $value->createTextRun((string) $titleDetailElement->t);
-            }
-            if (isset($titleDetailElement->rPr)) {
-                if (isset($titleDetailElement->rPr->rFont["val"])) {
-                    $objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
-                }
-
-                $fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
-                if (!is_null($fontSize)) {
-                    $objText->getFont()->setSize(floor($fontSize / 100));
-                }
-
-                $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
-                if (!is_null($fontColor)) {
-                    $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor)));
-                }
-
-                $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
-                if (!is_null($bold)) {
-                    $objText->getFont()->setBold($bold);
-                }
-
-                $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean');
-                if (!is_null($italic)) {
-                    $objText->getFont()->setItalic($italic);
-                }
-
-                $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
-                if (!is_null($baseline)) {
-                    if ($baseline > 0) {
-                        $objText->getFont()->setSuperScript(true);
-                    } elseif ($baseline < 0) {
-                        $objText->getFont()->setSubScript(true);
-                    }
-                }
-
-                $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
-                if (!is_null($underscore)) {
-                    if ($underscore == 'sng') {
-                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
-                    } elseif ($underscore == 'dbl') {
-                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
-                    } else {
-                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
-                    }
-                }
-
-                $strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string'));
-                if (!is_null($strikethrough)) {
-                    if ($strikethrough == 'noStrike') {
-                        $objText->getFont()->setStrikethrough(false);
-                    } else {
-                        $objText->getFont()->setStrikethrough(true);
-                    }
-                }
-            }
-        }
-
-        return $value;
-    }
-
-    private static function readChartAttributes($chartDetail)
-    {
-        $plotAttributes = array();
-        if (isset($chartDetail->dLbls)) {
-            if (isset($chartDetail->dLbls->howLegendKey)) {
-                $plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showVal)) {
-                $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showCatName)) {
-                $plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showSerName)) {
-                $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showPercent)) {
-                $plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showBubbleSize)) {
-                $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
-            }
-            if (isset($chartDetail->dLbls->showLeaderLines)) {
-                $plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
-            }
-        }
-
-        return $plotAttributes;
-    }
-
-    private static function setChartAttributes($plotArea, $plotAttributes)
-    {
-        foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
-            switch ($plotAttributeKey) {
-                case 'showLegendKey':
-                    $plotArea->setShowLegendKey($plotAttributeValue);
-                    break;
-                case 'showVal':
-                    $plotArea->setShowVal($plotAttributeValue);
-                    break;
-                case 'showCatName':
-                    $plotArea->setShowCatName($plotAttributeValue);
-                    break;
-                case 'showSerName':
-                    $plotArea->setShowSerName($plotAttributeValue);
-                    break;
-                case 'showPercent':
-                    $plotArea->setShowPercent($plotAttributeValue);
-                    break;
-                case 'showBubbleSize':
-                    $plotArea->setShowBubbleSize($plotAttributeValue);
-                    break;
-                case 'showLeaderLines':
-                    $plotArea->setShowLeaderLines($plotAttributeValue);
-                    break;
-            }
-        }
-    }
-}

+ 0 - 127
libs/PHPExcel/PHPExcel/Reader/Excel2007/Theme.php

xqd
@@ -1,127 +0,0 @@
-<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel2007
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-
-/**
- * PHPExcel_Reader_Excel2007_Theme
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel2007
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Reader_Excel2007_Theme
-{
-    /**
-     * Theme Name
-     *
-     * @var string
-     */
-    private $themeName;
-
-    /**
-     * Colour Scheme Name
-     *
-     * @var string
-     */
-    private $colourSchemeName;
-
-    /**
-     * Colour Map indexed by position
-     *
-     * @var array of string
-     */
-    private $colourMapValues;
-
-
-    /**
-     * Colour Map
-     *
-     * @var array of string
-     */
-    private $colourMap;
-
-
-    /**
-     * Create a new PHPExcel_Theme
-     *
-     */
-    public function __construct($themeName, $colourSchemeName, $colourMap)
-    {
-        // Initialise values
-        $this->themeName        = $themeName;
-        $this->colourSchemeName = $colourSchemeName;
-        $this->colourMap        = $colourMap;
-    }
-
-    /**
-     * Get Theme Name
-     *
-     * @return string
-     */
-    public function getThemeName()
-    {
-        return $this->themeName;
-    }
-
-    /**
-     * Get colour Scheme Name
-     *
-     * @return string
-     */
-    public function getColourSchemeName()
-    {
-        return $this->colourSchemeName;
-    }
-
-    /**
-     * Get colour Map Value by Position
-     *
-     * @return string
-     */
-    public function getColourByIndex($index = 0)
-    {
-        if (isset($this->colourMap[$index])) {
-            return $this->colourMap[$index];
-        }
-        return null;
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if ((is_object($value)) && ($key != '_parent')) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 7594
libs/PHPExcel/PHPExcel/Reader/Excel5.php

xqd
@@ -1,7594 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_Excel5
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel5
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-
-// Original file header of ParseXL (used as the base for this class):
-// --------------------------------------------------------------------------------
-// Adapted from Excel_Spreadsheet_Reader developed by users bizon153,
-// trex005, and mmp11 (SourceForge.net)
-// http://sourceforge.net/projects/phpexcelreader/
-// Primary changes made by canyoncasa (dvc) for ParseXL 1.00 ...
-//     Modelled moreso after Perl Excel Parse/Write modules
-//     Added Parse_Excel_Spreadsheet object
-//         Reads a whole worksheet or tab as row,column array or as
-//         associated hash of indexed rows and named column fields
-//     Added variables for worksheet (tab) indexes and names
-//     Added an object call for loading individual woorksheets
-//     Changed default indexing defaults to 0 based arrays
-//     Fixed date/time and percent formats
-//     Includes patches found at SourceForge...
-//         unicode patch by nobody
-//         unpack("d") machine depedency patch by matchy
-//         boundsheet utf16 patch by bjaenichen
-//     Renamed functions for shorter names
-//     General code cleanup and rigor, including <80 column width
-//     Included a testcase Excel file and PHP example calls
-//     Code works for PHP 5.x
-
-// Primary changes made by canyoncasa (dvc) for ParseXL 1.10 ...
-// http://sourceforge.net/tracker/index.php?func=detail&aid=1466964&group_id=99160&atid=623334
-//     Decoding of formula conditions, results, and tokens.
-//     Support for user-defined named cells added as an array "namedcells"
-//         Patch code for user-defined named cells supports single cells only.
-//         NOTE: this patch only works for BIFF8 as BIFF5-7 use a different
-//         external sheet reference structure
-class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    // ParseXL definitions
-    const XLS_BIFF8                     = 0x0600;
-    const XLS_BIFF7                     = 0x0500;
-    const XLS_WorkbookGlobals           = 0x0005;
-    const XLS_Worksheet                 = 0x0010;
-
-    // record identifiers
-    const XLS_TYPE_FORMULA              = 0x0006;
-    const XLS_TYPE_EOF                  = 0x000a;
-    const XLS_TYPE_PROTECT              = 0x0012;
-    const XLS_TYPE_OBJECTPROTECT        = 0x0063;
-    const XLS_TYPE_SCENPROTECT          = 0x00dd;
-    const XLS_TYPE_PASSWORD             = 0x0013;
-    const XLS_TYPE_HEADER               = 0x0014;
-    const XLS_TYPE_FOOTER               = 0x0015;
-    const XLS_TYPE_EXTERNSHEET          = 0x0017;
-    const XLS_TYPE_DEFINEDNAME          = 0x0018;
-    const XLS_TYPE_VERTICALPAGEBREAKS   = 0x001a;
-    const XLS_TYPE_HORIZONTALPAGEBREAKS = 0x001b;
-    const XLS_TYPE_NOTE                 = 0x001c;
-    const XLS_TYPE_SELECTION            = 0x001d;
-    const XLS_TYPE_DATEMODE             = 0x0022;
-    const XLS_TYPE_EXTERNNAME           = 0x0023;
-    const XLS_TYPE_LEFTMARGIN           = 0x0026;
-    const XLS_TYPE_RIGHTMARGIN          = 0x0027;
-    const XLS_TYPE_TOPMARGIN            = 0x0028;
-    const XLS_TYPE_BOTTOMMARGIN         = 0x0029;
-    const XLS_TYPE_PRINTGRIDLINES       = 0x002b;
-    const XLS_TYPE_FILEPASS             = 0x002f;
-    const XLS_TYPE_FONT                 = 0x0031;
-    const XLS_TYPE_CONTINUE             = 0x003c;
-    const XLS_TYPE_PANE                 = 0x0041;
-    const XLS_TYPE_CODEPAGE             = 0x0042;
-    const XLS_TYPE_DEFCOLWIDTH          = 0x0055;
-    const XLS_TYPE_OBJ                  = 0x005d;
-    const XLS_TYPE_COLINFO              = 0x007d;
-    const XLS_TYPE_IMDATA               = 0x007f;
-    const XLS_TYPE_SHEETPR              = 0x0081;
-    const XLS_TYPE_HCENTER              = 0x0083;
-    const XLS_TYPE_VCENTER              = 0x0084;
-    const XLS_TYPE_SHEET                = 0x0085;
-    const XLS_TYPE_PALETTE              = 0x0092;
-    const XLS_TYPE_SCL                  = 0x00a0;
-    const XLS_TYPE_PAGESETUP            = 0x00a1;
-    const XLS_TYPE_MULRK                = 0x00bd;
-    const XLS_TYPE_MULBLANK             = 0x00be;
-    const XLS_TYPE_DBCELL               = 0x00d7;
-    const XLS_TYPE_XF                   = 0x00e0;
-    const XLS_TYPE_MERGEDCELLS          = 0x00e5;
-    const XLS_TYPE_MSODRAWINGGROUP      = 0x00eb;
-    const XLS_TYPE_MSODRAWING           = 0x00ec;
-    const XLS_TYPE_SST                  = 0x00fc;
-    const XLS_TYPE_LABELSST             = 0x00fd;
-    const XLS_TYPE_EXTSST               = 0x00ff;
-    const XLS_TYPE_EXTERNALBOOK         = 0x01ae;
-    const XLS_TYPE_DATAVALIDATIONS      = 0x01b2;
-    const XLS_TYPE_TXO                  = 0x01b6;
-    const XLS_TYPE_HYPERLINK            = 0x01b8;
-    const XLS_TYPE_DATAVALIDATION       = 0x01be;
-    const XLS_TYPE_DIMENSION            = 0x0200;
-    const XLS_TYPE_BLANK                = 0x0201;
-    const XLS_TYPE_NUMBER               = 0x0203;
-    const XLS_TYPE_LABEL                = 0x0204;
-    const XLS_TYPE_BOOLERR              = 0x0205;
-    const XLS_TYPE_STRING               = 0x0207;
-    const XLS_TYPE_ROW                  = 0x0208;
-    const XLS_TYPE_INDEX                = 0x020b;
-    const XLS_TYPE_ARRAY                = 0x0221;
-    const XLS_TYPE_DEFAULTROWHEIGHT     = 0x0225;
-    const XLS_TYPE_WINDOW2              = 0x023e;
-    const XLS_TYPE_RK                   = 0x027e;
-    const XLS_TYPE_STYLE                = 0x0293;
-    const XLS_TYPE_FORMAT               = 0x041e;
-    const XLS_TYPE_SHAREDFMLA           = 0x04bc;
-    const XLS_TYPE_BOF                  = 0x0809;
-    const XLS_TYPE_SHEETPROTECTION      = 0x0867;
-    const XLS_TYPE_RANGEPROTECTION      = 0x0868;
-    const XLS_TYPE_SHEETLAYOUT          = 0x0862;
-    const XLS_TYPE_XFEXT                = 0x087d;
-    const XLS_TYPE_PAGELAYOUTVIEW       = 0x088b;
-    const XLS_TYPE_UNKNOWN              = 0xffff;
-
-    // Encryption type
-    const MS_BIFF_CRYPTO_NONE           = 0;
-    const MS_BIFF_CRYPTO_XOR            = 1;
-    const MS_BIFF_CRYPTO_RC4            = 2;
-    
-    // Size of stream blocks when using RC4 encryption
-    const REKEY_BLOCK                   = 0x400;
-
-    /**
-     * Summary Information stream data.
-     *
-     * @var string
-     */
-    private $summaryInformation;
-
-    /**
-     * Extended Summary Information stream data.
-     *
-     * @var string
-     */
-    private $documentSummaryInformation;
-
-    /**
-     * User-Defined Properties stream data.
-     *
-     * @var string
-     */
-    private $userDefinedProperties;
-
-    /**
-     * Workbook stream data. (Includes workbook globals substream as well as sheet substreams)
-     *
-     * @var string
-     */
-    private $data;
-
-    /**
-     * Size in bytes of $this->data
-     *
-     * @var int
-     */
-    private $dataSize;
-
-    /**
-     * Current position in stream
-     *
-     * @var integer
-     */
-    private $pos;
-
-    /**
-     * Workbook to be returned by the reader.
-     *
-     * @var PHPExcel
-     */
-    private $phpExcel;
-
-    /**
-     * Worksheet that is currently being built by the reader.
-     *
-     * @var PHPExcel_Worksheet
-     */
-    private $phpSheet;
-
-    /**
-     * BIFF version
-     *
-     * @var int
-     */
-    private $version;
-
-    /**
-     * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95)
-     * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE'
-     *
-     * @var string
-     */
-    private $codepage;
-
-    /**
-     * Shared formats
-     *
-     * @var array
-     */
-    private $formats;
-
-    /**
-     * Shared fonts
-     *
-     * @var array
-     */
-    private $objFonts;
-
-    /**
-     * Color palette
-     *
-     * @var array
-     */
-    private $palette;
-
-    /**
-     * Worksheets
-     *
-     * @var array
-     */
-    private $sheets;
-
-    /**
-     * External books
-     *
-     * @var array
-     */
-    private $externalBooks;
-
-    /**
-     * REF structures. Only applies to BIFF8.
-     *
-     * @var array
-     */
-    private $ref;
-
-    /**
-     * External names
-     *
-     * @var array
-     */
-    private $externalNames;
-
-    /**
-     * Defined names
-     *
-     * @var array
-     */
-    private $definedname;
-
-    /**
-     * Shared strings. Only applies to BIFF8.
-     *
-     * @var array
-     */
-    private $sst;
-
-    /**
-     * Panes are frozen? (in sheet currently being read). See WINDOW2 record.
-     *
-     * @var boolean
-     */
-    private $frozen;
-
-    /**
-     * Fit printout to number of pages? (in sheet currently being read). See SHEETPR record.
-     *
-     * @var boolean
-     */
-    private $isFitToPages;
-
-    /**
-     * Objects. One OBJ record contributes with one entry.
-     *
-     * @var array
-     */
-    private $objs;
-
-    /**
-     * Text Objects. One TXO record corresponds with one entry.
-     *
-     * @var array
-     */
-    private $textObjects;
-
-    /**
-     * Cell Annotations (BIFF8)
-     *
-     * @var array
-     */
-    private $cellNotes;
-
-    /**
-     * The combined MSODRAWINGGROUP data
-     *
-     * @var string
-     */
-    private $drawingGroupData;
-
-    /**
-     * The combined MSODRAWING data (per sheet)
-     *
-     * @var string
-     */
-    private $drawingData;
-
-    /**
-     * Keep track of XF index
-     *
-     * @var int
-     */
-    private $xfIndex;
-
-    /**
-     * Mapping of XF index (that is a cell XF) to final index in cellXf collection
-     *
-     * @var array
-     */
-    private $mapCellXfIndex;
-
-    /**
-     * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection
-     *
-     * @var array
-     */
-    private $mapCellStyleXfIndex;
-
-    /**
-     * The shared formulas in a sheet. One SHAREDFMLA record contributes with one value.
-     *
-     * @var array
-     */
-    private $sharedFormulas;
-
-    /**
-     * The shared formula parts in a sheet. One FORMULA record contributes with one value if it
-     * refers to a shared formula.
-     *
-     * @var array
-     */
-    private $sharedFormulaParts;
-
-    /**
-     * The type of encryption in use
-     *
-     * @var int
-     */
-    private $encryption = 0;
-    
-    /**
-     * The position in the stream after which contents are encrypted
-     *
-     * @var int
-     */
-    private $encryptionStartPos = false;
-
-    /**
-     * The current RC4 decryption object
-     *
-     * @var PHPExcel_Reader_Excel5_RC4
-     */
-    private $rc4Key = null;
-
-    /**
-     * The position in the stream that the RC4 decryption object was left at
-     *
-     * @var int
-     */
-    private $rc4Pos = 0;
-
-    /**
-     * The current MD5 context state
-     *
-     * @var string
-     */
-    private $md5Ctxt = null;
-
-    /**
-     * Create a new PHPExcel_Reader_Excel5 instance
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        try {
-            // Use ParseXL for the hard work.
-            $ole = new PHPExcel_Shared_OLERead();
-
-            // get excel data
-            $res = $ole->read($pFilename);
-            return true;
-        } catch (PHPExcel_Exception $e) {
-            return false;
-        }
-    }
-
-    /**
-     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
-     *
-     * @param     string         $pFilename
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function listWorksheetNames($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetNames = array();
-
-        // Read the OLE file
-        $this->loadOLE($pFilename);
-
-        // total byte size of Excel data (workbook global substream + sheet substreams)
-        $this->dataSize = strlen($this->data);
-
-        $this->pos        = 0;
-        $this->sheets    = array();
-
-        // Parse Workbook Global Substream
-        while ($this->pos < $this->dataSize) {
-            $code = self::getInt2d($this->data, $this->pos);
-
-            switch ($code) {
-                case self::XLS_TYPE_BOF:
-                    $this->readBof();
-                    break;
-                case self::XLS_TYPE_SHEET:
-                    $this->readSheet();
-                    break;
-                case self::XLS_TYPE_EOF:
-                    $this->readDefault();
-                    break 2;
-                default:
-                    $this->readDefault();
-                    break;
-            }
-        }
-
-        foreach ($this->sheets as $sheet) {
-            if ($sheet['sheetType'] != 0x00) {
-                // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module
-                continue;
-            }
-
-            $worksheetNames[] = $sheet['name'];
-        }
-
-        return $worksheetNames;
-    }
-
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetInfo = array();
-
-        // Read the OLE file
-        $this->loadOLE($pFilename);
-
-        // total byte size of Excel data (workbook global substream + sheet substreams)
-        $this->dataSize = strlen($this->data);
-
-        // initialize
-        $this->pos    = 0;
-        $this->sheets = array();
-
-        // Parse Workbook Global Substream
-        while ($this->pos < $this->dataSize) {
-            $code = self::getInt2d($this->data, $this->pos);
-
-            switch ($code) {
-                case self::XLS_TYPE_BOF:
-                    $this->readBof();
-                    break;
-                case self::XLS_TYPE_SHEET:
-                    $this->readSheet();
-                    break;
-                case self::XLS_TYPE_EOF:
-                    $this->readDefault();
-                    break 2;
-                default:
-                    $this->readDefault();
-                    break;
-            }
-        }
-
-        // Parse the individual sheets
-        foreach ($this->sheets as $sheet) {
-            if ($sheet['sheetType'] != 0x00) {
-                // 0x00: Worksheet
-                // 0x02: Chart
-                // 0x06: Visual Basic module
-                continue;
-            }
-
-            $tmpInfo = array();
-            $tmpInfo['worksheetName'] = $sheet['name'];
-            $tmpInfo['lastColumnLetter'] = 'A';
-            $tmpInfo['lastColumnIndex'] = 0;
-            $tmpInfo['totalRows'] = 0;
-            $tmpInfo['totalColumns'] = 0;
-
-            $this->pos = $sheet['offset'];
-
-            while ($this->pos <= $this->dataSize - 4) {
-                $code = self::getInt2d($this->data, $this->pos);
-
-                switch ($code) {
-                    case self::XLS_TYPE_RK:
-                    case self::XLS_TYPE_LABELSST:
-                    case self::XLS_TYPE_NUMBER:
-                    case self::XLS_TYPE_FORMULA:
-                    case self::XLS_TYPE_BOOLERR:
-                    case self::XLS_TYPE_LABEL:
-                        $length = self::getInt2d($this->data, $this->pos + 2);
-                        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-                        // move stream pointer to next record
-                        $this->pos += 4 + $length;
-
-                        $rowIndex = self::getInt2d($recordData, 0) + 1;
-                        $columnIndex = self::getInt2d($recordData, 2);
-
-                        $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
-                        $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
-                        break;
-                    case self::XLS_TYPE_BOF:
-                        $this->readBof();
-                        break;
-                    case self::XLS_TYPE_EOF:
-                        $this->readDefault();
-                        break 2;
-                    default:
-                        $this->readDefault();
-                        break;
-                }
-            }
-
-            $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-            $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
-
-            $worksheetInfo[] = $tmpInfo;
-        }
-
-        return $worksheetInfo;
-    }
-
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Read the OLE file
-        $this->loadOLE($pFilename);
-
-        // Initialisations
-        $this->phpExcel = new PHPExcel;
-        $this->phpExcel->removeSheetByIndex(0); // remove 1st sheet
-        if (!$this->readDataOnly) {
-            $this->phpExcel->removeCellStyleXfByIndex(0); // remove the default style
-            $this->phpExcel->removeCellXfByIndex(0); // remove the default style
-        }
-
-        // Read the summary information stream (containing meta data)
-        $this->readSummaryInformation();
-
-        // Read the Additional document summary information stream (containing application-specific meta data)
-        $this->readDocumentSummaryInformation();
-
-        // total byte size of Excel data (workbook global substream + sheet substreams)
-        $this->dataSize = strlen($this->data);
-
-        // initialize
-        $this->pos                 = 0;
-        $this->codepage            = 'CP1252';
-        $this->formats             = array();
-        $this->objFonts            = array();
-        $this->palette             = array();
-        $this->sheets              = array();
-        $this->externalBooks       = array();
-        $this->ref                 = array();
-        $this->definedname         = array();
-        $this->sst                 = array();
-        $this->drawingGroupData    = '';
-        $this->xfIndex             = '';
-        $this->mapCellXfIndex      = array();
-        $this->mapCellStyleXfIndex = array();
-
-        // Parse Workbook Global Substream
-        while ($this->pos < $this->dataSize) {
-            $code = self::getInt2d($this->data, $this->pos);
-
-            switch ($code) {
-                case self::XLS_TYPE_BOF:
-                    $this->readBof();
-                    break;
-                case self::XLS_TYPE_FILEPASS:
-                    $this->readFilepass();
-                    break;
-                case self::XLS_TYPE_CODEPAGE:
-                    $this->readCodepage();
-                    break;
-                case self::XLS_TYPE_DATEMODE:
-                    $this->readDateMode();
-                    break;
-                case self::XLS_TYPE_FONT:
-                    $this->readFont();
-                    break;
-                case self::XLS_TYPE_FORMAT:
-                    $this->readFormat();
-                    break;
-                case self::XLS_TYPE_XF:
-                    $this->readXf();
-                    break;
-                case self::XLS_TYPE_XFEXT:
-                    $this->readXfExt();
-                    break;
-                case self::XLS_TYPE_STYLE:
-                    $this->readStyle();
-                    break;
-                case self::XLS_TYPE_PALETTE:
-                    $this->readPalette();
-                    break;
-                case self::XLS_TYPE_SHEET:
-                    $this->readSheet();
-                    break;
-                case self::XLS_TYPE_EXTERNALBOOK:
-                    $this->readExternalBook();
-                    break;
-                case self::XLS_TYPE_EXTERNNAME:
-                    $this->readExternName();
-                    break;
-                case self::XLS_TYPE_EXTERNSHEET:
-                    $this->readExternSheet();
-                    break;
-                case self::XLS_TYPE_DEFINEDNAME:
-                    $this->readDefinedName();
-                    break;
-                case self::XLS_TYPE_MSODRAWINGGROUP:
-                    $this->readMsoDrawingGroup();
-                    break;
-                case self::XLS_TYPE_SST:
-                    $this->readSst();
-                    break;
-                case self::XLS_TYPE_EOF:
-                    $this->readDefault();
-                    break 2;
-                default:
-                    $this->readDefault();
-                    break;
-            }
-        }
-
-        // Resolve indexed colors for font, fill, and border colors
-        // Cannot be resolved already in XF record, because PALETTE record comes afterwards
-        if (!$this->readDataOnly) {
-            foreach ($this->objFonts as $objFont) {
-                if (isset($objFont->colorIndex)) {
-                    $color = PHPExcel_Reader_Excel5_Color::map($objFont->colorIndex, $this->palette, $this->version);
-                    $objFont->getColor()->setRGB($color['rgb']);
-                }
-            }
-
-            foreach ($this->phpExcel->getCellXfCollection() as $objStyle) {
-                // fill start and end color
-                $fill = $objStyle->getFill();
-
-                if (isset($fill->startcolorIndex)) {
-                    $startColor = PHPExcel_Reader_Excel5_Color::map($fill->startcolorIndex, $this->palette, $this->version);
-                    $fill->getStartColor()->setRGB($startColor['rgb']);
-                }
-                if (isset($fill->endcolorIndex)) {
-                    $endColor = PHPExcel_Reader_Excel5_Color::map($fill->endcolorIndex, $this->palette, $this->version);
-                    $fill->getEndColor()->setRGB($endColor['rgb']);
-                }
-
-                // border colors
-                $top      = $objStyle->getBorders()->getTop();
-                $right    = $objStyle->getBorders()->getRight();
-                $bottom   = $objStyle->getBorders()->getBottom();
-                $left     = $objStyle->getBorders()->getLeft();
-                $diagonal = $objStyle->getBorders()->getDiagonal();
-
-                if (isset($top->colorIndex)) {
-                    $borderTopColor = PHPExcel_Reader_Excel5_Color::map($top->colorIndex, $this->palette, $this->version);
-                    $top->getColor()->setRGB($borderTopColor['rgb']);
-                }
-                if (isset($right->colorIndex)) {
-                    $borderRightColor = PHPExcel_Reader_Excel5_Color::map($right->colorIndex, $this->palette, $this->version);
-                    $right->getColor()->setRGB($borderRightColor['rgb']);
-                }
-                if (isset($bottom->colorIndex)) {
-                    $borderBottomColor = PHPExcel_Reader_Excel5_Color::map($bottom->colorIndex, $this->palette, $this->version);
-                    $bottom->getColor()->setRGB($borderBottomColor['rgb']);
-                }
-                if (isset($left->colorIndex)) {
-                    $borderLeftColor = PHPExcel_Reader_Excel5_Color::map($left->colorIndex, $this->palette, $this->version);
-                    $left->getColor()->setRGB($borderLeftColor['rgb']);
-                }
-                if (isset($diagonal->colorIndex)) {
-                    $borderDiagonalColor = PHPExcel_Reader_Excel5_Color::map($diagonal->colorIndex, $this->palette, $this->version);
-                    $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']);
-                }
-            }
-        }
-
-        // treat MSODRAWINGGROUP records, workbook-level Escher
-        if (!$this->readDataOnly && $this->drawingGroupData) {
-            $escherWorkbook = new PHPExcel_Shared_Escher();
-            $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook);
-            $escherWorkbook = $reader->load($this->drawingGroupData);
-
-            // debug Escher stream
-            //$debug = new Debug_Escher(new PHPExcel_Shared_Escher());
-            //$debug->load($this->drawingGroupData);
-        }
-
-        // Parse the individual sheets
-        foreach ($this->sheets as $sheet) {
-            if ($sheet['sheetType'] != 0x00) {
-                // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module
-                continue;
-            }
-
-            // check if sheet should be skipped
-            if (isset($this->loadSheetsOnly) && !in_array($sheet['name'], $this->loadSheetsOnly)) {
-                continue;
-            }
-
-            // add sheet to PHPExcel object
-            $this->phpSheet = $this->phpExcel->createSheet();
-            //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
-            //        cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
-            //        name in line with the formula, not the reverse
-            $this->phpSheet->setTitle($sheet['name'], false);
-            $this->phpSheet->setSheetState($sheet['sheetState']);
-
-            $this->pos = $sheet['offset'];
-
-            // Initialize isFitToPages. May change after reading SHEETPR record.
-            $this->isFitToPages = false;
-
-            // Initialize drawingData
-            $this->drawingData = '';
-
-            // Initialize objs
-            $this->objs = array();
-
-            // Initialize shared formula parts
-            $this->sharedFormulaParts = array();
-
-            // Initialize shared formulas
-            $this->sharedFormulas = array();
-
-            // Initialize text objs
-            $this->textObjects = array();
-
-            // Initialize cell annotations
-            $this->cellNotes = array();
-            $this->textObjRef = -1;
-
-            while ($this->pos <= $this->dataSize - 4) {
-                $code = self::getInt2d($this->data, $this->pos);
-
-                switch ($code) {
-                    case self::XLS_TYPE_BOF:
-                        $this->readBof();
-                        break;
-                    case self::XLS_TYPE_PRINTGRIDLINES:
-                        $this->readPrintGridlines();
-                        break;
-                    case self::XLS_TYPE_DEFAULTROWHEIGHT:
-                        $this->readDefaultRowHeight();
-                        break;
-                    case self::XLS_TYPE_SHEETPR:
-                        $this->readSheetPr();
-                        break;
-                    case self::XLS_TYPE_HORIZONTALPAGEBREAKS:
-                        $this->readHorizontalPageBreaks();
-                        break;
-                    case self::XLS_TYPE_VERTICALPAGEBREAKS:
-                        $this->readVerticalPageBreaks();
-                        break;
-                    case self::XLS_TYPE_HEADER:
-                        $this->readHeader();
-                        break;
-                    case self::XLS_TYPE_FOOTER:
-                        $this->readFooter();
-                        break;
-                    case self::XLS_TYPE_HCENTER:
-                        $this->readHcenter();
-                        break;
-                    case self::XLS_TYPE_VCENTER:
-                        $this->readVcenter();
-                        break;
-                    case self::XLS_TYPE_LEFTMARGIN:
-                        $this->readLeftMargin();
-                        break;
-                    case self::XLS_TYPE_RIGHTMARGIN:
-                        $this->readRightMargin();
-                        break;
-                    case self::XLS_TYPE_TOPMARGIN:
-                        $this->readTopMargin();
-                        break;
-                    case self::XLS_TYPE_BOTTOMMARGIN:
-                        $this->readBottomMargin();
-                        break;
-                    case self::XLS_TYPE_PAGESETUP:
-                        $this->readPageSetup();
-                        break;
-                    case self::XLS_TYPE_PROTECT:
-                        $this->readProtect();
-                        break;
-                    case self::XLS_TYPE_SCENPROTECT:
-                        $this->readScenProtect();
-                        break;
-                    case self::XLS_TYPE_OBJECTPROTECT:
-                        $this->readObjectProtect();
-                        break;
-                    case self::XLS_TYPE_PASSWORD:
-                        $this->readPassword();
-                        break;
-                    case self::XLS_TYPE_DEFCOLWIDTH:
-                        $this->readDefColWidth();
-                        break;
-                    case self::XLS_TYPE_COLINFO:
-                        $this->readColInfo();
-                        break;
-                    case self::XLS_TYPE_DIMENSION:
-                        $this->readDefault();
-                        break;
-                    case self::XLS_TYPE_ROW:
-                        $this->readRow();
-                        break;
-                    case self::XLS_TYPE_DBCELL:
-                        $this->readDefault();
-                        break;
-                    case self::XLS_TYPE_RK:
-                        $this->readRk();
-                        break;
-                    case self::XLS_TYPE_LABELSST:
-                        $this->readLabelSst();
-                        break;
-                    case self::XLS_TYPE_MULRK:
-                        $this->readMulRk();
-                        break;
-                    case self::XLS_TYPE_NUMBER:
-                        $this->readNumber();
-                        break;
-                    case self::XLS_TYPE_FORMULA:
-                        $this->readFormula();
-                        break;
-                    case self::XLS_TYPE_SHAREDFMLA:
-                        $this->readSharedFmla();
-                        break;
-                    case self::XLS_TYPE_BOOLERR:
-                        $this->readBoolErr();
-                        break;
-                    case self::XLS_TYPE_MULBLANK:
-                        $this->readMulBlank();
-                        break;
-                    case self::XLS_TYPE_LABEL:
-                        $this->readLabel();
-                        break;
-                    case self::XLS_TYPE_BLANK:
-                        $this->readBlank();
-                        break;
-                    case self::XLS_TYPE_MSODRAWING:
-                        $this->readMsoDrawing();
-                        break;
-                    case self::XLS_TYPE_OBJ:
-                        $this->readObj();
-                        break;
-                    case self::XLS_TYPE_WINDOW2:
-                        $this->readWindow2();
-                        break;
-                    case self::XLS_TYPE_PAGELAYOUTVIEW:
-                        $this->readPageLayoutView();
-                        break;
-                    case self::XLS_TYPE_SCL:
-                        $this->readScl();
-                        break;
-                    case self::XLS_TYPE_PANE:
-                        $this->readPane();
-                        break;
-                    case self::XLS_TYPE_SELECTION:
-                        $this->readSelection();
-                        break;
-                    case self::XLS_TYPE_MERGEDCELLS:
-                        $this->readMergedCells();
-                        break;
-                    case self::XLS_TYPE_HYPERLINK:
-                        $this->readHyperLink();
-                        break;
-                    case self::XLS_TYPE_DATAVALIDATIONS:
-                        $this->readDataValidations();
-                        break;
-                    case self::XLS_TYPE_DATAVALIDATION:
-                        $this->readDataValidation();
-                        break;
-                    case self::XLS_TYPE_SHEETLAYOUT:
-                        $this->readSheetLayout();
-                        break;
-                    case self::XLS_TYPE_SHEETPROTECTION:
-                        $this->readSheetProtection();
-                        break;
-                    case self::XLS_TYPE_RANGEPROTECTION:
-                        $this->readRangeProtection();
-                        break;
-                    case self::XLS_TYPE_NOTE:
-                        $this->readNote();
-                        break;
-                    //case self::XLS_TYPE_IMDATA:                $this->readImData();                    break;
-                    case self::XLS_TYPE_TXO:
-                        $this->readTextObject();
-                        break;
-                    case self::XLS_TYPE_CONTINUE:
-                        $this->readContinue();
-                        break;
-                    case self::XLS_TYPE_EOF:
-                        $this->readDefault();
-                        break 2;
-                    default:
-                        $this->readDefault();
-                        break;
-                }
-
-            }
-
-            // treat MSODRAWING records, sheet-level Escher
-            if (!$this->readDataOnly && $this->drawingData) {
-                $escherWorksheet = new PHPExcel_Shared_Escher();
-                $reader = new PHPExcel_Reader_Excel5_Escher($escherWorksheet);
-                $escherWorksheet = $reader->load($this->drawingData);
-
-                // debug Escher stream
-                //$debug = new Debug_Escher(new PHPExcel_Shared_Escher());
-                //$debug->load($this->drawingData);
-
-                // get all spContainers in one long array, so they can be mapped to OBJ records
-                $allSpContainers = $escherWorksheet->getDgContainer()->getSpgrContainer()->getAllSpContainers();
-            }
-
-            // treat OBJ records
-            foreach ($this->objs as $n => $obj) {
-//                echo '<hr /><b>Object</b> reference is ', $n,'<br />';
-//                var_dump($obj);
-//                echo '<br />';
-
-                // the first shape container never has a corresponding OBJ record, hence $n + 1
-                if (isset($allSpContainers[$n + 1]) && is_object($allSpContainers[$n + 1])) {
-                    $spContainer = $allSpContainers[$n + 1];
-
-                    // we skip all spContainers that are a part of a group shape since we cannot yet handle those
-                    if ($spContainer->getNestingLevel() > 1) {
-                        continue;
-                    }
-
-                    // calculate the width and height of the shape
-                    list($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($spContainer->getStartCoordinates());
-                    list($endColumn, $endRow) = PHPExcel_Cell::coordinateFromString($spContainer->getEndCoordinates());
-
-                    $startOffsetX = $spContainer->getStartOffsetX();
-                    $startOffsetY = $spContainer->getStartOffsetY();
-                    $endOffsetX = $spContainer->getEndOffsetX();
-                    $endOffsetY = $spContainer->getEndOffsetY();
-
-                    $width = PHPExcel_Shared_Excel5::getDistanceX($this->phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX);
-                    $height = PHPExcel_Shared_Excel5::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY);
-
-                    // calculate offsetX and offsetY of the shape
-                    $offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, $startColumn) / 1024;
-                    $offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $startRow) / 256;
-
-                    switch ($obj['otObjType']) {
-                        case 0x19:
-                            // Note
-//                            echo 'Cell Annotation Object<br />';
-//                            echo 'Object ID is ', $obj['idObjID'],'<br />';
-                            if (isset($this->cellNotes[$obj['idObjID']])) {
-                                $cellNote = $this->cellNotes[$obj['idObjID']];
-
-                                if (isset($this->textObjects[$obj['idObjID']])) {
-                                    $textObject = $this->textObjects[$obj['idObjID']];
-                                    $this->cellNotes[$obj['idObjID']]['objTextData'] = $textObject;
-                                }
-                            }
-                            break;
-                        case 0x08:
-//                            echo 'Picture Object<br />';
-                            // picture
-                            // get index to BSE entry (1-based)
-                            $BSEindex = $spContainer->getOPT(0x0104);
-                            $BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection();
-                            $BSE = $BSECollection[$BSEindex - 1];
-                            $blipType = $BSE->getBlipType();
-
-                            // need check because some blip types are not supported by Escher reader such as EMF
-                            if ($blip = $BSE->getBlip()) {
-                                $ih = imagecreatefromstring($blip->getData());
-                                $drawing = new PHPExcel_Worksheet_MemoryDrawing();
-                                $drawing->setImageResource($ih);
-
-                                // width, height, offsetX, offsetY
-                                $drawing->setResizeProportional(false);
-                                $drawing->setWidth($width);
-                                $drawing->setHeight($height);
-                                $drawing->setOffsetX($offsetX);
-                                $drawing->setOffsetY($offsetY);
-
-                                switch ($blipType) {
-                                    case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
-                                        $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
-                                        $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG);
-                                        break;
-                                    case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
-                                        $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);
-                                        $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG);
-                                        break;
-                                }
-
-                                $drawing->setWorksheet($this->phpSheet);
-                                $drawing->setCoordinates($spContainer->getStartCoordinates());
-                            }
-                            break;
-                        default:
-                            // other object type
-                            break;
-                    }
-                }
-            }
-
-            // treat SHAREDFMLA records
-            if ($this->version == self::XLS_BIFF8) {
-                foreach ($this->sharedFormulaParts as $cell => $baseCell) {
-                    list($column, $row) = PHPExcel_Cell::coordinateFromString($cell);
-                    if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) {
-                        $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell);
-                        $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
-                    }
-                }
-            }
-
-            if (!empty($this->cellNotes)) {
-                foreach ($this->cellNotes as $note => $noteDetails) {
-                    if (!isset($noteDetails['objTextData'])) {
-                        if (isset($this->textObjects[$note])) {
-                            $textObject = $this->textObjects[$note];
-                            $noteDetails['objTextData'] = $textObject;
-                        } else {
-                            $noteDetails['objTextData']['text'] = '';
-                        }
-                    }
-//                    echo '<b>Cell annotation ', $note,'</b><br />';
-//                    var_dump($noteDetails);
-//                    echo '<br />';
-                    $cellAddress = str_replace('$', '', $noteDetails['cellRef']);
-                    $this->phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->parseRichText($noteDetails['objTextData']['text']));
-                }
-            }
-        }
-
-        // add the named ranges (defined names)
-        foreach ($this->definedname as $definedName) {
-            if ($definedName['isBuiltInName']) {
-                switch ($definedName['name']) {
-                    case pack('C', 0x06):
-                        // print area
-                        //    in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2
-                        $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma?
-
-                        $extractedRanges = array();
-                        foreach ($ranges as $range) {
-                            // $range should look like one of these
-                            //        Foo!$C$7:$J$66
-                            //        Bar!$A$1:$IV$2
-                            $explodes = explode('!', $range);    // FIXME: what if sheetname contains exclamation mark?
-                            $sheetName = trim($explodes[0], "'");
-                            if (count($explodes) == 2) {
-                                if (strpos($explodes[1], ':') === false) {
-                                    $explodes[1] = $explodes[1] . ':' . $explodes[1];
-                                }
-                                $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66
-                            }
-                        }
-                        if ($docSheet = $this->phpExcel->getSheetByName($sheetName)) {
-                            $docSheet->getPageSetup()->setPrintArea(implode(',', $extractedRanges)); // C7:J66,A1:IV2
-                        }
-                        break;
-                    case pack('C', 0x07):
-                        // print titles (repeating rows)
-                        // Assuming BIFF8, there are 3 cases
-                        // 1. repeating rows
-                        //        formula looks like this: Sheet!$A$1:$IV$2
-                        //        rows 1-2 repeat
-                        // 2. repeating columns
-                        //        formula looks like this: Sheet!$A$1:$B$65536
-                        //        columns A-B repeat
-                        // 3. both repeating rows and repeating columns
-                        //        formula looks like this: Sheet!$A$1:$B$65536,Sheet!$A$1:$IV$2
-                        $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma?
-                        foreach ($ranges as $range) {
-                            // $range should look like this one of these
-                            //        Sheet!$A$1:$B$65536
-                            //        Sheet!$A$1:$IV$2
-                            $explodes = explode('!', $range);
-                            if (count($explodes) == 2) {
-                                if ($docSheet = $this->phpExcel->getSheetByName($explodes[0])) {
-                                    $extractedRange = $explodes[1];
-                                    $extractedRange = str_replace('$', '', $extractedRange);
-
-                                    $coordinateStrings = explode(':', $extractedRange);
-                                    if (count($coordinateStrings) == 2) {
-                                        list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[0]);
-                                        list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[1]);
-
-                                        if ($firstColumn == 'A' and $lastColumn == 'IV') {
-                                            // then we have repeating rows
-                                            $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($firstRow, $lastRow));
-                                        } elseif ($firstRow == 1 and $lastRow == 65536) {
-                                            // then we have repeating columns
-                                            $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($firstColumn, $lastColumn));
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                        break;
-                }
-            } else {
-                // Extract range
-                $explodes = explode('!', $definedName['formula']);
-
-                if (count($explodes) == 2) {
-                    if (($docSheet = $this->phpExcel->getSheetByName($explodes[0])) ||
-                        ($docSheet = $this->phpExcel->getSheetByName(trim($explodes[0], "'")))) {
-                        $extractedRange = $explodes[1];
-                        $extractedRange = str_replace('$', '', $extractedRange);
-
-                        $localOnly = ($definedName['scope'] == 0) ? false : true;
-
-                        $scope = ($definedName['scope'] == 0) ? null : $this->phpExcel->getSheetByName($this->sheets[$definedName['scope'] - 1]['name']);
-
-                        $this->phpExcel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope));
-                    }
-                } else {
-                    //    Named Value
-                    //    TODO Provide support for named values
-                }
-            }
-        }
-        $this->data = null;
-
-        return $this->phpExcel;
-    }
-    
-    /**
-     * Read record data from stream, decrypting as required
-     *
-     * @param string $data   Data stream to read from
-     * @param int    $pos    Position to start reading from
-     * @param int    $length Record data length
-     *
-     * @return string Record data
-     */
-    private function readRecordData($data, $pos, $len)
-    {
-        $data = substr($data, $pos, $len);
-        
-        // File not encrypted, or record before encryption start point
-        if ($this->encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->encryptionStartPos) {
-            return $data;
-        }
-    
-        $recordData = '';
-        if ($this->encryption == self::MS_BIFF_CRYPTO_RC4) {
-            $oldBlock = floor($this->rc4Pos / self::REKEY_BLOCK);
-            $block = floor($pos / self::REKEY_BLOCK);
-            $endBlock = floor(($pos + $len) / self::REKEY_BLOCK);
-
-            // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting
-            // at a point earlier in the current block, re-use it as we can save some time.
-            if ($block != $oldBlock || $pos < $this->rc4Pos || !$this->rc4Key) {
-                $this->rc4Key = $this->makeKey($block, $this->md5Ctxt);
-                $step = $pos % self::REKEY_BLOCK;
-            } else {
-                $step = $pos - $this->rc4Pos;
-            }
-            $this->rc4Key->RC4(str_repeat("\0", $step));
-
-            // Decrypt record data (re-keying at the end of every block)
-            while ($block != $endBlock) {
-                $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK);
-                $recordData .= $this->rc4Key->RC4(substr($data, 0, $step));
-                $data = substr($data, $step);
-                $pos += $step;
-                $len -= $step;
-                $block++;
-                $this->rc4Key = $this->makeKey($block, $this->md5Ctxt);
-            }
-            $recordData .= $this->rc4Key->RC4(substr($data, 0, $len));
-
-            // Keep track of the position of this decryptor.
-            // We'll try and re-use it later if we can to speed things up
-            $this->rc4Pos = $pos + $len;
-        } elseif ($this->encryption == self::MS_BIFF_CRYPTO_XOR) {
-            throw new PHPExcel_Reader_Exception('XOr encryption not supported');
-        }
-        return $recordData;
-    }
-
-    /**
-     * Use OLE reader to extract the relevant data streams from the OLE file
-     *
-     * @param string $pFilename
-     */
-    private function loadOLE($pFilename)
-    {
-        // OLE reader
-        $ole = new PHPExcel_Shared_OLERead();
-        // get excel data,
-        $res = $ole->read($pFilename);
-        // Get workbook data: workbook stream + sheet streams
-        $this->data = $ole->getStream($ole->wrkbook);
-        // Get summary information data
-        $this->summaryInformation = $ole->getStream($ole->summaryInformation);
-        // Get additional document summary information data
-        $this->documentSummaryInformation = $ole->getStream($ole->documentSummaryInformation);
-        // Get user-defined property data
-//        $this->userDefinedProperties = $ole->getUserDefinedProperties();
-    }
-
-
-    /**
-     * Read summary information
-     */
-    private function readSummaryInformation()
-    {
-        if (!isset($this->summaryInformation)) {
-            return;
-        }
-
-        // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
-        // offset: 2; size: 2;
-        // offset: 4; size: 2; OS version
-        // offset: 6; size: 2; OS indicator
-        // offset: 8; size: 16
-        // offset: 24; size: 4; section count
-        $secCount = self::getInt4d($this->summaryInformation, 24);
-
-        // offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9
-        // offset: 44; size: 4
-        $secOffset = self::getInt4d($this->summaryInformation, 44);
-
-        // section header
-        // offset: $secOffset; size: 4; section length
-        $secLength = self::getInt4d($this->summaryInformation, $secOffset);
-
-        // offset: $secOffset+4; size: 4; property count
-        $countProperties = self::getInt4d($this->summaryInformation, $secOffset+4);
-
-        // initialize code page (used to resolve string values)
-        $codePage = 'CP1252';
-
-        // offset: ($secOffset+8); size: var
-        // loop through property decarations and properties
-        for ($i = 0; $i < $countProperties; ++$i) {
-            // offset: ($secOffset+8) + (8 * $i); size: 4; property ID
-            $id = self::getInt4d($this->summaryInformation, ($secOffset+8) + (8 * $i));
-
-            // Use value of property id as appropriate
-            // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48)
-            $offset = self::getInt4d($this->summaryInformation, ($secOffset+12) + (8 * $i));
-
-            $type = self::getInt4d($this->summaryInformation, $secOffset + $offset);
-
-            // initialize property value
-            $value = null;
-
-            // extract property value based on property type
-            switch ($type) {
-                case 0x02: // 2 byte signed integer
-                    $value = self::getInt2d($this->summaryInformation, $secOffset + 4 + $offset);
-                    break;
-                case 0x03: // 4 byte signed integer
-                    $value = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
-                    break;
-                case 0x13: // 4 byte unsigned integer
-                    // not needed yet, fix later if necessary
-                    break;
-                case 0x1E: // null-terminated string prepended by dword string length
-                    $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
-                    $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength);
-                    $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage);
-                    $value = rtrim($value);
-                    break;
-                case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
-                    // PHP-time
-                    $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->summaryInformation, $secOffset + 4 + $offset, 8));
-                    break;
-                case 0x47: // Clipboard format
-                    // not needed yet, fix later if necessary
-                    break;
-            }
-
-            switch ($id) {
-                case 0x01:    //    Code Page
-                    $codePage = PHPExcel_Shared_CodePage::NumberToName($value);
-                    break;
-                case 0x02:    //    Title
-                    $this->phpExcel->getProperties()->setTitle($value);
-                    break;
-                case 0x03:    //    Subject
-                    $this->phpExcel->getProperties()->setSubject($value);
-                    break;
-                case 0x04:    //    Author (Creator)
-                    $this->phpExcel->getProperties()->setCreator($value);
-                    break;
-                case 0x05:    //    Keywords
-                    $this->phpExcel->getProperties()->setKeywords($value);
-                    break;
-                case 0x06:    //    Comments (Description)
-                    $this->phpExcel->getProperties()->setDescription($value);
-                    break;
-                case 0x07:    //    Template
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x08:    //    Last Saved By (LastModifiedBy)
-                    $this->phpExcel->getProperties()->setLastModifiedBy($value);
-                    break;
-                case 0x09:    //    Revision
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0A:    //    Total Editing Time
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0B:    //    Last Printed
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0C:    //    Created Date/Time
-                    $this->phpExcel->getProperties()->setCreated($value);
-                    break;
-                case 0x0D:    //    Modified Date/Time
-                    $this->phpExcel->getProperties()->setModified($value);
-                    break;
-                case 0x0E:    //    Number of Pages
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0F:    //    Number of Words
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x10:    //    Number of Characters
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x11:    //    Thumbnail
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x12:    //    Name of creating application
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x13:    //    Security
-                    //    Not supported by PHPExcel
-                    break;
-            }
-        }
-    }
-
-
-    /**
-     * Read additional document summary information
-     */
-    private function readDocumentSummaryInformation()
-    {
-        if (!isset($this->documentSummaryInformation)) {
-            return;
-        }
-
-        //    offset: 0;    size: 2;    must be 0xFE 0xFF (UTF-16 LE byte order mark)
-        //    offset: 2;    size: 2;
-        //    offset: 4;    size: 2;    OS version
-        //    offset: 6;    size: 2;    OS indicator
-        //    offset: 8;    size: 16
-        //    offset: 24;    size: 4;    section count
-        $secCount = self::getInt4d($this->documentSummaryInformation, 24);
-//        echo '$secCount = ', $secCount,'<br />';
-
-        // offset: 28;    size: 16;    first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
-        // offset: 44;    size: 4;    first section offset
-        $secOffset = self::getInt4d($this->documentSummaryInformation, 44);
-//        echo '$secOffset = ', $secOffset,'<br />';
-
-        //    section header
-        //    offset: $secOffset;    size: 4;    section length
-        $secLength = self::getInt4d($this->documentSummaryInformation, $secOffset);
-//        echo '$secLength = ', $secLength,'<br />';
-
-        //    offset: $secOffset+4;    size: 4;    property count
-        $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset+4);
-//        echo '$countProperties = ', $countProperties,'<br />';
-
-        // initialize code page (used to resolve string values)
-        $codePage = 'CP1252';
-
-        //    offset: ($secOffset+8);    size: var
-        //    loop through property decarations and properties
-        for ($i = 0; $i < $countProperties; ++$i) {
-//            echo 'Property ', $i,'<br />';
-            //    offset: ($secOffset+8) + (8 * $i);    size: 4;    property ID
-            $id = self::getInt4d($this->documentSummaryInformation, ($secOffset+8) + (8 * $i));
-//            echo 'ID is ', $id,'<br />';
-
-            // Use value of property id as appropriate
-            // offset: 60 + 8 * $i;    size: 4;    offset from beginning of section (48)
-            $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset+12) + (8 * $i));
-
-            $type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset);
-//            echo 'Type is ', $type,', ';
-
-            // initialize property value
-            $value = null;
-
-            // extract property value based on property type
-            switch ($type) {
-                case 0x02:    //    2 byte signed integer
-                    $value = self::getInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset);
-                    break;
-                case 0x03:    //    4 byte signed integer
-                    $value = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
-                    break;
-                case 0x0B:  // Boolean
-                    $value = self::getInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset);
-                    $value = ($value == 0 ? false : true);
-                    break;
-                case 0x13:    //    4 byte unsigned integer
-                    // not needed yet, fix later if necessary
-                    break;
-                case 0x1E:    //    null-terminated string prepended by dword string length
-                    $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
-                    $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
-                    $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage);
-                    $value = rtrim($value);
-                    break;
-                case 0x40:    //    Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
-                    // PHP-Time
-                    $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->documentSummaryInformation, $secOffset + 4 + $offset, 8));
-                    break;
-                case 0x47:    //    Clipboard format
-                    // not needed yet, fix later if necessary
-                    break;
-            }
-
-            switch ($id) {
-                case 0x01:    //    Code Page
-                    $codePage = PHPExcel_Shared_CodePage::NumberToName($value);
-                    break;
-                case 0x02:    //    Category
-                    $this->phpExcel->getProperties()->setCategory($value);
-                    break;
-                case 0x03:    //    Presentation Target
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x04:    //    Bytes
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x05:    //    Lines
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x06:    //    Paragraphs
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x07:    //    Slides
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x08:    //    Notes
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x09:    //    Hidden Slides
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0A:    //    MM Clips
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0B:    //    Scale Crop
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0C:    //    Heading Pairs
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0D:    //    Titles of Parts
-                    //    Not supported by PHPExcel
-                    break;
-                case 0x0E:    //    Manager
-                    $this->phpExcel->getProperties()->setManager($value);
-                    break;
-                case 0x0F:    //    Company
-                    $this->phpExcel->getProperties()->setCompany($value);
-                    break;
-                case 0x10:    //    Links up-to-date
-                    //    Not supported by PHPExcel
-                    break;
-            }
-        }
-    }
-
-
-    /**
-     * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
-     */
-    private function readDefault()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-//        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-    }
-
-
-    /**
-     *    The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions,
-     *        this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
-     */
-    private function readNote()
-    {
-//        echo '<b>Read Cell Annotation</b><br />';
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        $cellAddress = $this->readBIFF8CellAddress(substr($recordData, 0, 4));
-        if ($this->version == self::XLS_BIFF8) {
-            $noteObjID = self::getInt2d($recordData, 6);
-            $noteAuthor = self::readUnicodeStringLong(substr($recordData, 8));
-            $noteAuthor = $noteAuthor['value'];
-//            echo 'Note Address=', $cellAddress,'<br />';
-//            echo 'Note Object ID=', $noteObjID,'<br />';
-//            echo 'Note Author=', $noteAuthor,'<hr />';
-//
-            $this->cellNotes[$noteObjID] = array(
-                'cellRef'   => $cellAddress,
-                'objectID'  => $noteObjID,
-                'author'    => $noteAuthor
-            );
-        } else {
-            $extension = false;
-            if ($cellAddress == '$B$65536') {
-                //    If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation
-                //        note from the previous cell annotation. We're not yet handling this, so annotations longer than the
-                //        max 2048 bytes will probably throw a wobbly.
-                $row = self::getInt2d($recordData, 0);
-                $extension = true;
-                $cellAddress = array_pop(array_keys($this->phpSheet->getComments()));
-            }
-//            echo 'Note Address=', $cellAddress,'<br />';
-
-            $cellAddress = str_replace('$', '', $cellAddress);
-            $noteLength = self::getInt2d($recordData, 4);
-            $noteText = trim(substr($recordData, 6));
-//            echo 'Note Length=', $noteLength,'<br />';
-//            echo 'Note Text=', $noteText,'<br />';
-
-            if ($extension) {
-                //    Concatenate this extension with the currently set comment for the cell
-                $comment = $this->phpSheet->getComment($cellAddress);
-                $commentText = $comment->getText()->getPlainText();
-                $comment->setText($this->parseRichText($commentText.$noteText));
-            } else {
-                //    Set comment for the cell
-                $this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText));
-//                                                    ->setAuthor($author)
-            }
-        }
-
-    }
-
-
-    /**
-     *    The TEXT Object record contains the text associated with a cell annotation.
-     */
-    private function readTextObject()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // recordData consists of an array of subrecords looking like this:
-        //    grbit: 2 bytes; Option Flags
-        //    rot: 2 bytes; rotation
-        //    cchText: 2 bytes; length of the text (in the first continue record)
-        //    cbRuns: 2 bytes; length of the formatting (in the second continue record)
-        // followed by the continuation records containing the actual text and formatting
-        $grbitOpts  = self::getInt2d($recordData, 0);
-        $rot        = self::getInt2d($recordData, 2);
-        $cchText    = self::getInt2d($recordData, 10);
-        $cbRuns     = self::getInt2d($recordData, 12);
-        $text       = $this->getSplicedRecordData();
-
-        $this->textObjects[$this->textObjRef] = array(
-            'text'      => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText),
-            'format'    => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns),
-            'alignment' => $grbitOpts,
-            'rotation'  => $rot
-        );
-
-//        echo '<b>_readTextObject()</b><br />';
-//        var_dump($this->textObjects[$this->textObjRef]);
-//        echo '<br />';
-    }
-
-
-    /**
-     * Read BOF
-     */
-    private function readBof()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = substr($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 2; size: 2; type of the following data
-        $substreamType = self::getInt2d($recordData, 2);
-
-        switch ($substreamType) {
-            case self::XLS_WorkbookGlobals:
-                $version = self::getInt2d($recordData, 0);
-                if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) {
-                    throw new PHPExcel_Reader_Exception('Cannot read this Excel file. Version is too old.');
-                }
-                $this->version = $version;
-                break;
-            case self::XLS_Worksheet:
-                // do not use this version information for anything
-                // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream
-                break;
-            default:
-                // substream, e.g. chart
-                // just skip the entire substream
-                do {
-                    $code = self::getInt2d($this->data, $this->pos);
-                    $this->readDefault();
-                } while ($code != self::XLS_TYPE_EOF && $this->pos < $this->dataSize);
-                break;
-        }
-    }
-
-
-    /**
-     * FILEPASS
-     *
-     * This record is part of the File Protection Block. It
-     * contains information about the read/write password of the
-     * file. All record contents following this record will be
-     * encrypted.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     *
-     * The decryption functions and objects used from here on in
-     * are based on the source of Spreadsheet-ParseExcel:
-     * http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel/
-     */
-    private function readFilepass()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-
-        if ($length != 54) {
-            throw new PHPExcel_Reader_Exception('Unexpected file pass record length');
-        }
-        
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-        
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->verifyPassword('VelvetSweatshop', substr($recordData, 6, 16), substr($recordData, 22, 16), substr($recordData, 38, 16), $this->md5Ctxt)) {
-            throw new PHPExcel_Reader_Exception('Decryption password incorrect');
-        }
-        
-        $this->encryption = self::MS_BIFF_CRYPTO_RC4;
-
-        // Decryption required from the record after next onwards
-        $this->encryptionStartPos = $this->pos + self::getInt2d($this->data, $this->pos + 2);
-    }
-
-    /**
-     * Make an RC4 decryptor for the given block
-     *
-     * @var int    $block      Block for which to create decrypto
-     * @var string $valContext MD5 context state
-     *
-     * @return PHPExcel_Reader_Excel5_RC4
-     */
-    private function makeKey($block, $valContext)
-    {
-        $pwarray = str_repeat("\0", 64);
-
-        for ($i = 0; $i < 5; $i++) {
-            $pwarray[$i] = $valContext[$i];
-        }
-        
-        $pwarray[5] = chr($block & 0xff);
-        $pwarray[6] = chr(($block >> 8) & 0xff);
-        $pwarray[7] = chr(($block >> 16) & 0xff);
-        $pwarray[8] = chr(($block >> 24) & 0xff);
-
-        $pwarray[9] = "\x80";
-        $pwarray[56] = "\x48";
-
-        $md5 = new PHPExcel_Reader_Excel5_MD5();
-        $md5->add($pwarray);
-
-        $s = $md5->getContext();
-        return new PHPExcel_Reader_Excel5_RC4($s);
-    }
-
-    /**
-     * Verify RC4 file password
-     *
-     * @var string $password        Password to check
-     * @var string $docid           Document id
-     * @var string $salt_data       Salt data
-     * @var string $hashedsalt_data Hashed salt data
-     * @var string &$valContext     Set to the MD5 context of the value
-     *
-     * @return bool Success
-     */
-    private function verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext)
-    {
-        $pwarray = str_repeat("\0", 64);
-
-        for ($i = 0; $i < strlen($password); $i++) {
-            $o = ord(substr($password, $i, 1));
-            $pwarray[2 * $i] = chr($o & 0xff);
-            $pwarray[2 * $i + 1] = chr(($o >> 8) & 0xff);
-        }
-        $pwarray[2 * $i] = chr(0x80);
-        $pwarray[56] = chr(($i << 4) & 0xff);
-
-        $md5 = new PHPExcel_Reader_Excel5_MD5();
-        $md5->add($pwarray);
-
-        $mdContext1 = $md5->getContext();
-
-        $offset = 0;
-        $keyoffset = 0;
-        $tocopy = 5;
-
-        $md5->reset();
-
-        while ($offset != 16) {
-            if ((64 - $offset) < 5) {
-                $tocopy = 64 - $offset;
-            }
-            for ($i = 0; $i <= $tocopy; $i++) {
-                $pwarray[$offset + $i] = $mdContext1[$keyoffset + $i];
-            }
-            $offset += $tocopy;
-
-            if ($offset == 64) {
-                $md5->add($pwarray);
-                $keyoffset = $tocopy;
-                $tocopy = 5 - $tocopy;
-                $offset = 0;
-                continue;
-            }
-
-            $keyoffset = 0;
-            $tocopy = 5;
-            for ($i = 0; $i < 16; $i++) {
-                $pwarray[$offset + $i] = $docid[$i];
-            }
-            $offset += 16;
-        }
-
-        $pwarray[16] = "\x80";
-        for ($i = 0; $i < 47; $i++) {
-            $pwarray[17 + $i] = "\0";
-        }
-        $pwarray[56] = "\x80";
-        $pwarray[57] = "\x0a";
-
-        $md5->add($pwarray);
-        $valContext = $md5->getContext();
-
-        $key = $this->makeKey(0, $valContext);
-
-        $salt = $key->RC4($salt_data);
-        $hashedsalt = $key->RC4($hashedsalt_data);
-        
-        $salt .= "\x80" . str_repeat("\0", 47);
-        $salt[56] = "\x80";
-
-        $md5->reset();
-        $md5->add($salt);
-        $mdContext2 = $md5->getContext();
-
-        return $mdContext2 == $hashedsalt;
-    }
-
-    /**
-     * CODEPAGE
-     *
-     * This record stores the text encoding used to write byte
-     * strings, stored as MS Windows code page identifier.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readCodepage()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; code page identifier
-        $codepage = self::getInt2d($recordData, 0);
-
-        $this->codepage = PHPExcel_Shared_CodePage::NumberToName($codepage);
-    }
-
-
-    /**
-     * DATEMODE
-     *
-     * This record specifies the base date for displaying date
-     * values. All dates are stored as count of days past this
-     * base date. In BIFF2-BIFF4 this record is part of the
-     * Calculation Settings Block. In BIFF5-BIFF8 it is
-     * stored in the Workbook Globals Substream.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readDateMode()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; 0 = base 1900, 1 = base 1904
-        PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
-        if (ord($recordData{0}) == 1) {
-            PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
-        }
-    }
-
-
-    /**
-     * Read a FONT record
-     */
-    private function readFont()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            $objFont = new PHPExcel_Style_Font();
-
-            // offset: 0; size: 2; height of the font (in twips = 1/20 of a point)
-            $size = self::getInt2d($recordData, 0);
-            $objFont->setSize($size / 20);
-
-            // offset: 2; size: 2; option flags
-            // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
-            // bit: 1; mask 0x0002; italic
-            $isItalic = (0x0002 & self::getInt2d($recordData, 2)) >> 1;
-            if ($isItalic) {
-                $objFont->setItalic(true);
-            }
-
-            // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
-            // bit: 3; mask 0x0008; strike
-            $isStrike = (0x0008 & self::getInt2d($recordData, 2)) >> 3;
-            if ($isStrike) {
-                $objFont->setStrikethrough(true);
-            }
-
-            // offset: 4; size: 2; colour index
-            $colorIndex = self::getInt2d($recordData, 4);
-            $objFont->colorIndex = $colorIndex;
-
-            // offset: 6; size: 2; font weight
-            $weight = self::getInt2d($recordData, 6);
-            switch ($weight) {
-                case 0x02BC:
-                    $objFont->setBold(true);
-                    break;
-            }
-
-            // offset: 8; size: 2; escapement type
-            $escapement = self::getInt2d($recordData, 8);
-            switch ($escapement) {
-                case 0x0001:
-                    $objFont->setSuperScript(true);
-                    break;
-                case 0x0002:
-                    $objFont->setSubScript(true);
-                    break;
-            }
-
-            // offset: 10; size: 1; underline type
-            $underlineType = ord($recordData{10});
-            switch ($underlineType) {
-                case 0x00:
-                    break; // no underline
-                case 0x01:
-                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
-                    break;
-                case 0x02:
-                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
-                    break;
-                case 0x21:
-                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING);
-                    break;
-                case 0x22:
-                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING);
-                    break;
-            }
-
-            // offset: 11; size: 1; font family
-            // offset: 12; size: 1; character set
-            // offset: 13; size: 1; not used
-            // offset: 14; size: var; font name
-            if ($this->version == self::XLS_BIFF8) {
-                $string = self::readUnicodeStringShort(substr($recordData, 14));
-            } else {
-                $string = $this->readByteStringShort(substr($recordData, 14));
-            }
-            $objFont->setName($string['value']);
-
-            $this->objFonts[] = $objFont;
-        }
-    }
-
-
-    /**
-     * FORMAT
-     *
-     * This record contains information about a number format.
-     * All FORMAT records occur together in a sequential list.
-     *
-     * In BIFF2-BIFF4 other records referencing a FORMAT record
-     * contain a zero-based index into this list. From BIFF5 on
-     * the FORMAT record contains the index itself that will be
-     * used by other records.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readFormat()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            $indexCode = self::getInt2d($recordData, 0);
-
-            if ($this->version == self::XLS_BIFF8) {
-                $string = self::readUnicodeStringLong(substr($recordData, 2));
-            } else {
-                // BIFF7
-                $string = $this->readByteStringShort(substr($recordData, 2));
-            }
-
-            $formatString = $string['value'];
-            $this->formats[$indexCode] = $formatString;
-        }
-    }
-
-
-    /**
-     * XF - Extended Format
-     *
-     * This record contains formatting information for cells, rows, columns or styles.
-     * According to http://support.microsoft.com/kb/147732 there are always at least 15 cell style XF
-     * and 1 cell XF.
-     * Inspection of Excel files generated by MS Office Excel shows that XF records 0-14 are cell style XF
-     * and XF record 15 is a cell XF
-     * We only read the first cell style XF and skip the remaining cell style XF records
-     * We read all cell XF records.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readXf()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        $objStyle = new PHPExcel_Style();
-
-        if (!$this->readDataOnly) {
-            // offset:  0; size: 2; Index to FONT record
-            if (self::getInt2d($recordData, 0) < 4) {
-                $fontIndex = self::getInt2d($recordData, 0);
-            } else {
-                // this has to do with that index 4 is omitted in all BIFF versions for some strange reason
-                // check the OpenOffice documentation of the FONT record
-                $fontIndex = self::getInt2d($recordData, 0) - 1;
-            }
-            $objStyle->setFont($this->objFonts[$fontIndex]);
-
-            // offset:  2; size: 2; Index to FORMAT record
-            $numberFormatIndex = self::getInt2d($recordData, 2);
-            if (isset($this->formats[$numberFormatIndex])) {
-                // then we have user-defined format code
-                $numberformat = array('code' => $this->formats[$numberFormatIndex]);
-            } elseif (($code = PHPExcel_Style_NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') {
-                // then we have built-in format code
-                $numberformat = array('code' => $code);
-            } else {
-                // we set the general format code
-                $numberformat = array('code' => 'General');
-            }
-            $objStyle->getNumberFormat()->setFormatCode($numberformat['code']);
-
-            // offset:  4; size: 2; XF type, cell protection, and parent style XF
-            // bit 2-0; mask 0x0007; XF_TYPE_PROT
-            $xfTypeProt = self::getInt2d($recordData, 4);
-            // bit 0; mask 0x01; 1 = cell is locked
-            $isLocked = (0x01 & $xfTypeProt) >> 0;
-            $objStyle->getProtection()->setLocked($isLocked ? PHPExcel_Style_Protection::PROTECTION_INHERIT : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
-
-            // bit 1; mask 0x02; 1 = Formula is hidden
-            $isHidden = (0x02 & $xfTypeProt) >> 1;
-            $objStyle->getProtection()->setHidden($isHidden ? PHPExcel_Style_Protection::PROTECTION_PROTECTED : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
-
-            // bit 2; mask 0x04; 0 = Cell XF, 1 = Cell Style XF
-            $isCellStyleXf = (0x04 & $xfTypeProt) >> 2;
-
-            // offset:  6; size: 1; Alignment and text break
-            // bit 2-0, mask 0x07; horizontal alignment
-            $horAlign = (0x07 & ord($recordData{6})) >> 0;
-            switch ($horAlign) {
-                case 0:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL);
-                    break;
-                case 1:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
-                    break;
-                case 2:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-                    break;
-                case 3:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
-                    break;
-                case 4:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_FILL);
-                    break;
-                case 5:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
-                    break;
-                case 6:
-                    $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS);
-                    break;
-            }
-            // bit 3, mask 0x08; wrap text
-            $wrapText = (0x08 & ord($recordData{6})) >> 3;
-            switch ($wrapText) {
-                case 0:
-                    $objStyle->getAlignment()->setWrapText(false);
-                    break;
-                case 1:
-                    $objStyle->getAlignment()->setWrapText(true);
-                    break;
-            }
-            // bit 6-4, mask 0x70; vertical alignment
-            $vertAlign = (0x70 & ord($recordData{6})) >> 4;
-            switch ($vertAlign) {
-                case 0:
-                    $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
-                    break;
-                case 1:
-                    $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
-                    break;
-                case 2:
-                    $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_BOTTOM);
-                    break;
-                case 3:
-                    $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
-                    break;
-            }
-
-            if ($this->version == self::XLS_BIFF8) {
-                // offset:  7; size: 1; XF_ROTATION: Text rotation angle
-                $angle = ord($recordData{7});
-                $rotation = 0;
-                if ($angle <= 90) {
-                    $rotation = $angle;
-                } elseif ($angle <= 180) {
-                    $rotation = 90 - $angle;
-                } elseif ($angle == 255) {
-                    $rotation = -165;
-                }
-                $objStyle->getAlignment()->setTextRotation($rotation);
-
-                // offset:  8; size: 1; Indentation, shrink to cell size, and text direction
-                // bit: 3-0; mask: 0x0F; indent level
-                $indent = (0x0F & ord($recordData{8})) >> 0;
-                $objStyle->getAlignment()->setIndent($indent);
-
-                // bit: 4; mask: 0x10; 1 = shrink content to fit into cell
-                $shrinkToFit = (0x10 & ord($recordData{8})) >> 4;
-                switch ($shrinkToFit) {
-                    case 0:
-                        $objStyle->getAlignment()->setShrinkToFit(false);
-                        break;
-                    case 1:
-                        $objStyle->getAlignment()->setShrinkToFit(true);
-                        break;
-                }
-
-                // offset:  9; size: 1; Flags used for attribute groups
-
-                // offset: 10; size: 4; Cell border lines and background area
-                // bit: 3-0; mask: 0x0000000F; left style
-                if ($bordersLeftStyle = PHPExcel_Reader_Excel5_Style_Border::lookup((0x0000000F & self::getInt4d($recordData, 10)) >> 0)) {
-                    $objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle);
-                }
-                // bit: 7-4; mask: 0x000000F0; right style
-                if ($bordersRightStyle = PHPExcel_Reader_Excel5_Style_Border::lookup((0x000000F0 & self::getInt4d($recordData, 10)) >> 4)) {
-                    $objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle);
-                }
-                // bit: 11-8; mask: 0x00000F00; top style
-                if ($bordersTopStyle = PHPExcel_Reader_Excel5_Style_Border::lookup((0x00000F00 & self::getInt4d($recordData, 10)) >> 8)) {
-                    $objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle);
-                }
-                // bit: 15-12; mask: 0x0000F000; bottom style
-                if ($bordersBottomStyle = PHPExcel_Reader_Excel5_Style_Border::lookup((0x0000F000 & self::getInt4d($recordData, 10)) >> 12)) {
-                    $objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle);
-                }
-                // bit: 22-16; mask: 0x007F0000; left color
-                $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & self::getInt4d($recordData, 10)) >> 16;
-
-                // bit: 29-23; mask: 0x3F800000; right color
-                $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & self::getInt4d($recordData, 10)) >> 23;
-
-                // bit: 30; mask: 0x40000000; 1 = diagonal line from top left to right bottom
-                $diagonalDown = (0x40000000 & self::getInt4d($recordData, 10)) >> 30 ? true : false;
-
-                // bit: 31; mask: 0x80000000; 1 = diagonal line from bottom left to top right
-                $diagonalUp = (0x80000000 & self::getInt4d($recordData, 10)) >> 31 ? true : false;
-
-                if ($diagonalUp == false && $diagonalDown == false) {
-                    $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE);
-                } elseif ($diagonalUp == true && $diagonalDown == false) {
-                    $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP);
-                } elseif ($diagonalUp == false && $diagonalDown == true) {
-                    $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN);
-                } elseif ($diagonalUp == true && $diagonalDown == true) {
-                    $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH);
-                }
-
-                // offset: 14; size: 4;
-                // bit: 6-0; mask: 0x0000007F; top color
-                $objStyle->getBorders()->getTop()->colorIndex = (0x0000007F & self::getInt4d($recordData, 14)) >> 0;
-
-                // bit: 13-7; mask: 0x00003F80; bottom color
-                $objStyle->getBorders()->getBottom()->colorIndex = (0x00003F80 & self::getInt4d($recordData, 14)) >> 7;
-
-                // bit: 20-14; mask: 0x001FC000; diagonal color
-                $objStyle->getBorders()->getDiagonal()->colorIndex = (0x001FC000 & self::getInt4d($recordData, 14)) >> 14;
-
-                // bit: 24-21; mask: 0x01E00000; diagonal style
-                if ($bordersDiagonalStyle = PHPExcel_Reader_Excel5_Style_Border::lookup((0x01E00000 & self::getInt4d($recordData, 14)) >> 21)) {
-                    $objStyle->getBorders()->getDiagonal()->setBorderStyle($bordersDiagonalStyle);
-                }
-
-                // bit: 31-26; mask: 0xFC000000 fill pattern
-                if ($fillType = PHPExcel_Reader_Excel5_Style_FillPattern::lookup((0xFC000000 & self::getInt4d($recordData, 14)) >> 26)) {
-                    $objStyle->getFill()->setFillType($fillType);
-                }
-                // offset: 18; size: 2; pattern and background colour
-                // bit: 6-0; mask: 0x007F; color index for pattern color
-                $objStyle->getFill()->startcolorIndex = (0x007F & self::getInt2d($recordData, 18)) >> 0;
-
-                // bit: 13-7; mask: 0x3F80; color index for pattern background
-                $objStyle->getFill()->endcolorIndex = (0x3F80 & self::getInt2d($recordData, 18)) >> 7;
-            } else {
-                // BIFF5
-
-                // offset: 7; size: 1; Text orientation and flags
-                $orientationAndFlags = ord($recordData{7});
-
-                // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation
-                $xfOrientation = (0x03 & $orientationAndFlags) >> 0;
-                switch ($xfOrientation) {
-                    case 0:
-                        $objStyle->getAlignment()->setTextRotation(0);
-                        break;
-                    case 1:
-                        $objStyle->getAlignment()->setTextRotation(-165);
-                        break;
-                    case 2:
-                        $objStyle->getAlignment()->setTextRotation(90);
-                        break;
-                    case 3:
-                        $objStyle->getAlignment()->setTextRotation(-90);
-                        break;
-                }
-
-                // offset: 8; size: 4; cell border lines and background area
-                $borderAndBackground = self::getInt4d($recordData, 8);
-
-                // bit: 6-0; mask: 0x0000007F; color index for pattern color
-                $objStyle->getFill()->startcolorIndex = (0x0000007F & $borderAndBackground) >> 0;
-
-                // bit: 13-7; mask: 0x00003F80; color index for pattern background
-                $objStyle->getFill()->endcolorIndex = (0x00003F80 & $borderAndBackground) >> 7;
-
-                // bit: 21-16; mask: 0x003F0000; fill pattern
-                $objStyle->getFill()->setFillType(PHPExcel_Reader_Excel5_Style_FillPattern::lookup((0x003F0000 & $borderAndBackground) >> 16));
-
-                // bit: 24-22; mask: 0x01C00000; bottom line style
-                $objStyle->getBorders()->getBottom()->setBorderStyle(PHPExcel_Reader_Excel5_Style_Border::lookup((0x01C00000 & $borderAndBackground) >> 22));
-
-                // bit: 31-25; mask: 0xFE000000; bottom line color
-                $objStyle->getBorders()->getBottom()->colorIndex = (0xFE000000 & $borderAndBackground) >> 25;
-
-                // offset: 12; size: 4; cell border lines
-                $borderLines = self::getInt4d($recordData, 12);
-
-                // bit: 2-0; mask: 0x00000007; top line style
-                $objStyle->getBorders()->getTop()->setBorderStyle(PHPExcel_Reader_Excel5_Style_Border::lookup((0x00000007 & $borderLines) >> 0));
-
-                // bit: 5-3; mask: 0x00000038; left line style
-                $objStyle->getBorders()->getLeft()->setBorderStyle(PHPExcel_Reader_Excel5_Style_Border::lookup((0x00000038 & $borderLines) >> 3));
-
-                // bit: 8-6; mask: 0x000001C0; right line style
-                $objStyle->getBorders()->getRight()->setBorderStyle(PHPExcel_Reader_Excel5_Style_Border::lookup((0x000001C0 & $borderLines) >> 6));
-
-                // bit: 15-9; mask: 0x0000FE00; top line color index
-                $objStyle->getBorders()->getTop()->colorIndex = (0x0000FE00 & $borderLines) >> 9;
-
-                // bit: 22-16; mask: 0x007F0000; left line color index
-                $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & $borderLines) >> 16;
-
-                // bit: 29-23; mask: 0x3F800000; right line color index
-                $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & $borderLines) >> 23;
-            }
-
-            // add cellStyleXf or cellXf and update mapping
-            if ($isCellStyleXf) {
-                // we only read one style XF record which is always the first
-                if ($this->xfIndex == 0) {
-                    $this->phpExcel->addCellStyleXf($objStyle);
-                    $this->mapCellStyleXfIndex[$this->xfIndex] = 0;
-                }
-            } else {
-                // we read all cell XF records
-                $this->phpExcel->addCellXf($objStyle);
-                $this->mapCellXfIndex[$this->xfIndex] = count($this->phpExcel->getCellXfCollection()) - 1;
-            }
-
-            // update XF index for when we read next record
-            ++$this->xfIndex;
-        }
-    }
-
-
-    /**
-     *
-     */
-    private function readXfExt()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; 0x087D = repeated header
-
-            // offset: 2; size: 2
-
-            // offset: 4; size: 8; not used
-
-            // offset: 12; size: 2; record version
-
-            // offset: 14; size: 2; index to XF record which this record modifies
-            $ixfe = self::getInt2d($recordData, 14);
-
-            // offset: 16; size: 2; not used
-
-            // offset: 18; size: 2; number of extension properties that follow
-            $cexts = self::getInt2d($recordData, 18);
-
-            // start reading the actual extension data
-            $offset = 20;
-            while ($offset < $length) {
-                // extension type
-                $extType = self::getInt2d($recordData, $offset);
-
-                // extension length
-                $cb = self::getInt2d($recordData, $offset + 2);
-
-                // extension data
-                $extData = substr($recordData, $offset + 4, $cb);
-
-                switch ($extType) {
-                    case 4:        // fill start color
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $fill = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill();
-                                $fill->getStartColor()->setRGB($rgb);
-                                unset($fill->startcolorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 5:        // fill end color
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $fill = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill();
-                                $fill->getEndColor()->setRGB($rgb);
-                                unset($fill->endcolorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 7:        // border color top
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $top = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getTop();
-                                $top->getColor()->setRGB($rgb);
-                                unset($top->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 8:        // border color bottom
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $bottom = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getBottom();
-                                $bottom->getColor()->setRGB($rgb);
-                                unset($bottom->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 9:        // border color left
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $left = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getLeft();
-                                $left->getColor()->setRGB($rgb);
-                                unset($left->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 10:        // border color right
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $right = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getRight();
-                                $right->getColor()->setRGB($rgb);
-                                unset($right->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 11:        // border color diagonal
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $diagonal = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getDiagonal();
-                                $diagonal->getColor()->setRGB($rgb);
-                                unset($diagonal->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                    case 13:    // font color
-                        $xclfType  = self::getInt2d($extData, 0); // color type
-                        $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
-
-                        if ($xclfType == 2) {
-                            $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
-
-                            // modify the relevant style property
-                            if (isset($this->mapCellXfIndex[$ixfe])) {
-                                $font = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFont();
-                                $font->getColor()->setRGB($rgb);
-                                unset($font->colorIndex); // normal color index does not apply, discard
-                            }
-                        }
-                        break;
-                }
-
-                $offset += $cb;
-            }
-        }
-
-    }
-
-
-    /**
-     * Read STYLE record
-     */
-    private function readStyle()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; index to XF record and flag for built-in style
-            $ixfe = self::getInt2d($recordData, 0);
-
-            // bit: 11-0; mask 0x0FFF; index to XF record
-            $xfIndex = (0x0FFF & $ixfe) >> 0;
-
-            // bit: 15; mask 0x8000; 0 = user-defined style, 1 = built-in style
-            $isBuiltIn = (bool) ((0x8000 & $ixfe) >> 15);
-
-            if ($isBuiltIn) {
-                // offset: 2; size: 1; identifier for built-in style
-                $builtInId = ord($recordData{2});
-
-                switch ($builtInId) {
-                    case 0x00:
-                        // currently, we are not using this for anything
-                        break;
-                    default:
-                        break;
-                }
-            } else {
-                // user-defined; not supported by PHPExcel
-            }
-        }
-    }
-
-
-    /**
-     * Read PALETTE record
-     */
-    private function readPalette()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; number of following colors
-            $nm = self::getInt2d($recordData, 0);
-
-            // list of RGB colors
-            for ($i = 0; $i < $nm; ++$i) {
-                $rgb = substr($recordData, 2 + 4 * $i, 4);
-                $this->palette[] = self::readRGB($rgb);
-            }
-        }
-    }
-
-
-    /**
-     * SHEET
-     *
-     * This record is  located in the  Workbook Globals
-     * Substream  and represents a sheet inside the workbook.
-     * One SHEET record is written for each sheet. It stores the
-     * sheet name and a stream offset to the BOF record of the
-     * respective Sheet Substream within the Workbook Stream.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readSheet()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // offset: 0; size: 4; absolute stream position of the BOF record of the sheet
-        // NOTE: not encrypted
-        $rec_offset = self::getInt4d($this->data, $this->pos + 4);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 4; size: 1; sheet state
-        switch (ord($recordData{4})) {
-            case 0x00:
-                $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE;
-                break;
-            case 0x01:
-                $sheetState = PHPExcel_Worksheet::SHEETSTATE_HIDDEN;
-                break;
-            case 0x02:
-                $sheetState = PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN;
-                break;
-            default:
-                $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE;
-                break;
-        }
-
-        // offset: 5; size: 1; sheet type
-        $sheetType = ord($recordData{5});
-
-        // offset: 6; size: var; sheet name
-        if ($this->version == self::XLS_BIFF8) {
-            $string = self::readUnicodeStringShort(substr($recordData, 6));
-            $rec_name = $string['value'];
-        } elseif ($this->version == self::XLS_BIFF7) {
-            $string = $this->readByteStringShort(substr($recordData, 6));
-            $rec_name = $string['value'];
-        }
-
-        $this->sheets[] = array(
-            'name' => $rec_name,
-            'offset' => $rec_offset,
-            'sheetState' => $sheetState,
-            'sheetType' => $sheetType,
-        );
-    }
-
-
-    /**
-     * Read EXTERNALBOOK record
-     */
-    private function readExternalBook()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset within record data
-        $offset = 0;
-
-        // there are 4 types of records
-        if (strlen($recordData) > 4) {
-            // external reference
-            // offset: 0; size: 2; number of sheet names ($nm)
-            $nm = self::getInt2d($recordData, 0);
-            $offset += 2;
-
-            // offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length)
-            $encodedUrlString = self::readUnicodeStringLong(substr($recordData, 2));
-            $offset += $encodedUrlString['size'];
-
-            // offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length)
-            $externalSheetNames = array();
-            for ($i = 0; $i < $nm; ++$i) {
-                $externalSheetNameString = self::readUnicodeStringLong(substr($recordData, $offset));
-                $externalSheetNames[] = $externalSheetNameString['value'];
-                $offset += $externalSheetNameString['size'];
-            }
-
-            // store the record data
-            $this->externalBooks[] = array(
-                'type' => 'external',
-                'encodedUrl' => $encodedUrlString['value'],
-                'externalSheetNames' => $externalSheetNames,
-            );
-        } elseif (substr($recordData, 2, 2) == pack('CC', 0x01, 0x04)) {
-            // internal reference
-            // offset: 0; size: 2; number of sheet in this document
-            // offset: 2; size: 2; 0x01 0x04
-            $this->externalBooks[] = array(
-                'type' => 'internal',
-            );
-        } elseif (substr($recordData, 0, 4) == pack('vCC', 0x0001, 0x01, 0x3A)) {
-            // add-in function
-            // offset: 0; size: 2; 0x0001
-            $this->externalBooks[] = array(
-                'type' => 'addInFunction',
-            );
-        } elseif (substr($recordData, 0, 2) == pack('v', 0x0000)) {
-            // DDE links, OLE links
-            // offset: 0; size: 2; 0x0000
-            // offset: 2; size: var; encoded source document name
-            $this->externalBooks[] = array(
-                'type' => 'DDEorOLE',
-            );
-        }
-    }
-
-
-    /**
-     * Read EXTERNNAME record.
-     */
-    private function readExternName()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // external sheet references provided for named cells
-        if ($this->version == self::XLS_BIFF8) {
-            // offset: 0; size: 2; options
-            $options = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 2;
-
-            // offset: 4; size: 2; not used
-
-            // offset: 6; size: var
-            $nameString = self::readUnicodeStringShort(substr($recordData, 6));
-
-            // offset: var; size: var; formula data
-            $offset = 6 + $nameString['size'];
-            $formula = $this->getFormulaFromStructure(substr($recordData, $offset));
-
-            $this->externalNames[] = array(
-                'name' => $nameString['value'],
-                'formula' => $formula,
-            );
-        }
-    }
-
-
-    /**
-     * Read EXTERNSHEET record
-     */
-    private function readExternSheet()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // external sheet references provided for named cells
-        if ($this->version == self::XLS_BIFF8) {
-            // offset: 0; size: 2; number of following ref structures
-            $nm = self::getInt2d($recordData, 0);
-            for ($i = 0; $i < $nm; ++$i) {
-                $this->ref[] = array(
-                    // offset: 2 + 6 * $i; index to EXTERNALBOOK record
-                    'externalBookIndex' => self::getInt2d($recordData, 2 + 6 * $i),
-                    // offset: 4 + 6 * $i; index to first sheet in EXTERNALBOOK record
-                    'firstSheetIndex' => self::getInt2d($recordData, 4 + 6 * $i),
-                    // offset: 6 + 6 * $i; index to last sheet in EXTERNALBOOK record
-                    'lastSheetIndex' => self::getInt2d($recordData, 6 + 6 * $i),
-                );
-            }
-        }
-    }
-
-
-    /**
-     * DEFINEDNAME
-     *
-     * This record is part of a Link Table. It contains the name
-     * and the token array of an internal defined name. Token
-     * arrays of defined names contain tokens with aberrant
-     * token classes.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readDefinedName()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8) {
-            // retrieves named cells
-
-            // offset: 0; size: 2; option flags
-            $opts = self::getInt2d($recordData, 0);
-
-            // bit: 5; mask: 0x0020; 0 = user-defined name, 1 = built-in-name
-            $isBuiltInName = (0x0020 & $opts) >> 5;
-
-            // offset: 2; size: 1; keyboard shortcut
-
-            // offset: 3; size: 1; length of the name (character count)
-            $nlen = ord($recordData{3});
-
-            // offset: 4; size: 2; size of the formula data (it can happen that this is zero)
-            // note: there can also be additional data, this is not included in $flen
-            $flen = self::getInt2d($recordData, 4);
-
-            // offset: 8; size: 2; 0=Global name, otherwise index to sheet (1-based)
-            $scope = self::getInt2d($recordData, 8);
-
-            // offset: 14; size: var; Name (Unicode string without length field)
-            $string = self::readUnicodeString(substr($recordData, 14), $nlen);
-
-            // offset: var; size: $flen; formula data
-            $offset = 14 + $string['size'];
-            $formulaStructure = pack('v', $flen) . substr($recordData, $offset);
-
-            try {
-                $formula = $this->getFormulaFromStructure($formulaStructure);
-            } catch (PHPExcel_Exception $e) {
-                $formula = '';
-            }
-
-            $this->definedname[] = array(
-                'isBuiltInName' => $isBuiltInName,
-                'name' => $string['value'],
-                'formula' => $formula,
-                'scope' => $scope,
-            );
-        }
-    }
-
-
-    /**
-     * Read MSODRAWINGGROUP record
-     */
-    private function readMsoDrawingGroup()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-
-        // get spliced record data
-        $splicedRecordData = $this->getSplicedRecordData();
-        $recordData = $splicedRecordData['recordData'];
-
-        $this->drawingGroupData .= $recordData;
-    }
-
-
-    /**
-     * SST - Shared String Table
-     *
-     * This record contains a list of all strings used anywhere
-     * in the workbook. Each string occurs only once. The
-     * workbook uses indexes into the list to reference the
-     * strings.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     **/
-    private function readSst()
-    {
-        // offset within (spliced) record data
-        $pos = 0;
-
-        // get spliced record data
-        $splicedRecordData = $this->getSplicedRecordData();
-
-        $recordData = $splicedRecordData['recordData'];
-        $spliceOffsets = $splicedRecordData['spliceOffsets'];
-
-        // offset: 0; size: 4; total number of strings in the workbook
-        $pos += 4;
-
-        // offset: 4; size: 4; number of following strings ($nm)
-        $nm = self::getInt4d($recordData, 4);
-        $pos += 4;
-
-        // loop through the Unicode strings (16-bit length)
-        for ($i = 0; $i < $nm; ++$i) {
-            // number of characters in the Unicode string
-            $numChars = self::getInt2d($recordData, $pos);
-            $pos += 2;
-
-            // option flags
-            $optionFlags = ord($recordData{$pos});
-            ++$pos;
-
-            // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed
-            $isCompressed = (($optionFlags & 0x01) == 0) ;
-
-            // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic
-            $hasAsian = (($optionFlags & 0x04) != 0);
-
-            // bit: 3; mask: 0x03; 0 = ordinary; 1 = Rich-Text
-            $hasRichText = (($optionFlags & 0x08) != 0);
-
-            if ($hasRichText) {
-                // number of Rich-Text formatting runs
-                $formattingRuns = self::getInt2d($recordData, $pos);
-                $pos += 2;
-            }
-
-            if ($hasAsian) {
-                // size of Asian phonetic setting
-                $extendedRunLength = self::getInt4d($recordData, $pos);
-                $pos += 4;
-            }
-
-            // expected byte length of character array if not split
-            $len = ($isCompressed) ? $numChars : $numChars * 2;
-
-            // look up limit position
-            foreach ($spliceOffsets as $spliceOffset) {
-                // it can happen that the string is empty, therefore we need
-                // <= and not just <
-                if ($pos <= $spliceOffset) {
-                    $limitpos = $spliceOffset;
-                    break;
-                }
-            }
-
-            if ($pos + $len <= $limitpos) {
-                // character array is not split between records
-
-                $retstr = substr($recordData, $pos, $len);
-                $pos += $len;
-            } else {
-                // character array is split between records
-
-                // first part of character array
-                $retstr = substr($recordData, $pos, $limitpos - $pos);
-
-                $bytesRead = $limitpos - $pos;
-
-                // remaining characters in Unicode string
-                $charsLeft = $numChars - (($isCompressed) ? $bytesRead : ($bytesRead / 2));
-
-                $pos = $limitpos;
-
-                // keep reading the characters
-                while ($charsLeft > 0) {
-                    // look up next limit position, in case the string span more than one continue record
-                    foreach ($spliceOffsets as $spliceOffset) {
-                        if ($pos < $spliceOffset) {
-                            $limitpos = $spliceOffset;
-                            break;
-                        }
-                    }
-
-                    // repeated option flags
-                    // OpenOffice.org documentation 5.21
-                    $option = ord($recordData{$pos});
-                    ++$pos;
-
-                    if ($isCompressed && ($option == 0)) {
-                        // 1st fragment compressed
-                        // this fragment compressed
-                        $len = min($charsLeft, $limitpos - $pos);
-                        $retstr .= substr($recordData, $pos, $len);
-                        $charsLeft -= $len;
-                        $isCompressed = true;
-                    } elseif (!$isCompressed && ($option != 0)) {
-                        // 1st fragment uncompressed
-                        // this fragment uncompressed
-                        $len = min($charsLeft * 2, $limitpos - $pos);
-                        $retstr .= substr($recordData, $pos, $len);
-                        $charsLeft -= $len / 2;
-                        $isCompressed = false;
-                    } elseif (!$isCompressed && ($option == 0)) {
-                        // 1st fragment uncompressed
-                        // this fragment compressed
-                        $len = min($charsLeft, $limitpos - $pos);
-                        for ($j = 0; $j < $len; ++$j) {
-                            $retstr .= $recordData{$pos + $j} . chr(0);
-                        }
-                        $charsLeft -= $len;
-                        $isCompressed = false;
-                    } else {
-                        // 1st fragment compressed
-                        // this fragment uncompressed
-                        $newstr = '';
-                        for ($j = 0; $j < strlen($retstr); ++$j) {
-                            $newstr .= $retstr[$j] . chr(0);
-                        }
-                        $retstr = $newstr;
-                        $len = min($charsLeft * 2, $limitpos - $pos);
-                        $retstr .= substr($recordData, $pos, $len);
-                        $charsLeft -= $len / 2;
-                        $isCompressed = false;
-                    }
-
-                    $pos += $len;
-                }
-            }
-
-            // convert to UTF-8
-            $retstr = self::encodeUTF16($retstr, $isCompressed);
-
-            // read additional Rich-Text information, if any
-            $fmtRuns = array();
-            if ($hasRichText) {
-                // list of formatting runs
-                for ($j = 0; $j < $formattingRuns; ++$j) {
-                    // first formatted character; zero-based
-                    $charPos = self::getInt2d($recordData, $pos + $j * 4);
-
-                    // index to font record
-                    $fontIndex = self::getInt2d($recordData, $pos + 2 + $j * 4);
-
-                    $fmtRuns[] = array(
-                        'charPos' => $charPos,
-                        'fontIndex' => $fontIndex,
-                    );
-                }
-                $pos += 4 * $formattingRuns;
-            }
-
-            // read additional Asian phonetics information, if any
-            if ($hasAsian) {
-                // For Asian phonetic settings, we skip the extended string data
-                $pos += $extendedRunLength;
-            }
-
-            // store the shared sting
-            $this->sst[] = array(
-                'value' => $retstr,
-                'fmtRuns' => $fmtRuns,
-            );
-        }
-
-        // getSplicedRecordData() takes care of moving current position in data stream
-    }
-
-
-    /**
-     * Read PRINTGRIDLINES record
-     */
-    private function readPrintGridlines()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
-            // offset: 0; size: 2; 0 = do not print sheet grid lines; 1 = print sheet gridlines
-            $printGridlines = (bool) self::getInt2d($recordData, 0);
-            $this->phpSheet->setPrintGridlines($printGridlines);
-        }
-    }
-
-
-    /**
-     * Read DEFAULTROWHEIGHT record
-     */
-    private function readDefaultRowHeight()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; option flags
-        // offset: 2; size: 2; default height for unused rows, (twips 1/20 point)
-        $height = self::getInt2d($recordData, 2);
-        $this->phpSheet->getDefaultRowDimension()->setRowHeight($height / 20);
-    }
-
-
-    /**
-     * Read SHEETPR record
-     */
-    private function readSheetPr()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2
-
-        // bit: 6; mask: 0x0040; 0 = outline buttons above outline group
-        $isSummaryBelow = (0x0040 & self::getInt2d($recordData, 0)) >> 6;
-        $this->phpSheet->setShowSummaryBelow($isSummaryBelow);
-
-        // bit: 7; mask: 0x0080; 0 = outline buttons left of outline group
-        $isSummaryRight = (0x0080 & self::getInt2d($recordData, 0)) >> 7;
-        $this->phpSheet->setShowSummaryRight($isSummaryRight);
-
-        // bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages
-        // this corresponds to radio button setting in page setup dialog in Excel
-        $this->isFitToPages = (bool) ((0x0100 & self::getInt2d($recordData, 0)) >> 8);
-    }
-
-
-    /**
-     * Read HORIZONTALPAGEBREAKS record
-     */
-    private function readHorizontalPageBreaks()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
-            // offset: 0; size: 2; number of the following row index structures
-            $nm = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 6 * $nm; list of $nm row index structures
-            for ($i = 0; $i < $nm; ++$i) {
-                $r = self::getInt2d($recordData, 2 + 6 * $i);
-                $cf = self::getInt2d($recordData, 2 + 6 * $i + 2);
-                $cl = self::getInt2d($recordData, 2 + 6 * $i + 4);
-
-                // not sure why two column indexes are necessary?
-                $this->phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW);
-            }
-        }
-    }
-
-
-    /**
-     * Read VERTICALPAGEBREAKS record
-     */
-    private function readVerticalPageBreaks()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
-            // offset: 0; size: 2; number of the following column index structures
-            $nm = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 6 * $nm; list of $nm row index structures
-            for ($i = 0; $i < $nm; ++$i) {
-                $c = self::getInt2d($recordData, 2 + 6 * $i);
-                $rf = self::getInt2d($recordData, 2 + 6 * $i + 2);
-                $rl = self::getInt2d($recordData, 2 + 6 * $i + 4);
-
-                // not sure why two row indexes are necessary?
-                $this->phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN);
-            }
-        }
-    }
-
-
-    /**
-     * Read HEADER record
-     */
-    private function readHeader()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: var
-            // realized that $recordData can be empty even when record exists
-            if ($recordData) {
-                if ($this->version == self::XLS_BIFF8) {
-                    $string = self::readUnicodeStringLong($recordData);
-                } else {
-                    $string = $this->readByteStringShort($recordData);
-                }
-
-                $this->phpSheet->getHeaderFooter()->setOddHeader($string['value']);
-                $this->phpSheet->getHeaderFooter()->setEvenHeader($string['value']);
-            }
-        }
-    }
-
-
-    /**
-     * Read FOOTER record
-     */
-    private function readFooter()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: var
-            // realized that $recordData can be empty even when record exists
-            if ($recordData) {
-                if ($this->version == self::XLS_BIFF8) {
-                    $string = self::readUnicodeStringLong($recordData);
-                } else {
-                    $string = $this->readByteStringShort($recordData);
-                }
-                $this->phpSheet->getHeaderFooter()->setOddFooter($string['value']);
-                $this->phpSheet->getHeaderFooter()->setEvenFooter($string['value']);
-            }
-        }
-    }
-
-
-    /**
-     * Read HCENTER record
-     */
-    private function readHcenter()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally
-            $isHorizontalCentered = (bool) self::getInt2d($recordData, 0);
-
-            $this->phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered);
-        }
-    }
-
-
-    /**
-     * Read VCENTER record
-     */
-    private function readVcenter()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered
-            $isVerticalCentered = (bool) self::getInt2d($recordData, 0);
-
-            $this->phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered);
-        }
-    }
-
-
-    /**
-     * Read LEFTMARGIN record
-     */
-    private function readLeftMargin()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 8
-            $this->phpSheet->getPageMargins()->setLeft(self::extractNumber($recordData));
-        }
-    }
-
-
-    /**
-     * Read RIGHTMARGIN record
-     */
-    private function readRightMargin()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 8
-            $this->phpSheet->getPageMargins()->setRight(self::extractNumber($recordData));
-        }
-    }
-
-
-    /**
-     * Read TOPMARGIN record
-     */
-    private function readTopMargin()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 8
-            $this->phpSheet->getPageMargins()->setTop(self::extractNumber($recordData));
-        }
-    }
-
-
-    /**
-     * Read BOTTOMMARGIN record
-     */
-    private function readBottomMargin()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 8
-            $this->phpSheet->getPageMargins()->setBottom(self::extractNumber($recordData));
-        }
-    }
-
-
-    /**
-     * Read PAGESETUP record
-     */
-    private function readPageSetup()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; paper size
-            $paperSize = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 2; scaling factor
-            $scale = self::getInt2d($recordData, 2);
-
-            // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed
-            $fitToWidth = self::getInt2d($recordData, 6);
-
-            // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed
-            $fitToHeight = self::getInt2d($recordData, 8);
-
-            // offset: 10; size: 2; option flags
-
-            // bit: 1; mask: 0x0002; 0=landscape, 1=portrait
-            $isPortrait = (0x0002 & self::getInt2d($recordData, 10)) >> 1;
-
-            // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init
-            // when this bit is set, do not use flags for those properties
-            $isNotInit = (0x0004 & self::getInt2d($recordData, 10)) >> 2;
-
-            if (!$isNotInit) {
-                $this->phpSheet->getPageSetup()->setPaperSize($paperSize);
-                switch ($isPortrait) {
-                    case 0:
-                        $this->phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
-                        break;
-                    case 1:
-                        $this->phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
-                        break;
-                }
-
-                $this->phpSheet->getPageSetup()->setScale($scale, false);
-                $this->phpSheet->getPageSetup()->setFitToPage((bool) $this->isFitToPages);
-                $this->phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false);
-                $this->phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false);
-            }
-
-            // offset: 16; size: 8; header margin (IEEE 754 floating-point value)
-            $marginHeader = self::extractNumber(substr($recordData, 16, 8));
-            $this->phpSheet->getPageMargins()->setHeader($marginHeader);
-
-            // offset: 24; size: 8; footer margin (IEEE 754 floating-point value)
-            $marginFooter = self::extractNumber(substr($recordData, 24, 8));
-            $this->phpSheet->getPageMargins()->setFooter($marginFooter);
-        }
-    }
-
-
-    /**
-     * PROTECT - Sheet protection (BIFF2 through BIFF8)
-     *   if this record is omitted, then it also means no sheet protection
-     */
-    private function readProtect()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // offset: 0; size: 2;
-
-        // bit 0, mask 0x01; 1 = sheet is protected
-        $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0;
-        $this->phpSheet->getProtection()->setSheet((bool)$bool);
-    }
-
-
-    /**
-     * SCENPROTECT
-     */
-    private function readScenProtect()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // offset: 0; size: 2;
-
-        // bit: 0, mask 0x01; 1 = scenarios are protected
-        $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0;
-
-        $this->phpSheet->getProtection()->setScenarios((bool)$bool);
-    }
-
-
-    /**
-     * OBJECTPROTECT
-     */
-    private function readObjectProtect()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // offset: 0; size: 2;
-
-        // bit: 0, mask 0x01; 1 = objects are protected
-        $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0;
-
-        $this->phpSheet->getProtection()->setObjects((bool)$bool);
-    }
-
-
-    /**
-     * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8)
-     */
-    private function readPassword()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; 16-bit hash value of password
-            $password = strtoupper(dechex(self::getInt2d($recordData, 0))); // the hashed password
-            $this->phpSheet->getProtection()->setPassword($password, true);
-        }
-    }
-
-
-    /**
-     * Read DEFCOLWIDTH record
-     */
-    private function readDefColWidth()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; default column width
-        $width = self::getInt2d($recordData, 0);
-        if ($width != 8) {
-            $this->phpSheet->getDefaultColumnDimension()->setWidth($width);
-        }
-    }
-
-
-    /**
-     * Read COLINFO record
-     */
-    private function readColInfo()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; index to first column in range
-            $fc = self::getInt2d($recordData, 0); // first column index
-
-            // offset: 2; size: 2; index to last column in range
-            $lc = self::getInt2d($recordData, 2); // first column index
-
-            // offset: 4; size: 2; width of the column in 1/256 of the width of the zero character
-            $width = self::getInt2d($recordData, 4);
-
-            // offset: 6; size: 2; index to XF record for default column formatting
-            $xfIndex = self::getInt2d($recordData, 6);
-
-            // offset: 8; size: 2; option flags
-            // bit: 0; mask: 0x0001; 1= columns are hidden
-            $isHidden = (0x0001 & self::getInt2d($recordData, 8)) >> 0;
-
-            // bit: 10-8; mask: 0x0700; outline level of the columns (0 = no outline)
-            $level = (0x0700 & self::getInt2d($recordData, 8)) >> 8;
-
-            // bit: 12; mask: 0x1000; 1 = collapsed
-            $isCollapsed = (0x1000 & self::getInt2d($recordData, 8)) >> 12;
-
-            // offset: 10; size: 2; not used
-
-            for ($i = $fc; $i <= $lc; ++$i) {
-                if ($lc == 255 || $lc == 256) {
-                    $this->phpSheet->getDefaultColumnDimension()->setWidth($width / 256);
-                    break;
-                }
-                $this->phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256);
-                $this->phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden);
-                $this->phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level);
-                $this->phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed);
-                $this->phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-        }
-    }
-
-
-    /**
-     * ROW
-     *
-     * This record contains the properties of a single row in a
-     * sheet. Rows and cells in a sheet are divided into blocks
-     * of 32 rows.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readRow()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; index of this row
-            $r = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 2; index to column of the first cell which is described by a cell record
-
-            // offset: 4; size: 2; index to column of the last cell which is described by a cell record, increased by 1
-
-            // offset: 6; size: 2;
-
-            // bit: 14-0; mask: 0x7FFF; height of the row, in twips = 1/20 of a point
-            $height = (0x7FFF & self::getInt2d($recordData, 6)) >> 0;
-
-            // bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height
-            $useDefaultHeight = (0x8000 & self::getInt2d($recordData, 6)) >> 15;
-
-            if (!$useDefaultHeight) {
-                $this->phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20);
-            }
-
-            // offset: 8; size: 2; not used
-
-            // offset: 10; size: 2; not used in BIFF5-BIFF8
-
-            // offset: 12; size: 4; option flags and default row formatting
-
-            // bit: 2-0: mask: 0x00000007; outline level of the row
-            $level = (0x00000007 & self::getInt4d($recordData, 12)) >> 0;
-            $this->phpSheet->getRowDimension($r + 1)->setOutlineLevel($level);
-
-            // bit: 4; mask: 0x00000010; 1 = outline group start or ends here... and is collapsed
-            $isCollapsed = (0x00000010 & self::getInt4d($recordData, 12)) >> 4;
-            $this->phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed);
-
-            // bit: 5; mask: 0x00000020; 1 = row is hidden
-            $isHidden = (0x00000020 & self::getInt4d($recordData, 12)) >> 5;
-            $this->phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden);
-
-            // bit: 7; mask: 0x00000080; 1 = row has explicit format
-            $hasExplicitFormat = (0x00000080 & self::getInt4d($recordData, 12)) >> 7;
-
-            // bit: 27-16; mask: 0x0FFF0000; only applies when hasExplicitFormat = 1; index to XF record
-            $xfIndex = (0x0FFF0000 & self::getInt4d($recordData, 12)) >> 16;
-
-            if ($hasExplicitFormat) {
-                $this->phpSheet->getRowDimension($r + 1)->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-        }
-    }
-
-
-    /**
-     * Read RK record
-     * This record represents a cell that contains an RK value
-     * (encoded integer or floating-point value). If a
-     * floating-point value cannot be encoded to an RK value,
-     * a NUMBER record will be written. This record replaces the
-     * record INTEGER written in BIFF2.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readRk()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to column
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset: 4; size: 2; index to XF record
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // offset: 6; size: 4; RK value
-            $rknum = self::getInt4d($recordData, 6);
-            $numValue = self::getIEEE754($rknum);
-
-            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-            if (!$this->readDataOnly) {
-                // add style information
-                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-
-            // add cell
-            $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-        }
-    }
-
-
-    /**
-     * Read LABELSST record
-     * This record represents a cell that contains a string. It
-     * replaces the LABEL record and RSTRING record used in
-     * BIFF2-BIFF5.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readLabelSst()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to column
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        $emptyCell = true;
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset: 4; size: 2; index to XF record
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // offset: 6; size: 4; index to SST record
-            $index = self::getInt4d($recordData, 6);
-
-            // add cell
-            if (($fmtRuns = $this->sst[$index]['fmtRuns']) && !$this->readDataOnly) {
-                // then we should treat as rich text
-                $richText = new PHPExcel_RichText();
-                $charPos = 0;
-                $sstCount = count($this->sst[$index]['fmtRuns']);
-                for ($i = 0; $i <= $sstCount; ++$i) {
-                    if (isset($fmtRuns[$i])) {
-                        $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
-                        $charPos = $fmtRuns[$i]['charPos'];
-                    } else {
-                        $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, PHPExcel_Shared_String::CountCharacters($this->sst[$index]['value']));
-                    }
-
-                    if (PHPExcel_Shared_String::CountCharacters($text) > 0) {
-                        if ($i == 0) { // first text run, no style
-                            $richText->createText($text);
-                        } else {
-                            $textRun = $richText->createTextRun($text);
-                            if (isset($fmtRuns[$i - 1])) {
-                                if ($fmtRuns[$i - 1]['fontIndex'] < 4) {
-                                    $fontIndex = $fmtRuns[$i - 1]['fontIndex'];
-                                } else {
-                                    // this has to do with that index 4 is omitted in all BIFF versions for some strange reason
-                                    // check the OpenOffice documentation of the FONT record
-                                    $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1;
-                                }
-                                $textRun->setFont(clone $this->objFonts[$fontIndex]);
-                            }
-                        }
-                    }
-                }
-                if ($this->readEmptyCells || trim($richText->getPlainText()) !== '') {
-                    $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-                    $cell->setValueExplicit($richText, PHPExcel_Cell_DataType::TYPE_STRING);
-                    $emptyCell = false;
-                }
-            } else {
-                if ($this->readEmptyCells || trim($this->sst[$index]['value']) !== '') {
-                    $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-                    $cell->setValueExplicit($this->sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING);
-                    $emptyCell = false;
-                }
-            }
-
-            if (!$this->readDataOnly && !$emptyCell) {
-                // add style information
-                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-        }
-    }
-
-
-    /**
-     * Read MULRK record
-     * This record represents a cell range containing RK value
-     * cells. All cells are located in the same row.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readMulRk()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to first column
-        $colFirst = self::getInt2d($recordData, 2);
-
-        // offset: var; size: 2; index to last column
-        $colLast = self::getInt2d($recordData, $length - 2);
-        $columns = $colLast - $colFirst + 1;
-
-        // offset within record data
-        $offset = 4;
-
-        for ($i = 0; $i < $columns; ++$i) {
-            $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i);
-
-            // Read cell?
-            if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-                // offset: var; size: 2; index to XF record
-                $xfIndex = self::getInt2d($recordData, $offset);
-
-                // offset: var; size: 4; RK value
-                $numValue = self::getIEEE754(self::getInt4d($recordData, $offset + 2));
-                $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-                if (!$this->readDataOnly) {
-                    // add style
-                    $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-                }
-
-                // add cell value
-                $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-            }
-
-            $offset += 6;
-        }
-    }
-
-
-    /**
-     * Read NUMBER record
-     * This record represents a cell that contains a
-     * floating-point value.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readNumber()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size 2; index to column
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset 4; size: 2; index to XF record
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            $numValue = self::extractNumber(substr($recordData, 6, 8));
-
-            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-            if (!$this->readDataOnly) {
-                // add cell style
-                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-
-            // add cell value
-            $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC);
-        }
-    }
-
-
-    /**
-     * Read FORMULA record + perhaps a following STRING record if formula result is a string
-     * This record contains the token array and the result of a
-     * formula cell.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readFormula()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; row index
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; col index
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        // offset: 20: size: variable; formula structure
-        $formulaStructure = substr($recordData, 20);
-
-        // offset: 14: size: 2; option flags, recalculate always, recalculate on open etc.
-        $options = self::getInt2d($recordData, 14);
-
-        // bit: 0; mask: 0x0001; 1 = recalculate always
-        // bit: 1; mask: 0x0002; 1 = calculate on open
-        // bit: 2; mask: 0x0008; 1 = part of a shared formula
-        $isPartOfSharedFormula = (bool) (0x0008 & $options);
-
-        // WARNING:
-        // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true
-        // the formula data may be ordinary formula data, therefore we need to check
-        // explicitly for the tExp token (0x01)
-        $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01;
-
-        if ($isPartOfSharedFormula) {
-            // part of shared formula which means there will be a formula with a tExp token and nothing else
-            // get the base cell, grab tExp token
-            $baseRow = self::getInt2d($formulaStructure, 3);
-            $baseCol = self::getInt2d($formulaStructure, 5);
-            $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1);
-        }
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            if ($isPartOfSharedFormula) {
-                // formula is added to this cell after the sheet has been read
-                $this->sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell;
-            }
-
-            // offset: 16: size: 4; not used
-
-            // offset: 4; size: 2; XF index
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // offset: 6; size: 8; result of the formula
-            if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) {
-                // String formula. Result follows in appended STRING record
-                $dataType = PHPExcel_Cell_DataType::TYPE_STRING;
-
-                // read possible SHAREDFMLA record
-                $code = self::getInt2d($this->data, $this->pos);
-                if ($code == self::XLS_TYPE_SHAREDFMLA) {
-                    $this->readSharedFmla();
-                }
-
-                // read STRING record
-                $value = $this->readString();
-            } elseif ((ord($recordData{6}) == 1)
-                && (ord($recordData{12}) == 255)
-                && (ord($recordData{13}) == 255)) {
-                // Boolean formula. Result is in +2; 0=false, 1=true
-                $dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
-                $value = (bool) ord($recordData{8});
-            } elseif ((ord($recordData{6}) == 2)
-                && (ord($recordData{12}) == 255)
-                && (ord($recordData{13}) == 255)) {
-                // Error formula. Error code is in +2
-                $dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
-                $value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData{8}));
-            } elseif ((ord($recordData{6}) == 3)
-                && (ord($recordData{12}) == 255)
-                && (ord($recordData{13}) == 255)) {
-                // Formula result is a null string
-                $dataType = PHPExcel_Cell_DataType::TYPE_NULL;
-                $value = '';
-            } else {
-                // forumla result is a number, first 14 bytes like _NUMBER record
-                $dataType = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                $value = self::extractNumber(substr($recordData, 6, 8));
-            }
-
-            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-            if (!$this->readDataOnly) {
-                // add cell style
-                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-
-            // store the formula
-            if (!$isPartOfSharedFormula) {
-                // not part of shared formula
-                // add cell value. If we can read formula, populate with formula, otherwise just used cached value
-                try {
-                    if ($this->version != self::XLS_BIFF8) {
-                        throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas');
-                    }
-                    $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language
-                    $cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
-
-                } catch (PHPExcel_Exception $e) {
-                    $cell->setValueExplicit($value, $dataType);
-                }
-            } else {
-                if ($this->version == self::XLS_BIFF8) {
-                    // do nothing at this point, formula id added later in the code
-                } else {
-                    $cell->setValueExplicit($value, $dataType);
-                }
-            }
-
-            // store the cached calculated value
-            $cell->setCalculatedValue($value);
-        }
-    }
-
-
-    /**
-     * Read a SHAREDFMLA record. This function just stores the binary shared formula in the reader,
-     * which usually contains relative references.
-     * These will be used to construct the formula in each shared formula part after the sheet is read.
-     */
-    private function readSharedFmla()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0, size: 6; cell range address of the area used by the shared formula, not used for anything
-        $cellRange = substr($recordData, 0, 6);
-        $cellRange = $this->readBIFF5CellRangeAddressFixed($cellRange); // note: even BIFF8 uses BIFF5 syntax
-
-        // offset: 6, size: 1; not used
-
-        // offset: 7, size: 1; number of existing FORMULA records for this shared formula
-        $no = ord($recordData{7});
-
-        // offset: 8, size: var; Binary token array of the shared formula
-        $formula = substr($recordData, 8);
-
-        // at this point we only store the shared formula for later use
-        $this->sharedFormulas[$this->_baseCell] = $formula;
-    }
-
-
-    /**
-     * Read a STRING record from current stream position and advance the stream pointer to next record
-     * This record is used for storing result from FORMULA record when it is a string, and
-     * it occurs directly after the FORMULA record
-     *
-     * @return string The string contents as UTF-8
-     */
-    private function readString()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8) {
-            $string = self::readUnicodeStringLong($recordData);
-            $value = $string['value'];
-        } else {
-            $string = $this->readByteStringLong($recordData);
-            $value = $string['value'];
-        }
-
-        return $value;
-    }
-
-
-    /**
-     * Read BOOLERR record
-     * This record represents a Boolean value or error value
-     * cell.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readBoolErr()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; row index
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; column index
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset: 4; size: 2; index to XF record
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // offset: 6; size: 1; the boolean value or error value
-            $boolErr = ord($recordData{6});
-
-            // offset: 7; size: 1; 0=boolean; 1=error
-            $isError = ord($recordData{7});
-
-            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-            switch ($isError) {
-                case 0: // boolean
-                    $value = (bool) $boolErr;
-
-                    // add cell value
-                    $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_BOOL);
-                    break;
-                case 1: // error type
-                    $value = PHPExcel_Reader_Excel5_ErrorCode::lookup($boolErr);
-
-                    // add cell value
-                    $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_ERROR);
-                    break;
-            }
-
-            if (!$this->readDataOnly) {
-                // add cell style
-                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-        }
-    }
-
-
-    /**
-     * Read MULBLANK record
-     * This record represents a cell range of empty cells. All
-     * cells are located in the same row
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readMulBlank()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to first column
-        $fc = self::getInt2d($recordData, 2);
-
-        // offset: 4; size: 2 x nc; list of indexes to XF records
-        // add style information
-        if (!$this->readDataOnly && $this->readEmptyCells) {
-            for ($i = 0; $i < $length / 2 - 3; ++$i) {
-                $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i);
-
-                // Read cell?
-                if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-                    $xfIndex = self::getInt2d($recordData, 4 + 2 * $i);
-                    $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-                }
-            }
-        }
-
-        // offset: 6; size 2; index to last column (not needed)
-    }
-
-
-    /**
-     * Read LABEL record
-     * This record represents a cell that contains a string. In
-     * BIFF8 it is usually replaced by the LABELSST record.
-     * Excel still uses this record, if it copies unformatted
-     * text cells to the clipboard.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readLabel()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; index to row
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to column
-        $column = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset: 4; size: 2; XF index
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // add cell value
-            // todo: what if string is very long? continue record
-            if ($this->version == self::XLS_BIFF8) {
-                $string = self::readUnicodeStringLong(substr($recordData, 6));
-                $value = $string['value'];
-            } else {
-                $string = $this->readByteStringLong(substr($recordData, 6));
-                $value = $string['value'];
-            }
-            if ($this->readEmptyCells || trim($value) !== '') {
-                $cell = $this->phpSheet->getCell($columnString . ($row + 1));
-                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
-
-                if (!$this->readDataOnly) {
-                    // add cell style
-                    $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Read BLANK record
-     */
-    private function readBlank()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; row index
-        $row = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; col index
-        $col = self::getInt2d($recordData, 2);
-        $columnString = PHPExcel_Cell::stringFromColumnIndex($col);
-
-        // Read cell?
-        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
-            // offset: 4; size: 2; XF index
-            $xfIndex = self::getInt2d($recordData, 4);
-
-            // add style information
-            if (!$this->readDataOnly && $this->readEmptyCells) {
-                $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
-            }
-        }
-    }
-
-
-    /**
-     * Read MSODRAWING record
-     */
-    private function readMsoDrawing()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-
-        // get spliced record data
-        $splicedRecordData = $this->getSplicedRecordData();
-        $recordData = $splicedRecordData['recordData'];
-
-        $this->drawingData .= $recordData;
-    }
-
-
-    /**
-     * Read OBJ record
-     */
-    private function readObj()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly || $this->version != self::XLS_BIFF8) {
-            return;
-        }
-
-        // recordData consists of an array of subrecords looking like this:
-        //    ft: 2 bytes; ftCmo type (0x15)
-        //    cb: 2 bytes; size in bytes of ftCmo data
-        //    ot: 2 bytes; Object Type
-        //    id: 2 bytes; Object id number
-        //    grbit: 2 bytes; Option Flags
-        //    data: var; subrecord data
-
-        // for now, we are just interested in the second subrecord containing the object type
-        $ftCmoType  = self::getInt2d($recordData, 0);
-        $cbCmoSize  = self::getInt2d($recordData, 2);
-        $otObjType  = self::getInt2d($recordData, 4);
-        $idObjID    = self::getInt2d($recordData, 6);
-        $grbitOpts  = self::getInt2d($recordData, 6);
-
-        $this->objs[] = array(
-            'ftCmoType' => $ftCmoType,
-            'cbCmoSize' => $cbCmoSize,
-            'otObjType' => $otObjType,
-            'idObjID'   => $idObjID,
-            'grbitOpts' => $grbitOpts
-        );
-        $this->textObjRef = $idObjID;
-
-//        echo '<b>_readObj()</b><br />';
-//        var_dump(end($this->objs));
-//        echo '<br />';
-    }
-
-
-    /**
-     * Read WINDOW2 record
-     */
-    private function readWindow2()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; option flags
-        $options = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; index to first visible row
-        $firstVisibleRow = self::getInt2d($recordData, 2);
-
-        // offset: 4; size: 2; index to first visible colum
-        $firstVisibleColumn = self::getInt2d($recordData, 4);
-        if ($this->version === self::XLS_BIFF8) {
-            // offset:  8; size: 2; not used
-            // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%)
-            // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%)
-            // offset: 14; size: 4; not used
-            $zoomscaleInPageBreakPreview = self::getInt2d($recordData, 10);
-            if ($zoomscaleInPageBreakPreview === 0) {
-                $zoomscaleInPageBreakPreview = 60;
-            }
-            $zoomscaleInNormalView = self::getInt2d($recordData, 12);
-            if ($zoomscaleInNormalView === 0) {
-                $zoomscaleInNormalView = 100;
-            }
-        }
-
-        // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines
-        $showGridlines = (bool) ((0x0002 & $options) >> 1);
-        $this->phpSheet->setShowGridlines($showGridlines);
-
-        // bit: 2; mask: 0x0004; 0 = do not show headers, 1 = show headers
-        $showRowColHeaders = (bool) ((0x0004 & $options) >> 2);
-        $this->phpSheet->setShowRowColHeaders($showRowColHeaders);
-
-        // bit: 3; mask: 0x0008; 0 = panes are not frozen, 1 = panes are frozen
-        $this->frozen = (bool) ((0x0008 & $options) >> 3);
-
-        // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left
-        $this->phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6));
-
-        // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active
-        $isActive = (bool) ((0x0400 & $options) >> 10);
-        if ($isActive) {
-            $this->phpExcel->setActiveSheetIndex($this->phpExcel->getIndex($this->phpSheet));
-        }
-
-        // bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view
-        $isPageBreakPreview = (bool) ((0x0800 & $options) >> 11);
-
-        //FIXME: set $firstVisibleRow and $firstVisibleColumn
-
-        if ($this->phpSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) {
-            //NOTE: this setting is inferior to page layout view(Excel2007-)
-            $view = $isPageBreakPreview ? PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL;
-            $this->phpSheet->getSheetView()->setView($view);
-            if ($this->version === self::XLS_BIFF8) {
-                $zoomScale = $isPageBreakPreview ? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView;
-                $this->phpSheet->getSheetView()->setZoomScale($zoomScale);
-                $this->phpSheet->getSheetView()->setZoomScaleNormal($zoomscaleInNormalView);
-            }
-        }
-    }
-
-    /**
-     * Read PLV Record(Created by Excel2007 or upper)
-     */
-    private function readPageLayoutView()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        //var_dump(unpack("vrt/vgrbitFrt/V2reserved/vwScalePLV/vgrbit", $recordData));
-
-        // offset: 0; size: 2; rt
-        //->ignore
-        $rt = self::getInt2d($recordData, 0);
-        // offset: 2; size: 2; grbitfr
-        //->ignore
-        $grbitFrt = self::getInt2d($recordData, 2);
-        // offset: 4; size: 8; reserved
-        //->ignore
-
-        // offset: 12; size 2; zoom scale
-        $wScalePLV = self::getInt2d($recordData, 12);
-        // offset: 14; size 2; grbit
-        $grbit = self::getInt2d($recordData, 14);
-
-        // decomprise grbit
-        $fPageLayoutView   = $grbit & 0x01;
-        $fRulerVisible     = ($grbit >> 1) & 0x01; //no support
-        $fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support
-
-        if ($fPageLayoutView === 1) {
-            $this->phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT);
-            $this->phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT
-        }
-        //otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW.
-    }
-
-    /**
-     * Read SCL record
-     */
-    private function readScl()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // offset: 0; size: 2; numerator of the view magnification
-        $numerator = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; numerator of the view magnification
-        $denumerator = self::getInt2d($recordData, 2);
-
-        // set the zoom scale (in percent)
-        $this->phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator);
-    }
-
-
-    /**
-     * Read PANE record
-     */
-    private function readPane()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; position of vertical split
-            $px = self::getInt2d($recordData, 0);
-
-            // offset: 2; size: 2; position of horizontal split
-            $py = self::getInt2d($recordData, 2);
-
-            if ($this->frozen) {
-                // frozen panes
-                $this->phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1));
-            } else {
-                // unfrozen panes; split windows; not supported by PHPExcel core
-            }
-        }
-    }
-
-
-    /**
-     * Read SELECTION record. There is one such record for each pane in the sheet.
-     */
-    private function readSelection()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 1; pane identifier
-            $paneId = ord($recordData{0});
-
-            // offset: 1; size: 2; index to row of the active cell
-            $r = self::getInt2d($recordData, 1);
-
-            // offset: 3; size: 2; index to column of the active cell
-            $c = self::getInt2d($recordData, 3);
-
-            // offset: 5; size: 2; index into the following cell range list to the
-            //  entry that contains the active cell
-            $index = self::getInt2d($recordData, 5);
-
-            // offset: 7; size: var; cell range address list containing all selected cell ranges
-            $data = substr($recordData, 7);
-            $cellRangeAddressList = $this->readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax
-
-            $selectedCells = $cellRangeAddressList['cellRangeAddresses'][0];
-
-            // first row '1' + last row '16384' indicates that full column is selected (apparently also in BIFF8!)
-            if (preg_match('/^([A-Z]+1\:[A-Z]+)16384$/', $selectedCells)) {
-                $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)16384$/', '${1}1048576', $selectedCells);
-            }
-
-            // first row '1' + last row '65536' indicates that full column is selected
-            if (preg_match('/^([A-Z]+1\:[A-Z]+)65536$/', $selectedCells)) {
-                $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)65536$/', '${1}1048576', $selectedCells);
-            }
-
-            // first column 'A' + last column 'IV' indicates that full row is selected
-            if (preg_match('/^(A[0-9]+\:)IV([0-9]+)$/', $selectedCells)) {
-                $selectedCells = preg_replace('/^(A[0-9]+\:)IV([0-9]+)$/', '${1}XFD${2}', $selectedCells);
-            }
-
-            $this->phpSheet->setSelectedCells($selectedCells);
-        }
-    }
-
-
-    private function includeCellRangeFiltered($cellRangeAddress)
-    {
-        $includeCellRange = true;
-        if ($this->getReadFilter() !== null) {
-            $includeCellRange = false;
-            $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($cellRangeAddress);
-            $rangeBoundaries[1][0]++;
-            for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; $row++) {
-                for ($column = $rangeBoundaries[0][0]; $column != $rangeBoundaries[1][0]; $column++) {
-                    if ($this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) {
-                        $includeCellRange = true;
-                        break 2;
-                    }
-                }
-            }
-        }
-        return $includeCellRange;
-    }
-
-
-    /**
-     * MERGEDCELLS
-     *
-     * This record contains the addresses of merged cell ranges
-     * in the current sheet.
-     *
-     * --    "OpenOffice.org's Documentation of the Microsoft
-     *         Excel File Format"
-     */
-    private function readMergedCells()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
-            $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($recordData);
-            foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) {
-                if ((strpos($cellRangeAddress, ':') !== false) &&
-                    ($this->includeCellRangeFiltered($cellRangeAddress))) {
-                    $this->phpSheet->mergeCells($cellRangeAddress);
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Read HYPERLINK record
-     */
-    private function readHyperLink()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer forward to next record
-        $this->pos += 4 + $length;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 8; cell range address of all cells containing this hyperlink
-            try {
-                $cellRange = $this->readBIFF8CellRangeAddressFixed($recordData, 0, 8);
-            } catch (PHPExcel_Exception $e) {
-                return;
-            }
-
-            // offset: 8, size: 16; GUID of StdLink
-
-            // offset: 24, size: 4; unknown value
-
-            // offset: 28, size: 4; option flags
-            // bit: 0; mask: 0x00000001; 0 = no link or extant, 1 = file link or URL
-            $isFileLinkOrUrl = (0x00000001 & self::getInt2d($recordData, 28)) >> 0;
-
-            // bit: 1; mask: 0x00000002; 0 = relative path, 1 = absolute path or URL
-            $isAbsPathOrUrl = (0x00000001 & self::getInt2d($recordData, 28)) >> 1;
-
-            // bit: 2 (and 4); mask: 0x00000014; 0 = no description
-            $hasDesc = (0x00000014 & self::getInt2d($recordData, 28)) >> 2;
-
-            // bit: 3; mask: 0x00000008; 0 = no text, 1 = has text
-            $hasText = (0x00000008 & self::getInt2d($recordData, 28)) >> 3;
-
-            // bit: 7; mask: 0x00000080; 0 = no target frame, 1 = has target frame
-            $hasFrame = (0x00000080 & self::getInt2d($recordData, 28)) >> 7;
-
-            // bit: 8; mask: 0x00000100; 0 = file link or URL, 1 = UNC path (inc. server name)
-            $isUNC = (0x00000100 & self::getInt2d($recordData, 28)) >> 8;
-
-            // offset within record data
-            $offset = 32;
-
-            if ($hasDesc) {
-                // offset: 32; size: var; character count of description text
-                $dl = self::getInt4d($recordData, 32);
-                // offset: 36; size: var; character array of description text, no Unicode string header, always 16-bit characters, zero terminated
-                $desc = self::encodeUTF16(substr($recordData, 36, 2 * ($dl - 1)), false);
-                $offset += 4 + 2 * $dl;
-            }
-            if ($hasFrame) {
-                $fl = self::getInt4d($recordData, $offset);
-                $offset += 4 + 2 * $fl;
-            }
-
-            // detect type of hyperlink (there are 4 types)
-            $hyperlinkType = null;
-
-            if ($isUNC) {
-                $hyperlinkType = 'UNC';
-            } elseif (!$isFileLinkOrUrl) {
-                $hyperlinkType = 'workbook';
-            } elseif (ord($recordData{$offset}) == 0x03) {
-                $hyperlinkType = 'local';
-            } elseif (ord($recordData{$offset}) == 0xE0) {
-                $hyperlinkType = 'URL';
-            }
-
-            switch ($hyperlinkType) {
-                case 'URL':
-                    // section 5.58.2: Hyperlink containing a URL
-                    // e.g. http://example.org/index.php
-
-                    // offset: var; size: 16; GUID of URL Moniker
-                    $offset += 16;
-                    // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word
-                    $us = self::getInt4d($recordData, $offset);
-                    $offset += 4;
-                    // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated
-                    $url = self::encodeUTF16(substr($recordData, $offset, $us - 2), false);
-                    $nullOffset = strpos($url, 0x00);
-                    if ($nullOffset) {
-                        $url = substr($url, 0, $nullOffset);
-                    }
-                    $url .= $hasText ? '#' : '';
-                    $offset += $us;
-                    break;
-                case 'local':
-                    // section 5.58.3: Hyperlink to local file
-                    // examples:
-                    //   mydoc.txt
-                    //   ../../somedoc.xls#Sheet!A1
-
-                    // offset: var; size: 16; GUI of File Moniker
-                    $offset += 16;
-
-                    // offset: var; size: 2; directory up-level count.
-                    $upLevelCount = self::getInt2d($recordData, $offset);
-                    $offset += 2;
-
-                    // offset: var; size: 4; character count of the shortened file path and name, including trailing zero word
-                    $sl = self::getInt4d($recordData, $offset);
-                    $offset += 4;
-
-                    // offset: var; size: sl; character array of the shortened file path and name in 8.3-DOS-format (compressed Unicode string)
-                    $shortenedFilePath = substr($recordData, $offset, $sl);
-                    $shortenedFilePath = self::encodeUTF16($shortenedFilePath, true);
-                    $shortenedFilePath = substr($shortenedFilePath, 0, -1); // remove trailing zero
-
-                    $offset += $sl;
-
-                    // offset: var; size: 24; unknown sequence
-                    $offset += 24;
-
-                    // extended file path
-                    // offset: var; size: 4; size of the following file link field including string lenth mark
-                    $sz = self::getInt4d($recordData, $offset);
-                    $offset += 4;
-
-                    // only present if $sz > 0
-                    if ($sz > 0) {
-                        // offset: var; size: 4; size of the character array of the extended file path and name
-                        $xl = self::getInt4d($recordData, $offset);
-                        $offset += 4;
-
-                        // offset: var; size 2; unknown
-                        $offset += 2;
-
-                        // offset: var; size $xl; character array of the extended file path and name.
-                        $extendedFilePath = substr($recordData, $offset, $xl);
-                        $extendedFilePath = self::encodeUTF16($extendedFilePath, false);
-                        $offset += $xl;
-                    }
-
-                    // construct the path
-                    $url = str_repeat('..\\', $upLevelCount);
-                    $url .= ($sz > 0) ? $extendedFilePath : $shortenedFilePath; // use extended path if available
-                    $url .= $hasText ? '#' : '';
-
-                    break;
-                case 'UNC':
-                    // section 5.58.4: Hyperlink to a File with UNC (Universal Naming Convention) Path
-                    // todo: implement
-                    return;
-                case 'workbook':
-                    // section 5.58.5: Hyperlink to the Current Workbook
-                    // e.g. Sheet2!B1:C2, stored in text mark field
-                    $url = 'sheet://';
-                    break;
-                default:
-                    return;
-            }
-
-            if ($hasText) {
-                // offset: var; size: 4; character count of text mark including trailing zero word
-                $tl = self::getInt4d($recordData, $offset);
-                $offset += 4;
-                // offset: var; size: var; character array of the text mark without the # sign, no Unicode header, always 16-bit characters, zero-terminated
-                $text = self::encodeUTF16(substr($recordData, $offset, 2 * ($tl - 1)), false);
-                $url .= $text;
-            }
-
-            // apply the hyperlink to all the relevant cells
-            foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cellRange) as $coordinate) {
-                $this->phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url);
-            }
-        }
-    }
-
-
-    /**
-     * Read DATAVALIDATIONS record
-     */
-    private function readDataValidations()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer forward to next record
-        $this->pos += 4 + $length;
-    }
-
-
-    /**
-     * Read DATAVALIDATION record
-     */
-    private function readDataValidation()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer forward to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // offset: 0; size: 4; Options
-        $options = self::getInt4d($recordData, 0);
-
-        // bit: 0-3; mask: 0x0000000F; type
-        $type = (0x0000000F & $options) >> 0;
-        switch ($type) {
-            case 0x00:
-                $type = PHPExcel_Cell_DataValidation::TYPE_NONE;
-                break;
-            case 0x01:
-                $type = PHPExcel_Cell_DataValidation::TYPE_WHOLE;
-                break;
-            case 0x02:
-                $type = PHPExcel_Cell_DataValidation::TYPE_DECIMAL;
-                break;
-            case 0x03:
-                $type = PHPExcel_Cell_DataValidation::TYPE_LIST;
-                break;
-            case 0x04:
-                $type = PHPExcel_Cell_DataValidation::TYPE_DATE;
-                break;
-            case 0x05:
-                $type = PHPExcel_Cell_DataValidation::TYPE_TIME;
-                break;
-            case 0x06:
-                $type = PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH;
-                break;
-            case 0x07:
-                $type = PHPExcel_Cell_DataValidation::TYPE_CUSTOM;
-                break;
-        }
-
-        // bit: 4-6; mask: 0x00000070; error type
-        $errorStyle = (0x00000070 & $options) >> 4;
-        switch ($errorStyle) {
-            case 0x00:
-                $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
-                break;
-            case 0x01:
-                $errorStyle = PHPExcel_Cell_DataValidation::STYLE_WARNING;
-                break;
-            case 0x02:
-                $errorStyle = PHPExcel_Cell_DataValidation::STYLE_INFORMATION;
-                break;
-        }
-
-        // bit: 7; mask: 0x00000080; 1= formula is explicit (only applies to list)
-        // I have only seen cases where this is 1
-        $explicitFormula = (0x00000080 & $options) >> 7;
-
-        // bit: 8; mask: 0x00000100; 1= empty cells allowed
-        $allowBlank = (0x00000100 & $options) >> 8;
-
-        // bit: 9; mask: 0x00000200; 1= suppress drop down arrow in list type validity
-        $suppressDropDown = (0x00000200 & $options) >> 9;
-
-        // bit: 18; mask: 0x00040000; 1= show prompt box if cell selected
-        $showInputMessage = (0x00040000 & $options) >> 18;
-
-        // bit: 19; mask: 0x00080000; 1= show error box if invalid values entered
-        $showErrorMessage = (0x00080000 & $options) >> 19;
-
-        // bit: 20-23; mask: 0x00F00000; condition operator
-        $operator = (0x00F00000 & $options) >> 20;
-        switch ($operator) {
-            case 0x00:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN;
-                break;
-            case 0x01:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN;
-                break;
-            case 0x02:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_EQUAL;
-                break;
-            case 0x03:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL;
-                break;
-            case 0x04:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN;
-                break;
-            case 0x05:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN;
-                break;
-            case 0x06:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL;
-                break;
-            case 0x07:
-                $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL;
-                break;
-        }
-
-        // offset: 4; size: var; title of the prompt box
-        $offset = 4;
-        $string = self::readUnicodeStringLong(substr($recordData, $offset));
-        $promptTitle = $string['value'] !== chr(0) ? $string['value'] : '';
-        $offset += $string['size'];
-
-        // offset: var; size: var; title of the error box
-        $string = self::readUnicodeStringLong(substr($recordData, $offset));
-        $errorTitle = $string['value'] !== chr(0) ? $string['value'] : '';
-        $offset += $string['size'];
-
-        // offset: var; size: var; text of the prompt box
-        $string = self::readUnicodeStringLong(substr($recordData, $offset));
-        $prompt = $string['value'] !== chr(0) ? $string['value'] : '';
-        $offset += $string['size'];
-
-        // offset: var; size: var; text of the error box
-        $string = self::readUnicodeStringLong(substr($recordData, $offset));
-        $error = $string['value'] !== chr(0) ? $string['value'] : '';
-        $offset += $string['size'];
-
-        // offset: var; size: 2; size of the formula data for the first condition
-        $sz1 = self::getInt2d($recordData, $offset);
-        $offset += 2;
-
-        // offset: var; size: 2; not used
-        $offset += 2;
-
-        // offset: var; size: $sz1; formula data for first condition (without size field)
-        $formula1 = substr($recordData, $offset, $sz1);
-        $formula1 = pack('v', $sz1) . $formula1; // prepend the length
-        try {
-            $formula1 = $this->getFormulaFromStructure($formula1);
-
-            // in list type validity, null characters are used as item separators
-            if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) {
-                $formula1 = str_replace(chr(0), ',', $formula1);
-            }
-        } catch (PHPExcel_Exception $e) {
-            return;
-        }
-        $offset += $sz1;
-
-        // offset: var; size: 2; size of the formula data for the first condition
-        $sz2 = self::getInt2d($recordData, $offset);
-        $offset += 2;
-
-        // offset: var; size: 2; not used
-        $offset += 2;
-
-        // offset: var; size: $sz2; formula data for second condition (without size field)
-        $formula2 = substr($recordData, $offset, $sz2);
-        $formula2 = pack('v', $sz2) . $formula2; // prepend the length
-        try {
-            $formula2 = $this->getFormulaFromStructure($formula2);
-        } catch (PHPExcel_Exception $e) {
-            return;
-        }
-        $offset += $sz2;
-
-        // offset: var; size: var; cell range address list with
-        $cellRangeAddressList = $this->readBIFF8CellRangeAddressList(substr($recordData, $offset));
-        $cellRangeAddresses = $cellRangeAddressList['cellRangeAddresses'];
-
-        foreach ($cellRangeAddresses as $cellRange) {
-            $stRange = $this->phpSheet->shrinkRangeToFit($cellRange);
-            foreach (PHPExcel_Cell::extractAllCellReferencesInRange($stRange) as $coordinate) {
-                $objValidation = $this->phpSheet->getCell($coordinate)->getDataValidation();
-                $objValidation->setType($type);
-                $objValidation->setErrorStyle($errorStyle);
-                $objValidation->setAllowBlank((bool)$allowBlank);
-                $objValidation->setShowInputMessage((bool)$showInputMessage);
-                $objValidation->setShowErrorMessage((bool)$showErrorMessage);
-                $objValidation->setShowDropDown(!$suppressDropDown);
-                $objValidation->setOperator($operator);
-                $objValidation->setErrorTitle($errorTitle);
-                $objValidation->setError($error);
-                $objValidation->setPromptTitle($promptTitle);
-                $objValidation->setPrompt($prompt);
-                $objValidation->setFormula1($formula1);
-                $objValidation->setFormula2($formula2);
-            }
-        }
-    }
-
-    /**
-     * Read SHEETLAYOUT record. Stores sheet tab color information.
-     */
-    private function readSheetLayout()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // local pointer in record data
-        $offset = 0;
-
-        if (!$this->readDataOnly) {
-            // offset: 0; size: 2; repeated record identifier 0x0862
-
-            // offset: 2; size: 10; not used
-
-            // offset: 12; size: 4; size of record data
-            // Excel 2003 uses size of 0x14 (documented), Excel 2007 uses size of 0x28 (not documented?)
-            $sz = self::getInt4d($recordData, 12);
-
-            switch ($sz) {
-                case 0x14:
-                    // offset: 16; size: 2; color index for sheet tab
-                    $colorIndex = self::getInt2d($recordData, 16);
-                    $color = PHPExcel_Reader_Excel5_Color::map($colorIndex, $this->palette, $this->version);
-                    $this->phpSheet->getTabColor()->setRGB($color['rgb']);
-                    break;
-                case 0x28:
-                    // TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007
-                    return;
-                    break;
-            }
-        }
-    }
-
-
-    /**
-     * Read SHEETPROTECTION record (FEATHEADR)
-     */
-    private function readSheetProtection()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        if ($this->readDataOnly) {
-            return;
-        }
-
-        // offset: 0; size: 2; repeated record header
-
-        // offset: 2; size: 2; FRT cell reference flag (=0 currently)
-
-        // offset: 4; size: 8; Currently not used and set to 0
-
-        // offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag)
-        $isf = self::getInt2d($recordData, 12);
-        if ($isf != 2) {
-            return;
-        }
-
-        // offset: 14; size: 1; =1 since this is a feat header
-
-        // offset: 15; size: 4; size of rgbHdrSData
-
-        // rgbHdrSData, assume "Enhanced Protection"
-        // offset: 19; size: 2; option flags
-        $options = self::getInt2d($recordData, 19);
-
-        // bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects
-        $bool = (0x0001 & $options) >> 0;
-        $this->phpSheet->getProtection()->setObjects(!$bool);
-
-        // bit: 1; mask 0x0002; edit scenarios
-        $bool = (0x0002 & $options) >> 1;
-        $this->phpSheet->getProtection()->setScenarios(!$bool);
-
-        // bit: 2; mask 0x0004; format cells
-        $bool = (0x0004 & $options) >> 2;
-        $this->phpSheet->getProtection()->setFormatCells(!$bool);
-
-        // bit: 3; mask 0x0008; format columns
-        $bool = (0x0008 & $options) >> 3;
-        $this->phpSheet->getProtection()->setFormatColumns(!$bool);
-
-        // bit: 4; mask 0x0010; format rows
-        $bool = (0x0010 & $options) >> 4;
-        $this->phpSheet->getProtection()->setFormatRows(!$bool);
-
-        // bit: 5; mask 0x0020; insert columns
-        $bool = (0x0020 & $options) >> 5;
-        $this->phpSheet->getProtection()->setInsertColumns(!$bool);
-
-        // bit: 6; mask 0x0040; insert rows
-        $bool = (0x0040 & $options) >> 6;
-        $this->phpSheet->getProtection()->setInsertRows(!$bool);
-
-        // bit: 7; mask 0x0080; insert hyperlinks
-        $bool = (0x0080 & $options) >> 7;
-        $this->phpSheet->getProtection()->setInsertHyperlinks(!$bool);
-
-        // bit: 8; mask 0x0100; delete columns
-        $bool = (0x0100 & $options) >> 8;
-        $this->phpSheet->getProtection()->setDeleteColumns(!$bool);
-
-        // bit: 9; mask 0x0200; delete rows
-        $bool = (0x0200 & $options) >> 9;
-        $this->phpSheet->getProtection()->setDeleteRows(!$bool);
-
-        // bit: 10; mask 0x0400; select locked cells
-        $bool = (0x0400 & $options) >> 10;
-        $this->phpSheet->getProtection()->setSelectLockedCells(!$bool);
-
-        // bit: 11; mask 0x0800; sort cell range
-        $bool = (0x0800 & $options) >> 11;
-        $this->phpSheet->getProtection()->setSort(!$bool);
-
-        // bit: 12; mask 0x1000; auto filter
-        $bool = (0x1000 & $options) >> 12;
-        $this->phpSheet->getProtection()->setAutoFilter(!$bool);
-
-        // bit: 13; mask 0x2000; pivot tables
-        $bool = (0x2000 & $options) >> 13;
-        $this->phpSheet->getProtection()->setPivotTables(!$bool);
-
-        // bit: 14; mask 0x4000; select unlocked cells
-        $bool = (0x4000 & $options) >> 14;
-        $this->phpSheet->getProtection()->setSelectUnlockedCells(!$bool);
-
-        // offset: 21; size: 2; not used
-    }
-
-
-    /**
-     * Read RANGEPROTECTION record
-     * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
-     * where it is referred to as FEAT record
-     */
-    private function readRangeProtection()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-
-        // local pointer in record data
-        $offset = 0;
-
-        if (!$this->readDataOnly) {
-            $offset += 12;
-
-            // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag
-            $isf = self::getInt2d($recordData, 12);
-            if ($isf != 2) {
-                // we only read FEAT records of type 2
-                return;
-            }
-            $offset += 2;
-
-            $offset += 5;
-
-            // offset: 19; size: 2; count of ref ranges this feature is on
-            $cref = self::getInt2d($recordData, 19);
-            $offset += 2;
-
-            $offset += 6;
-
-            // offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record)
-            $cellRanges = array();
-            for ($i = 0; $i < $cref; ++$i) {
-                try {
-                    $cellRange = $this->readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8));
-                } catch (PHPExcel_Exception $e) {
-                    return;
-                }
-                $cellRanges[] = $cellRange;
-                $offset += 8;
-            }
-
-            // offset: var; size: var; variable length of feature specific data
-            $rgbFeat = substr($recordData, $offset);
-            $offset += 4;
-
-            // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit)
-            $wPassword = self::getInt4d($recordData, $offset);
-            $offset += 4;
-
-            // Apply range protection to sheet
-            if ($cellRanges) {
-                $this->phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true);
-            }
-        }
-    }
-
-
-    /**
-     * Read IMDATA record
-     */
-    private function readImData()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-
-        // get spliced record data
-        $splicedRecordData = $this->getSplicedRecordData();
-        $recordData = $splicedRecordData['recordData'];
-
-        // UNDER CONSTRUCTION
-
-        // offset: 0; size: 2; image format
-        $cf = self::getInt2d($recordData, 0);
-
-        // offset: 2; size: 2; environment from which the file was written
-        $env = self::getInt2d($recordData, 2);
-
-        // offset: 4; size: 4; length of the image data
-        $lcb = self::getInt4d($recordData, 4);
-
-        // offset: 8; size: var; image data
-        $iData = substr($recordData, 8);
-
-        switch ($cf) {
-            case 0x09: // Windows bitmap format
-                // BITMAPCOREINFO
-                // 1. BITMAPCOREHEADER
-                // offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure
-                $bcSize = self::getInt4d($iData, 0);
-    //            var_dump($bcSize);
-
-                // offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels
-                $bcWidth = self::getInt2d($iData, 4);
-    //            var_dump($bcWidth);
-
-                // offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels.
-                $bcHeight = self::getInt2d($iData, 6);
-    //            var_dump($bcHeight);
-                $ih = imagecreatetruecolor($bcWidth, $bcHeight);
-
-                // offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1
-
-                // offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24
-                $bcBitCount = self::getInt2d($iData, 10);
-    //            var_dump($bcBitCount);
-
-                $rgbString = substr($iData, 12);
-                $rgbTriples = array();
-                while (strlen($rgbString) > 0) {
-                    $rgbTriples[] = unpack('Cb/Cg/Cr', $rgbString);
-                    $rgbString = substr($rgbString, 3);
-                }
-                $x = 0;
-                $y = 0;
-                foreach ($rgbTriples as $i => $rgbTriple) {
-                    $color = imagecolorallocate($ih, $rgbTriple['r'], $rgbTriple['g'], $rgbTriple['b']);
-                    imagesetpixel($ih, $x, $bcHeight - 1 - $y, $color);
-                    $x = ($x + 1) % $bcWidth;
-                    $y = $y + floor(($x + 1) / $bcWidth);
-                }
-                //imagepng($ih, 'image.png');
-
-                $drawing = new PHPExcel_Worksheet_Drawing();
-                $drawing->setPath($filename);
-                $drawing->setWorksheet($this->phpSheet);
-                break;
-            case 0x02: // Windows metafile or Macintosh PICT format
-            case 0x0e: // native format
-            default:
-                break;
-        }
-
-        // getSplicedRecordData() takes care of moving current position in data stream
-    }
-
-
-    /**
-     * Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record
-     * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented.
-     * In this case, we must treat the CONTINUE record as a MSODRAWING record
-     */
-    private function readContinue()
-    {
-        $length = self::getInt2d($this->data, $this->pos + 2);
-        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
-
-        // check if we are reading drawing data
-        // this is in case a free CONTINUE record occurs in other circumstances we are unaware of
-        if ($this->drawingData == '') {
-            // move stream pointer to next record
-            $this->pos += 4 + $length;
-
-            return;
-        }
-
-        // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data
-        if ($length < 4) {
-            // move stream pointer to next record
-            $this->pos += 4 + $length;
-
-            return;
-        }
-
-        // dirty check to see if CONTINUE record could be a camouflaged MSODRAWING record
-        // look inside CONTINUE record to see if it looks like a part of an Escher stream
-        // we know that Escher stream may be split at least at
-        //        0xF003 MsofbtSpgrContainer
-        //        0xF004 MsofbtSpContainer
-        //        0xF00D MsofbtClientTextbox
-        $validSplitPoints = array(0xF003, 0xF004, 0xF00D); // add identifiers if we find more
-
-        $splitPoint = self::getInt2d($recordData, 2);
-        if (in_array($splitPoint, $validSplitPoints)) {
-            // get spliced record data (and move pointer to next record)
-            $splicedRecordData = $this->getSplicedRecordData();
-            $this->drawingData .= $splicedRecordData['recordData'];
-
-            return;
-        }
-
-        // move stream pointer to next record
-        $this->pos += 4 + $length;
-    }
-
-
-    /**
-     * Reads a record from current position in data stream and continues reading data as long as CONTINUE
-     * records are found. Splices the record data pieces and returns the combined string as if record data
-     * is in one piece.
-     * Moves to next current position in data stream to start of next record different from a CONtINUE record
-     *
-     * @return array
-     */
-    private function getSplicedRecordData()
-    {
-        $data = '';
-        $spliceOffsets = array();
-
-        $i = 0;
-        $spliceOffsets[0] = 0;
-
-        do {
-            ++$i;
-
-            // offset: 0; size: 2; identifier
-            $identifier = self::getInt2d($this->data, $this->pos);
-            // offset: 2; size: 2; length
-            $length = self::getInt2d($this->data, $this->pos + 2);
-            $data .= $this->readRecordData($this->data, $this->pos + 4, $length);
-
-            $spliceOffsets[$i] = $spliceOffsets[$i - 1] + $length;
-
-            $this->pos += 4 + $length;
-            $nextIdentifier = self::getInt2d($this->data, $this->pos);
-        } while ($nextIdentifier == self::XLS_TYPE_CONTINUE);
-
-        $splicedData = array(
-            'recordData' => $data,
-            'spliceOffsets' => $spliceOffsets,
-        );
-
-        return $splicedData;
-
-    }
-
-
-    /**
-     * Convert formula structure into human readable Excel formula like 'A3+A5*5'
-     *
-     * @param string $formulaStructure The complete binary data for the formula
-     * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
-     * @return string Human readable formula
-     */
-    private function getFormulaFromStructure($formulaStructure, $baseCell = 'A1')
-    {
-        // offset: 0; size: 2; size of the following formula data
-        $sz = self::getInt2d($formulaStructure, 0);
-
-        // offset: 2; size: sz
-        $formulaData = substr($formulaStructure, 2, $sz);
-
-        // for debug: dump the formula data
-        //echo '<xmp>';
-        //echo 'size: ' . $sz . "\n";
-        //echo 'the entire formula data: ';
-        //Debug::dump($formulaData);
-        //echo "\n----\n";
-
-        // offset: 2 + sz; size: variable (optional)
-        if (strlen($formulaStructure) > 2 + $sz) {
-            $additionalData = substr($formulaStructure, 2 + $sz);
-
-            // for debug: dump the additional data
-            //echo 'the entire additional data: ';
-            //Debug::dump($additionalData);
-            //echo "\n----\n";
-        } else {
-            $additionalData = '';
-        }
-
-        return $this->getFormulaFromData($formulaData, $additionalData, $baseCell);
-    }
-
-
-    /**
-     * Take formula data and additional data for formula and return human readable formula
-     *
-     * @param string $formulaData The binary data for the formula itself
-     * @param string $additionalData Additional binary data going with the formula
-     * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
-     * @return string Human readable formula
-     */
-    private function getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1')
-    {
-        // start parsing the formula data
-        $tokens = array();
-
-        while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) {
-            $tokens[] = $token;
-            $formulaData = substr($formulaData, $token['size']);
-
-            // for debug: dump the token
-            //var_dump($token);
-        }
-
-        $formulaString = $this->createFormulaFromTokens($tokens, $additionalData);
-
-        return $formulaString;
-    }
-
-
-    /**
-     * Take array of tokens together with additional data for formula and return human readable formula
-     *
-     * @param array $tokens
-     * @param array $additionalData Additional binary data going with the formula
-     * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
-     * @return string Human readable formula
-     */
-    private function createFormulaFromTokens($tokens, $additionalData)
-    {
-        // empty formula?
-        if (empty($tokens)) {
-            return '';
-        }
-
-        $formulaStrings = array();
-        foreach ($tokens as $token) {
-            // initialize spaces
-            $space0 = isset($space0) ? $space0 : ''; // spaces before next token, not tParen
-            $space1 = isset($space1) ? $space1 : ''; // carriage returns before next token, not tParen
-            $space2 = isset($space2) ? $space2 : ''; // spaces before opening parenthesis
-            $space3 = isset($space3) ? $space3 : ''; // carriage returns before opening parenthesis
-            $space4 = isset($space4) ? $space4 : ''; // spaces before closing parenthesis
-            $space5 = isset($space5) ? $space5 : ''; // carriage returns before closing parenthesis
-
-            switch ($token['name']) {
-                case 'tAdd': // addition
-                case 'tConcat': // addition
-                case 'tDiv': // division
-                case 'tEQ': // equality
-                case 'tGE': // greater than or equal
-                case 'tGT': // greater than
-                case 'tIsect': // intersection
-                case 'tLE': // less than or equal
-                case 'tList': // less than or equal
-                case 'tLT': // less than
-                case 'tMul': // multiplication
-                case 'tNE': // multiplication
-                case 'tPower': // power
-                case 'tRange': // range
-                case 'tSub': // subtraction
-                    $op2 = array_pop($formulaStrings);
-                    $op1 = array_pop($formulaStrings);
-                    $formulaStrings[] = "$op1$space1$space0{$token['data']}$op2";
-                    unset($space0, $space1);
-                    break;
-                case 'tUplus': // unary plus
-                case 'tUminus': // unary minus
-                    $op = array_pop($formulaStrings);
-                    $formulaStrings[] = "$space1$space0{$token['data']}$op";
-                    unset($space0, $space1);
-                    break;
-                case 'tPercent': // percent sign
-                    $op = array_pop($formulaStrings);
-                    $formulaStrings[] = "$op$space1$space0{$token['data']}";
-                    unset($space0, $space1);
-                    break;
-                case 'tAttrVolatile': // indicates volatile function
-                case 'tAttrIf':
-                case 'tAttrSkip':
-                case 'tAttrChoose':
-                    // token is only important for Excel formula evaluator
-                    // do nothing
-                    break;
-                case 'tAttrSpace': // space / carriage return
-                    // space will be used when next token arrives, do not alter formulaString stack
-                    switch ($token['data']['spacetype']) {
-                        case 'type0':
-                            $space0 = str_repeat(' ', $token['data']['spacecount']);
-                            break;
-                        case 'type1':
-                            $space1 = str_repeat("\n", $token['data']['spacecount']);
-                            break;
-                        case 'type2':
-                            $space2 = str_repeat(' ', $token['data']['spacecount']);
-                            break;
-                        case 'type3':
-                            $space3 = str_repeat("\n", $token['data']['spacecount']);
-                            break;
-                        case 'type4':
-                            $space4 = str_repeat(' ', $token['data']['spacecount']);
-                            break;
-                        case 'type5':
-                            $space5 = str_repeat("\n", $token['data']['spacecount']);
-                            break;
-                    }
-                    break;
-                case 'tAttrSum': // SUM function with one parameter
-                    $op = array_pop($formulaStrings);
-                    $formulaStrings[] = "{$space1}{$space0}SUM($op)";
-                    unset($space0, $space1);
-                    break;
-                case 'tFunc': // function with fixed number of arguments
-                case 'tFuncV': // function with variable number of arguments
-                    if ($token['data']['function'] != '') {
-                        // normal function
-                        $ops = array(); // array of operators
-                        for ($i = 0; $i < $token['data']['args']; ++$i) {
-                            $ops[] = array_pop($formulaStrings);
-                        }
-                        $ops = array_reverse($ops);
-                        $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ")";
-                        unset($space0, $space1);
-                    } else {
-                        // add-in function
-                        $ops = array(); // array of operators
-                        for ($i = 0; $i < $token['data']['args'] - 1; ++$i) {
-                            $ops[] = array_pop($formulaStrings);
-                        }
-                        $ops = array_reverse($ops);
-                        $function = array_pop($formulaStrings);
-                        $formulaStrings[] = "$space1$space0$function(" . implode(',', $ops) . ")";
-                        unset($space0, $space1);
-                    }
-                    break;
-                case 'tParen': // parenthesis
-                    $expression = array_pop($formulaStrings);
-                    $formulaStrings[] = "$space3$space2($expression$space5$space4)";
-                    unset($space2, $space3, $space4, $space5);
-                    break;
-                case 'tArray': // array constant
-                    $constantArray = self::readBIFF8ConstantArray($additionalData);
-                    $formulaStrings[] = $space1 . $space0 . $constantArray['value'];
-                    $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data
-                    unset($space0, $space1);
-                    break;
-                case 'tMemArea':
-                    // bite off chunk of additional data
-                    $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($additionalData);
-                    $additionalData = substr($additionalData, $cellRangeAddressList['size']);
-                    $formulaStrings[] = "$space1$space0{$token['data']}";
-                    unset($space0, $space1);
-                    break;
-                case 'tArea': // cell range address
-                case 'tBool': // boolean
-                case 'tErr': // error code
-                case 'tInt': // integer
-                case 'tMemErr':
-                case 'tMemFunc':
-                case 'tMissArg':
-                case 'tName':
-                case 'tNameX':
-                case 'tNum': // number
-                case 'tRef': // single cell reference
-                case 'tRef3d': // 3d cell reference
-                case 'tArea3d': // 3d cell range reference
-                case 'tRefN':
-                case 'tAreaN':
-                case 'tStr': // string
-                    $formulaStrings[] = "$space1$space0{$token['data']}";
-                    unset($space0, $space1);
-                    break;
-            }
-        }
-        $formulaString = $formulaStrings[0];
-
-        // for debug: dump the human readable formula
-        //echo '----' . "\n";
-        //echo 'Formula: ' . $formulaString;
-
-        return $formulaString;
-    }
-
-
-    /**
-     * Fetch next token from binary formula data
-     *
-     * @param string Formula data
-     * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
-     * @return array
-     * @throws PHPExcel_Reader_Exception
-     */
-    private function getNextToken($formulaData, $baseCell = 'A1')
-    {
-        // offset: 0; size: 1; token id
-        $id = ord($formulaData[0]); // token id
-        $name = false; // initialize token name
-
-        switch ($id) {
-            case 0x03:
-                $name = 'tAdd';
-                $size = 1;
-                $data = '+';
-                break;
-            case 0x04:
-                $name = 'tSub';
-                $size = 1;
-                $data = '-';
-                break;
-            case 0x05:
-                $name = 'tMul';
-                $size = 1;
-                $data = '*';
-                break;
-            case 0x06:
-                $name = 'tDiv';
-                $size = 1;
-                $data = '/';
-                break;
-            case 0x07:
-                $name = 'tPower';
-                $size = 1;
-                $data = '^';
-                break;
-            case 0x08:
-                $name = 'tConcat';
-                $size = 1;
-                $data = '&';
-                break;
-            case 0x09:
-                $name = 'tLT';
-                $size = 1;
-                $data = '<';
-                break;
-            case 0x0A:
-                $name = 'tLE';
-                $size = 1;
-                $data = '<=';
-                break;
-            case 0x0B:
-                $name = 'tEQ';
-                $size = 1;
-                $data = '=';
-                break;
-            case 0x0C:
-                $name = 'tGE';
-                $size = 1;
-                $data = '>=';
-                break;
-            case 0x0D:
-                $name = 'tGT';
-                $size = 1;
-                $data = '>';
-                break;
-            case 0x0E:
-                $name = 'tNE';
-                $size = 1;
-                $data = '<>';
-                break;
-            case 0x0F:
-                $name = 'tIsect';
-                $size = 1;
-                $data = ' ';
-                break;
-            case 0x10:
-                $name = 'tList';
-                $size = 1;
-                $data = ',';
-                break;
-            case 0x11:
-                $name = 'tRange';
-                $size = 1;
-                $data = ':';
-                break;
-            case 0x12:
-                $name = 'tUplus';
-                $size = 1;
-                $data = '+';
-                break;
-            case 0x13:
-                $name = 'tUminus';
-                $size = 1;
-                $data = '-';
-                break;
-            case 0x14:
-                $name = 'tPercent';
-                $size = 1;
-                $data = '%';
-                break;
-            case 0x15:    //    parenthesis
-                $name  = 'tParen';
-                $size  = 1;
-                $data = null;
-                break;
-            case 0x16:    //    missing argument
-                $name = 'tMissArg';
-                $size = 1;
-                $data = '';
-                break;
-            case 0x17:    //    string
-                $name = 'tStr';
-                // offset: 1; size: var; Unicode string, 8-bit string length
-                $string = self::readUnicodeStringShort(substr($formulaData, 1));
-                $size = 1 + $string['size'];
-                $data = self::UTF8toExcelDoubleQuoted($string['value']);
-                break;
-            case 0x19:    //    Special attribute
-                // offset: 1; size: 1; attribute type flags:
-                switch (ord($formulaData[1])) {
-                    case 0x01:
-                        $name = 'tAttrVolatile';
-                        $size = 4;
-                        $data = null;
-                        break;
-                    case 0x02:
-                        $name = 'tAttrIf';
-                        $size = 4;
-                        $data = null;
-                        break;
-                    case 0x04:
-                        $name = 'tAttrChoose';
-                        // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1)
-                        $nc = self::getInt2d($formulaData, 2);
-                        // offset: 4; size: 2 * $nc
-                        // offset: 4 + 2 * $nc; size: 2
-                        $size = 2 * $nc + 6;
-                        $data = null;
-                        break;
-                    case 0x08:
-                        $name = 'tAttrSkip';
-                        $size = 4;
-                        $data = null;
-                        break;
-                    case 0x10:
-                        $name = 'tAttrSum';
-                        $size = 4;
-                        $data = null;
-                        break;
-                    case 0x40:
-                    case 0x41:
-                        $name = 'tAttrSpace';
-                        $size = 4;
-                        // offset: 2; size: 2; space type and position
-                        switch (ord($formulaData[2])) {
-                            case 0x00:
-                                $spacetype = 'type0';
-                                break;
-                            case 0x01:
-                                $spacetype = 'type1';
-                                break;
-                            case 0x02:
-                                $spacetype = 'type2';
-                                break;
-                            case 0x03:
-                                $spacetype = 'type3';
-                                break;
-                            case 0x04:
-                                $spacetype = 'type4';
-                                break;
-                            case 0x05:
-                                $spacetype = 'type5';
-                                break;
-                            default:
-                                throw new PHPExcel_Reader_Exception('Unrecognized space type in tAttrSpace token');
-                                break;
-                        }
-                        // offset: 3; size: 1; number of inserted spaces/carriage returns
-                        $spacecount = ord($formulaData[3]);
-
-                        $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount);
-                        break;
-                    default:
-                        throw new PHPExcel_Reader_Exception('Unrecognized attribute flag in tAttr token');
-                        break;
-                }
-                break;
-            case 0x1C:    //    error code
-                // offset: 1; size: 1; error code
-                $name = 'tErr';
-                $size = 2;
-                $data = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($formulaData[1]));
-                break;
-            case 0x1D:    //    boolean
-                // offset: 1; size: 1; 0 = false, 1 = true;
-                $name = 'tBool';
-                $size = 2;
-                $data = ord($formulaData[1]) ? 'TRUE' : 'FALSE';
-                break;
-            case 0x1E:    //    integer
-                // offset: 1; size: 2; unsigned 16-bit integer
-                $name = 'tInt';
-                $size = 3;
-                $data = self::getInt2d($formulaData, 1);
-                break;
-            case 0x1F:    //    number
-                // offset: 1; size: 8;
-                $name = 'tNum';
-                $size = 9;
-                $data = self::extractNumber(substr($formulaData, 1));
-                $data = str_replace(',', '.', (string)$data); // in case non-English locale
-                break;
-            case 0x20:    //    array constant
-            case 0x40:
-            case 0x60:
-                // offset: 1; size: 7; not used
-                $name = 'tArray';
-                $size = 8;
-                $data = null;
-                break;
-            case 0x21:    //    function with fixed number of arguments
-            case 0x41:
-            case 0x61:
-                $name = 'tFunc';
-                $size = 3;
-                // offset: 1; size: 2; index to built-in sheet function
-                switch (self::getInt2d($formulaData, 1)) {
-                    case 2:
-                        $function = 'ISNA';
-                        $args = 1;
-                        break;
-                    case 3:
-                        $function = 'ISERROR';
-                        $args = 1;
-                        break;
-                    case 10:
-                        $function = 'NA';
-                        $args = 0;
-                        break;
-                    case 15:
-                        $function = 'SIN';
-                        $args = 1;
-                        break;
-                    case 16:
-                        $function = 'COS';
-                        $args = 1;
-                        break;
-                    case 17:
-                        $function = 'TAN';
-                        $args = 1;
-                        break;
-                    case 18:
-                        $function = 'ATAN';
-                        $args = 1;
-                        break;
-                    case 19:
-                        $function = 'PI';
-                        $args = 0;
-                        break;
-                    case 20:
-                        $function = 'SQRT';
-                        $args = 1;
-                        break;
-                    case 21:
-                        $function = 'EXP';
-                        $args = 1;
-                        break;
-                    case 22:
-                        $function = 'LN';
-                        $args = 1;
-                        break;
-                    case 23:
-                        $function = 'LOG10';
-                        $args = 1;
-                        break;
-                    case 24:
-                        $function = 'ABS';
-                        $args = 1;
-                        break;
-                    case 25:
-                        $function = 'INT';
-                        $args = 1;
-                        break;
-                    case 26:
-                        $function = 'SIGN';
-                        $args = 1;
-                        break;
-                    case 27:
-                        $function = 'ROUND';
-                        $args = 2;
-                        break;
-                    case 30:
-                        $function = 'REPT';
-                        $args = 2;
-                        break;
-                    case 31:
-                        $function = 'MID';
-                        $args = 3;
-                        break;
-                    case 32:
-                        $function = 'LEN';
-                        $args = 1;
-                        break;
-                    case 33:
-                        $function = 'VALUE';
-                        $args = 1;
-                        break;
-                    case 34:
-                        $function = 'TRUE';
-                        $args = 0;
-                        break;
-                    case 35:
-                        $function = 'FALSE';
-                        $args = 0;
-                        break;
-                    case 38:
-                        $function = 'NOT';
-                        $args = 1;
-                        break;
-                    case 39:
-                        $function = 'MOD';
-                        $args = 2;
-                        break;
-                    case 40:
-                        $function = 'DCOUNT';
-                        $args = 3;
-                        break;
-                    case 41:
-                        $function = 'DSUM';
-                        $args = 3;
-                        break;
-                    case 42:
-                        $function = 'DAVERAGE';
-                        $args = 3;
-                        break;
-                    case 43:
-                        $function = 'DMIN';
-                        $args = 3;
-                        break;
-                    case 44:
-                        $function = 'DMAX';
-                        $args = 3;
-                        break;
-                    case 45:
-                        $function = 'DSTDEV';
-                        $args = 3;
-                        break;
-                    case 48:
-                        $function = 'TEXT';
-                        $args = 2;
-                        break;
-                    case 61:
-                        $function = 'MIRR';
-                        $args = 3;
-                        break;
-                    case 63:
-                        $function = 'RAND';
-                        $args = 0;
-                        break;
-                    case 65:
-                        $function = 'DATE';
-                        $args = 3;
-                        break;
-                    case 66:
-                        $function = 'TIME';
-                        $args = 3;
-                        break;
-                    case 67:
-                        $function = 'DAY';
-                        $args = 1;
-                        break;
-                    case 68:
-                        $function = 'MONTH';
-                        $args = 1;
-                        break;
-                    case 69:
-                        $function = 'YEAR';
-                        $args = 1;
-                        break;
-                    case 71:
-                        $function = 'HOUR';
-                        $args = 1;
-                        break;
-                    case 72:
-                        $function = 'MINUTE';
-                        $args = 1;
-                        break;
-                    case 73:
-                        $function = 'SECOND';
-                        $args = 1;
-                        break;
-                    case 74:
-                        $function = 'NOW';
-                        $args = 0;
-                        break;
-                    case 75:
-                        $function = 'AREAS';
-                        $args = 1;
-                        break;
-                    case 76:
-                        $function = 'ROWS';
-                        $args = 1;
-                        break;
-                    case 77:
-                        $function = 'COLUMNS';
-                        $args = 1;
-                        break;
-                    case 83:
-                        $function = 'TRANSPOSE';
-                        $args = 1;
-                        break;
-                    case 86:
-                        $function = 'TYPE';
-                        $args = 1;
-                        break;
-                    case 97:
-                        $function = 'ATAN2';
-                        $args = 2;
-                        break;
-                    case 98:
-                        $function = 'ASIN';
-                        $args = 1;
-                        break;
-                    case 99:
-                        $function = 'ACOS';
-                        $args = 1;
-                        break;
-                    case 105:
-                        $function = 'ISREF';
-                        $args = 1;
-                        break;
-                    case 111:
-                        $function = 'CHAR';
-                        $args = 1;
-                        break;
-                    case 112:
-                        $function = 'LOWER';
-                        $args = 1;
-                        break;
-                    case 113:
-                        $function = 'UPPER';
-                        $args = 1;
-                        break;
-                    case 114:
-                        $function = 'PROPER';
-                        $args = 1;
-                        break;
-                    case 117:
-                        $function = 'EXACT';
-                        $args = 2;
-                        break;
-                    case 118:
-                        $function = 'TRIM';
-                        $args = 1;
-                        break;
-                    case 119:
-                        $function = 'REPLACE';
-                        $args = 4;
-                        break;
-                    case 121:
-                        $function = 'CODE';
-                        $args = 1;
-                        break;
-                    case 126:
-                        $function = 'ISERR';
-                        $args = 1;
-                        break;
-                    case 127:
-                        $function = 'ISTEXT';
-                        $args = 1;
-                        break;
-                    case 128:
-                        $function = 'ISNUMBER';
-                        $args = 1;
-                        break;
-                    case 129:
-                        $function = 'ISBLANK';
-                        $args = 1;
-                        break;
-                    case 130:
-                        $function = 'T';
-                        $args = 1;
-                        break;
-                    case 131:
-                        $function = 'N';
-                        $args = 1;
-                        break;
-                    case 140:
-                        $function = 'DATEVALUE';
-                        $args = 1;
-                        break;
-                    case 141:
-                        $function = 'TIMEVALUE';
-                        $args = 1;
-                        break;
-                    case 142:
-                        $function = 'SLN';
-                        $args = 3;
-                        break;
-                    case 143:
-                        $function = 'SYD';
-                        $args = 4;
-                        break;
-                    case 162:
-                        $function = 'CLEAN';
-                        $args = 1;
-                        break;
-                    case 163:
-                        $function = 'MDETERM';
-                        $args = 1;
-                        break;
-                    case 164:
-                        $function = 'MINVERSE';
-                        $args = 1;
-                        break;
-                    case 165:
-                        $function = 'MMULT';
-                        $args = 2;
-                        break;
-                    case 184:
-                        $function = 'FACT';
-                        $args = 1;
-                        break;
-                    case 189:
-                        $function = 'DPRODUCT';
-                        $args = 3;
-                        break;
-                    case 190:
-                        $function = 'ISNONTEXT';
-                        $args = 1;
-                        break;
-                    case 195:
-                        $function = 'DSTDEVP';
-                        $args = 3;
-                        break;
-                    case 196:
-                        $function = 'DVARP';
-                        $args = 3;
-                        break;
-                    case 198:
-                        $function = 'ISLOGICAL';
-                        $args = 1;
-                        break;
-                    case 199:
-                        $function = 'DCOUNTA';
-                        $args = 3;
-                        break;
-                    case 207:
-                        $function = 'REPLACEB';
-                        $args = 4;
-                        break;
-                    case 210:
-                        $function = 'MIDB';
-                        $args = 3;
-                        break;
-                    case 211:
-                        $function = 'LENB';
-                        $args = 1;
-                        break;
-                    case 212:
-                        $function = 'ROUNDUP';
-                        $args = 2;
-                        break;
-                    case 213:
-                        $function = 'ROUNDDOWN';
-                        $args = 2;
-                        break;
-                    case 214:
-                        $function = 'ASC';
-                        $args = 1;
-                        break;
-                    case 215:
-                        $function = 'DBCS';
-                        $args = 1;
-                        break;
-                    case 221:
-                        $function = 'TODAY';
-                        $args = 0;
-                        break;
-                    case 229:
-                        $function = 'SINH';
-                        $args = 1;
-                        break;
-                    case 230:
-                        $function = 'COSH';
-                        $args = 1;
-                        break;
-                    case 231:
-                        $function = 'TANH';
-                        $args = 1;
-                        break;
-                    case 232:
-                        $function = 'ASINH';
-                        $args = 1;
-                        break;
-                    case 233:
-                        $function = 'ACOSH';
-                        $args = 1;
-                        break;
-                    case 234:
-                        $function = 'ATANH';
-                        $args = 1;
-                        break;
-                    case 235:
-                        $function = 'DGET';
-                        $args = 3;
-                        break;
-                    case 244:
-                        $function = 'INFO';
-                        $args = 1;
-                        break;
-                    case 252:
-                        $function = 'FREQUENCY';
-                        $args = 2;
-                        break;
-                    case 261:
-                        $function = 'ERROR.TYPE';
-                        $args = 1;
-                        break;
-                    case 271:
-                        $function = 'GAMMALN';
-                        $args = 1;
-                        break;
-                    case 273:
-                        $function = 'BINOMDIST';
-                        $args = 4;
-                        break;
-                    case 274:
-                        $function = 'CHIDIST';
-                        $args = 2;
-                        break;
-                    case 275:
-                        $function = 'CHIINV';
-                        $args = 2;
-                        break;
-                    case 276:
-                        $function = 'COMBIN';
-                        $args = 2;
-                        break;
-                    case 277:
-                        $function = 'CONFIDENCE';
-                        $args = 3;
-                        break;
-                    case 278:
-                        $function = 'CRITBINOM';
-                        $args = 3;
-                        break;
-                    case 279:
-                        $function = 'EVEN';
-                        $args = 1;
-                        break;
-                    case 280:
-                        $function = 'EXPONDIST';
-                        $args = 3;
-                        break;
-                    case 281:
-                        $function = 'FDIST';
-                        $args = 3;
-                        break;
-                    case 282:
-                        $function = 'FINV';
-                        $args = 3;
-                        break;
-                    case 283:
-                        $function = 'FISHER';
-                        $args = 1;
-                        break;
-                    case 284:
-                        $function = 'FISHERINV';
-                        $args = 1;
-                        break;
-                    case 285:
-                        $function = 'FLOOR';
-                        $args = 2;
-                        break;
-                    case 286:
-                        $function = 'GAMMADIST';
-                        $args = 4;
-                        break;
-                    case 287:
-                        $function = 'GAMMAINV';
-                        $args = 3;
-                        break;
-                    case 288:
-                        $function = 'CEILING';
-                        $args = 2;
-                        break;
-                    case 289:
-                        $function = 'HYPGEOMDIST';
-                        $args = 4;
-                        break;
-                    case 290:
-                        $function = 'LOGNORMDIST';
-                        $args = 3;
-                        break;
-                    case 291:
-                        $function = 'LOGINV';
-                        $args = 3;
-                        break;
-                    case 292:
-                        $function = 'NEGBINOMDIST';
-                        $args = 3;
-                        break;
-                    case 293:
-                        $function = 'NORMDIST';
-                        $args = 4;
-                        break;
-                    case 294:
-                        $function = 'NORMSDIST';
-                        $args = 1;
-                        break;
-                    case 295:
-                        $function = 'NORMINV';
-                        $args = 3;
-                        break;
-                    case 296:
-                        $function = 'NORMSINV';
-                        $args = 1;
-                        break;
-                    case 297:
-                        $function = 'STANDARDIZE';
-                        $args = 3;
-                        break;
-                    case 298:
-                        $function = 'ODD';
-                        $args = 1;
-                        break;
-                    case 299:
-                        $function = 'PERMUT';
-                        $args = 2;
-                        break;
-                    case 300:
-                        $function = 'POISSON';
-                        $args = 3;
-                        break;
-                    case 301:
-                        $function = 'TDIST';
-                        $args = 3;
-                        break;
-                    case 302:
-                        $function = 'WEIBULL';
-                        $args = 4;
-                        break;
-                    case 303:
-                        $function = 'SUMXMY2';
-                        $args = 2;
-                        break;
-                    case 304:
-                        $function = 'SUMX2MY2';
-                        $args = 2;
-                        break;
-                    case 305:
-                        $function = 'SUMX2PY2';
-                        $args = 2;
-                        break;
-                    case 306:
-                        $function = 'CHITEST';
-                        $args = 2;
-                        break;
-                    case 307:
-                        $function = 'CORREL';
-                        $args = 2;
-                        break;
-                    case 308:
-                        $function = 'COVAR';
-                        $args = 2;
-                        break;
-                    case 309:
-                        $function = 'FORECAST';
-                        $args = 3;
-                        break;
-                    case 310:
-                        $function = 'FTEST';
-                        $args = 2;
-                        break;
-                    case 311:
-                        $function = 'INTERCEPT';
-                        $args = 2;
-                        break;
-                    case 312:
-                        $function = 'PEARSON';
-                        $args = 2;
-                        break;
-                    case 313:
-                        $function = 'RSQ';
-                        $args = 2;
-                        break;
-                    case 314:
-                        $function = 'STEYX';
-                        $args = 2;
-                        break;
-                    case 315:
-                        $function = 'SLOPE';
-                        $args = 2;
-                        break;
-                    case 316:
-                        $function = 'TTEST';
-                        $args = 4;
-                        break;
-                    case 325:
-                        $function = 'LARGE';
-                        $args = 2;
-                        break;
-                    case 326:
-                        $function = 'SMALL';
-                        $args = 2;
-                        break;
-                    case 327:
-                        $function = 'QUARTILE';
-                        $args = 2;
-                        break;
-                    case 328:
-                        $function = 'PERCENTILE';
-                        $args = 2;
-                        break;
-                    case 331:
-                        $function = 'TRIMMEAN';
-                        $args = 2;
-                        break;
-                    case 332:
-                        $function = 'TINV';
-                        $args = 2;
-                        break;
-                    case 337:
-                        $function = 'POWER';
-                        $args = 2;
-                        break;
-                    case 342:
-                        $function = 'RADIANS';
-                        $args = 1;
-                        break;
-                    case 343:
-                        $function = 'DEGREES';
-                        $args = 1;
-                        break;
-                    case 346:
-                        $function = 'COUNTIF';
-                        $args = 2;
-                        break;
-                    case 347:
-                        $function = 'COUNTBLANK';
-                        $args = 1;
-                        break;
-                    case 350:
-                        $function = 'ISPMT';
-                        $args = 4;
-                        break;
-                    case 351:
-                        $function = 'DATEDIF';
-                        $args = 3;
-                        break;
-                    case 352:
-                        $function = 'DATESTRING';
-                        $args = 1;
-                        break;
-                    case 353:
-                        $function = 'NUMBERSTRING';
-                        $args = 2;
-                        break;
-                    case 360:
-                        $function = 'PHONETIC';
-                        $args = 1;
-                        break;
-                    case 368:
-                        $function = 'BAHTTEXT';
-                        $args = 1;
-                        break;
-                    default:
-                        throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
-                        break;
-                }
-                $data = array('function' => $function, 'args' => $args);
-                break;
-            case 0x22:    //    function with variable number of arguments
-            case 0x42:
-            case 0x62:
-                $name = 'tFuncV';
-                $size = 4;
-                // offset: 1; size: 1; number of arguments
-                $args = ord($formulaData[1]);
-                // offset: 2: size: 2; index to built-in sheet function
-                $index = self::getInt2d($formulaData, 2);
-                switch ($index) {
-                    case 0:
-                        $function = 'COUNT';
-                        break;
-                    case 1:
-                        $function = 'IF';
-                        break;
-                    case 4:
-                        $function = 'SUM';
-                        break;
-                    case 5:
-                        $function = 'AVERAGE';
-                        break;
-                    case 6:
-                        $function = 'MIN';
-                        break;
-                    case 7:
-                        $function = 'MAX';
-                        break;
-                    case 8:
-                        $function = 'ROW';
-                        break;
-                    case 9:
-                        $function = 'COLUMN';
-                        break;
-                    case 11:
-                        $function = 'NPV';
-                        break;
-                    case 12:
-                        $function = 'STDEV';
-                        break;
-                    case 13:
-                        $function = 'DOLLAR';
-                        break;
-                    case 14:
-                        $function = 'FIXED';
-                        break;
-                    case 28:
-                        $function = 'LOOKUP';
-                        break;
-                    case 29:
-                        $function = 'INDEX';
-                        break;
-                    case 36:
-                        $function = 'AND';
-                        break;
-                    case 37:
-                        $function = 'OR';
-                        break;
-                    case 46:
-                        $function = 'VAR';
-                        break;
-                    case 49:
-                        $function = 'LINEST';
-                        break;
-                    case 50:
-                        $function = 'TREND';
-                        break;
-                    case 51:
-                        $function = 'LOGEST';
-                        break;
-                    case 52:
-                        $function = 'GROWTH';
-                        break;
-                    case 56:
-                        $function = 'PV';
-                        break;
-                    case 57:
-                        $function = 'FV';
-                        break;
-                    case 58:
-                        $function = 'NPER';
-                        break;
-                    case 59:
-                        $function = 'PMT';
-                        break;
-                    case 60:
-                        $function = 'RATE';
-                        break;
-                    case 62:
-                        $function = 'IRR';
-                        break;
-                    case 64:
-                        $function = 'MATCH';
-                        break;
-                    case 70:
-                        $function = 'WEEKDAY';
-                        break;
-                    case 78:
-                        $function = 'OFFSET';
-                        break;
-                    case 82:
-                        $function = 'SEARCH';
-                        break;
-                    case 100:
-                        $function = 'CHOOSE';
-                        break;
-                    case 101:
-                        $function = 'HLOOKUP';
-                        break;
-                    case 102:
-                        $function = 'VLOOKUP';
-                        break;
-                    case 109:
-                        $function = 'LOG';
-                        break;
-                    case 115:
-                        $function = 'LEFT';
-                        break;
-                    case 116:
-                        $function = 'RIGHT';
-                        break;
-                    case 120:
-                        $function = 'SUBSTITUTE';
-                        break;
-                    case 124:
-                        $function = 'FIND';
-                        break;
-                    case 125:
-                        $function = 'CELL';
-                        break;
-                    case 144:
-                        $function = 'DDB';
-                        break;
-                    case 148:
-                        $function = 'INDIRECT';
-                        break;
-                    case 167:
-                        $function = 'IPMT';
-                        break;
-                    case 168:
-                        $function = 'PPMT';
-                        break;
-                    case 169:
-                        $function = 'COUNTA';
-                        break;
-                    case 183:
-                        $function = 'PRODUCT';
-                        break;
-                    case 193:
-                        $function = 'STDEVP';
-                        break;
-                    case 194:
-                        $function = 'VARP';
-                        break;
-                    case 197:
-                        $function = 'TRUNC';
-                        break;
-                    case 204:
-                        $function = 'USDOLLAR';
-                        break;
-                    case 205:
-                        $function = 'FINDB';
-                        break;
-                    case 206:
-                        $function = 'SEARCHB';
-                        break;
-                    case 208:
-                        $function = 'LEFTB';
-                        break;
-                    case 209:
-                        $function = 'RIGHTB';
-                        break;
-                    case 216:
-                        $function = 'RANK';
-                        break;
-                    case 219:
-                        $function = 'ADDRESS';
-                        break;
-                    case 220:
-                        $function = 'DAYS360';
-                        break;
-                    case 222:
-                        $function = 'VDB';
-                        break;
-                    case 227:
-                        $function = 'MEDIAN';
-                        break;
-                    case 228:
-                        $function = 'SUMPRODUCT';
-                        break;
-                    case 247:
-                        $function = 'DB';
-                        break;
-                    case 255:
-                        $function = '';
-                        break;
-                    case 269:
-                        $function = 'AVEDEV';
-                        break;
-                    case 270:
-                        $function = 'BETADIST';
-                        break;
-                    case 272:
-                        $function = 'BETAINV';
-                        break;
-                    case 317:
-                        $function = 'PROB';
-                        break;
-                    case 318:
-                        $function = 'DEVSQ';
-                        break;
-                    case 319:
-                        $function = 'GEOMEAN';
-                        break;
-                    case 320:
-                        $function = 'HARMEAN';
-                        break;
-                    case 321:
-                        $function = 'SUMSQ';
-                        break;
-                    case 322:
-                        $function = 'KURT';
-                        break;
-                    case 323:
-                        $function = 'SKEW';
-                        break;
-                    case 324:
-                        $function = 'ZTEST';
-                        break;
-                    case 329:
-                        $function = 'PERCENTRANK';
-                        break;
-                    case 330:
-                        $function = 'MODE';
-                        break;
-                    case 336:
-                        $function = 'CONCATENATE';
-                        break;
-                    case 344:
-                        $function = 'SUBTOTAL';
-                        break;
-                    case 345:
-                        $function = 'SUMIF';
-                        break;
-                    case 354:
-                        $function = 'ROMAN';
-                        break;
-                    case 358:
-                        $function = 'GETPIVOTDATA';
-                        break;
-                    case 359:
-                        $function = 'HYPERLINK';
-                        break;
-                    case 361:
-                        $function = 'AVERAGEA';
-                        break;
-                    case 362:
-                        $function = 'MAXA';
-                        break;
-                    case 363:
-                        $function = 'MINA';
-                        break;
-                    case 364:
-                        $function = 'STDEVPA';
-                        break;
-                    case 365:
-                        $function = 'VARPA';
-                        break;
-                    case 366:
-                        $function = 'STDEVA';
-                        break;
-                    case 367:
-                        $function = 'VARA';
-                        break;
-                    default:
-                        throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
-                        break;
-                }
-                $data = array('function' => $function, 'args' => $args);
-                break;
-            case 0x23:    //    index to defined name
-            case 0x43:
-            case 0x63:
-                $name = 'tName';
-                $size = 5;
-                // offset: 1; size: 2; one-based index to definedname record
-                $definedNameIndex = self::getInt2d($formulaData, 1) - 1;
-                // offset: 2; size: 2; not used
-                $data = $this->definedname[$definedNameIndex]['name'];
-                break;
-            case 0x24:    //    single cell reference e.g. A5
-            case 0x44:
-            case 0x64:
-                $name = 'tRef';
-                $size = 5;
-                $data = $this->readBIFF8CellAddress(substr($formulaData, 1, 4));
-                break;
-            case 0x25:    //    cell range reference to cells in the same sheet (2d)
-            case 0x45:
-            case 0x65:
-                $name = 'tArea';
-                $size = 9;
-                $data = $this->readBIFF8CellRangeAddress(substr($formulaData, 1, 8));
-                break;
-            case 0x26:    //    Constant reference sub-expression
-            case 0x46:
-            case 0x66:
-                $name = 'tMemArea';
-                // offset: 1; size: 4; not used
-                // offset: 5; size: 2; size of the following subexpression
-                $subSize = self::getInt2d($formulaData, 5);
-                $size = 7 + $subSize;
-                $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize));
-                break;
-            case 0x27:    //    Deleted constant reference sub-expression
-            case 0x47:
-            case 0x67:
-                $name = 'tMemErr';
-                // offset: 1; size: 4; not used
-                // offset: 5; size: 2; size of the following subexpression
-                $subSize = self::getInt2d($formulaData, 5);
-                $size = 7 + $subSize;
-                $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize));
-                break;
-            case 0x29:    //    Variable reference sub-expression
-            case 0x49:
-            case 0x69:
-                $name = 'tMemFunc';
-                // offset: 1; size: 2; size of the following sub-expression
-                $subSize = self::getInt2d($formulaData, 1);
-                $size = 3 + $subSize;
-                $data = $this->getFormulaFromData(substr($formulaData, 3, $subSize));
-                break;
-            case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places
-            case 0x4C:
-            case 0x6C:
-                $name = 'tRefN';
-                $size = 5;
-                $data = $this->readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell);
-                break;
-            case 0x2D:    //    Relative 2d range reference
-            case 0x4D:
-            case 0x6D:
-                $name = 'tAreaN';
-                $size = 9;
-                $data = $this->readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell);
-                break;
-            case 0x39:    //    External name
-            case 0x59:
-            case 0x79:
-                $name = 'tNameX';
-                $size = 7;
-                // offset: 1; size: 2; index to REF entry in EXTERNSHEET record
-                // offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record
-                $index = self::getInt2d($formulaData, 3);
-                // assume index is to EXTERNNAME record
-                $data = $this->externalNames[$index - 1]['name'];
-                // offset: 5; size: 2; not used
-                break;
-            case 0x3A:    //    3d reference to cell
-            case 0x5A:
-            case 0x7A:
-                $name = 'tRef3d';
-                $size = 7;
-
-                try {
-                    // offset: 1; size: 2; index to REF entry
-                    $sheetRange = $this->readSheetRangeByRefIndex(self::getInt2d($formulaData, 1));
-                    // offset: 3; size: 4; cell address
-                    $cellAddress = $this->readBIFF8CellAddress(substr($formulaData, 3, 4));
-
-                    $data = "$sheetRange!$cellAddress";
-                } catch (PHPExcel_Exception $e) {
-                    // deleted sheet reference
-                    $data = '#REF!';
-                }
-                break;
-            case 0x3B:    //    3d reference to cell range
-            case 0x5B:
-            case 0x7B:
-                $name = 'tArea3d';
-                $size = 11;
-
-                try {
-                    // offset: 1; size: 2; index to REF entry
-                    $sheetRange = $this->readSheetRangeByRefIndex(self::getInt2d($formulaData, 1));
-                    // offset: 3; size: 8; cell address
-                    $cellRangeAddress = $this->readBIFF8CellRangeAddress(substr($formulaData, 3, 8));
-
-                    $data = "$sheetRange!$cellRangeAddress";
-                } catch (PHPExcel_Exception $e) {
-                    // deleted sheet reference
-                    $data = '#REF!';
-                }
-                break;
-            // Unknown cases    // don't know how to deal with
-            default:
-                throw new PHPExcel_Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula');
-                break;
-        }
-
-        return array(
-            'id' => $id,
-            'name' => $name,
-            'size' => $size,
-            'data' => $data,
-        );
-    }
-
-
-    /**
-     * Reads a cell address in BIFF8 e.g. 'A2' or '$A$2'
-     * section 3.3.4
-     *
-     * @param string $cellAddressStructure
-     * @return string
-     */
-    private function readBIFF8CellAddress($cellAddressStructure)
-    {
-        // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767))
-        $row = self::getInt2d($cellAddressStructure, 0) + 1;
-
-        // offset: 2; size: 2; index to column or column offset + relative flags
-        // bit: 7-0; mask 0x00FF; column index
-        $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($cellAddressStructure, 2));
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($cellAddressStructure, 2))) {
-            $column = '$' . $column;
-        }
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($cellAddressStructure, 2))) {
-            $row = '$' . $row;
-        }
-
-        return $column . $row;
-    }
-
-
-    /**
-     * Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column
-     * to indicate offsets from a base cell
-     * section 3.3.4
-     *
-     * @param string $cellAddressStructure
-     * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
-     * @return string
-     */
-    private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1')
-    {
-        list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell);
-        $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1;
-
-        // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767))
-        $rowIndex = self::getInt2d($cellAddressStructure, 0);
-        $row = self::getInt2d($cellAddressStructure, 0) + 1;
-
-        // offset: 2; size: 2; index to column or column offset + relative flags
-        // bit: 7-0; mask 0x00FF; column index
-        $colIndex = 0x00FF & self::getInt2d($cellAddressStructure, 2);
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($cellAddressStructure, 2))) {
-            $column = PHPExcel_Cell::stringFromColumnIndex($colIndex);
-            $column = '$' . $column;
-        } else {
-            $colIndex = ($colIndex <= 127) ? $colIndex : $colIndex - 256;
-            $column = PHPExcel_Cell::stringFromColumnIndex($baseCol + $colIndex);
-        }
-
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($cellAddressStructure, 2))) {
-            $row = '$' . $row;
-        } else {
-            $rowIndex = ($rowIndex <= 32767) ? $rowIndex : $rowIndex - 65536;
-            $row = $baseRow + $rowIndex;
-        }
-
-        return $column . $row;
-    }
-
-
-    /**
-     * Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1'
-     * always fixed range
-     * section 2.5.14
-     *
-     * @param string $subData
-     * @return string
-     * @throws PHPExcel_Reader_Exception
-     */
-    private function readBIFF5CellRangeAddressFixed($subData)
-    {
-        // offset: 0; size: 2; index to first row
-        $fr = self::getInt2d($subData, 0) + 1;
-
-        // offset: 2; size: 2; index to last row
-        $lr = self::getInt2d($subData, 2) + 1;
-
-        // offset: 4; size: 1; index to first column
-        $fc = ord($subData{4});
-
-        // offset: 5; size: 1; index to last column
-        $lc = ord($subData{5});
-
-        // check values
-        if ($fr > $lr || $fc > $lc) {
-            throw new PHPExcel_Reader_Exception('Not a cell range address');
-        }
-
-        // column index to letter
-        $fc = PHPExcel_Cell::stringFromColumnIndex($fc);
-        $lc = PHPExcel_Cell::stringFromColumnIndex($lc);
-
-        if ($fr == $lr and $fc == $lc) {
-            return "$fc$fr";
-        }
-        return "$fc$fr:$lc$lr";
-    }
-
-
-    /**
-     * Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1'
-     * always fixed range
-     * section 2.5.14
-     *
-     * @param string $subData
-     * @return string
-     * @throws PHPExcel_Reader_Exception
-     */
-    private function readBIFF8CellRangeAddressFixed($subData)
-    {
-        // offset: 0; size: 2; index to first row
-        $fr = self::getInt2d($subData, 0) + 1;
-
-        // offset: 2; size: 2; index to last row
-        $lr = self::getInt2d($subData, 2) + 1;
-
-        // offset: 4; size: 2; index to first column
-        $fc = self::getInt2d($subData, 4);
-
-        // offset: 6; size: 2; index to last column
-        $lc = self::getInt2d($subData, 6);
-
-        // check values
-        if ($fr > $lr || $fc > $lc) {
-            throw new PHPExcel_Reader_Exception('Not a cell range address');
-        }
-
-        // column index to letter
-        $fc = PHPExcel_Cell::stringFromColumnIndex($fc);
-        $lc = PHPExcel_Cell::stringFromColumnIndex($lc);
-
-        if ($fr == $lr and $fc == $lc) {
-            return "$fc$fr";
-        }
-        return "$fc$fr:$lc$lr";
-    }
-
-
-    /**
-     * Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6'
-     * there are flags indicating whether column/row index is relative
-     * section 3.3.4
-     *
-     * @param string $subData
-     * @return string
-     */
-    private function readBIFF8CellRangeAddress($subData)
-    {
-        // todo: if cell range is just a single cell, should this funciton
-        // not just return e.g. 'A1' and not 'A1:A1' ?
-
-        // offset: 0; size: 2; index to first row (0... 65535) (or offset (-32768... 32767))
-            $fr = self::getInt2d($subData, 0) + 1;
-
-        // offset: 2; size: 2; index to last row (0... 65535) (or offset (-32768... 32767))
-            $lr = self::getInt2d($subData, 2) + 1;
-
-        // offset: 4; size: 2; index to first column or column offset + relative flags
-
-        // bit: 7-0; mask 0x00FF; column index
-        $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($subData, 4));
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($subData, 4))) {
-            $fc = '$' . $fc;
-        }
-
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($subData, 4))) {
-            $fr = '$' . $fr;
-        }
-
-        // offset: 6; size: 2; index to last column or column offset + relative flags
-
-        // bit: 7-0; mask 0x00FF; column index
-        $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($subData, 6));
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($subData, 6))) {
-            $lc = '$' . $lc;
-        }
-
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($subData, 6))) {
-            $lr = '$' . $lr;
-        }
-
-        return "$fc$fr:$lc$lr";
-    }
-
-
-    /**
-     * Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column
-     * to indicate offsets from a base cell
-     * section 3.3.4
-     *
-     * @param string $subData
-     * @param string $baseCell Base cell
-     * @return string Cell range address
-     */
-    private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1')
-    {
-        list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell);
-        $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1;
-
-        // TODO: if cell range is just a single cell, should this funciton
-        // not just return e.g. 'A1' and not 'A1:A1' ?
-
-        // offset: 0; size: 2; first row
-        $frIndex = self::getInt2d($subData, 0); // adjust below
-
-        // offset: 2; size: 2; relative index to first row (0... 65535) should be treated as offset (-32768... 32767)
-        $lrIndex = self::getInt2d($subData, 2); // adjust below
-
-        // offset: 4; size: 2; first column with relative/absolute flags
-
-        // bit: 7-0; mask 0x00FF; column index
-        $fcIndex = 0x00FF & self::getInt2d($subData, 4);
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($subData, 4))) {
-            // absolute column index
-            $fc = PHPExcel_Cell::stringFromColumnIndex($fcIndex);
-            $fc = '$' . $fc;
-        } else {
-            // column offset
-            $fcIndex = ($fcIndex <= 127) ? $fcIndex : $fcIndex - 256;
-            $fc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $fcIndex);
-        }
-
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($subData, 4))) {
-            // absolute row index
-            $fr = $frIndex + 1;
-            $fr = '$' . $fr;
-        } else {
-            // row offset
-            $frIndex = ($frIndex <= 32767) ? $frIndex : $frIndex - 65536;
-            $fr = $baseRow + $frIndex;
-        }
-
-        // offset: 6; size: 2; last column with relative/absolute flags
-
-        // bit: 7-0; mask 0x00FF; column index
-        $lcIndex = 0x00FF & self::getInt2d($subData, 6);
-        $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256;
-        $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex);
-
-        // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
-        if (!(0x4000 & self::getInt2d($subData, 6))) {
-            // absolute column index
-            $lc = PHPExcel_Cell::stringFromColumnIndex($lcIndex);
-            $lc = '$' . $lc;
-        } else {
-            // column offset
-            $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256;
-            $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex);
-        }
-
-        // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
-        if (!(0x8000 & self::getInt2d($subData, 6))) {
-            // absolute row index
-            $lr = $lrIndex + 1;
-            $lr = '$' . $lr;
-        } else {
-            // row offset
-            $lrIndex = ($lrIndex <= 32767) ? $lrIndex : $lrIndex - 65536;
-            $lr = $baseRow + $lrIndex;
-        }
-
-        return "$fc$fr:$lc$lr";
-    }
-
-
-    /**
-     * Read BIFF8 cell range address list
-     * section 2.5.15
-     *
-     * @param string $subData
-     * @return array
-     */
-    private function readBIFF8CellRangeAddressList($subData)
-    {
-        $cellRangeAddresses = array();
-
-        // offset: 0; size: 2; number of the following cell range addresses
-        $nm = self::getInt2d($subData, 0);
-
-        $offset = 2;
-        // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses
-        for ($i = 0; $i < $nm; ++$i) {
-            $cellRangeAddresses[] = $this->readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8));
-            $offset += 8;
-        }
-
-        return array(
-            'size' => 2 + 8 * $nm,
-            'cellRangeAddresses' => $cellRangeAddresses,
-        );
-    }
-
-
-    /**
-     * Read BIFF5 cell range address list
-     * section 2.5.15
-     *
-     * @param string $subData
-     * @return array
-     */
-    private function readBIFF5CellRangeAddressList($subData)
-    {
-        $cellRangeAddresses = array();
-
-        // offset: 0; size: 2; number of the following cell range addresses
-        $nm = self::getInt2d($subData, 0);
-
-        $offset = 2;
-        // offset: 2; size: 6 * $nm; list of $nm (fixed) cell range addresses
-        for ($i = 0; $i < $nm; ++$i) {
-            $cellRangeAddresses[] = $this->readBIFF5CellRangeAddressFixed(substr($subData, $offset, 6));
-            $offset += 6;
-        }
-
-        return array(
-            'size' => 2 + 6 * $nm,
-            'cellRangeAddresses' => $cellRangeAddresses,
-        );
-    }
-
-
-    /**
-     * Get a sheet range like Sheet1:Sheet3 from REF index
-     * Note: If there is only one sheet in the range, one gets e.g Sheet1
-     * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets,
-     * in which case an PHPExcel_Reader_Exception is thrown
-     *
-     * @param int $index
-     * @return string|false
-     * @throws PHPExcel_Reader_Exception
-     */
-    private function readSheetRangeByRefIndex($index)
-    {
-        if (isset($this->ref[$index])) {
-            $type = $this->externalBooks[$this->ref[$index]['externalBookIndex']]['type'];
-
-            switch ($type) {
-                case 'internal':
-                    // check if we have a deleted 3d reference
-                    if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF or $this->ref[$index]['lastSheetIndex'] == 0xFFFF) {
-                        throw new PHPExcel_Reader_Exception('Deleted sheet reference');
-                    }
-
-                    // we have normal sheet range (collapsed or uncollapsed)
-                    $firstSheetName = $this->sheets[$this->ref[$index]['firstSheetIndex']]['name'];
-                    $lastSheetName = $this->sheets[$this->ref[$index]['lastSheetIndex']]['name'];
-
-                    if ($firstSheetName == $lastSheetName) {
-                        // collapsed sheet range
-                        $sheetRange = $firstSheetName;
-                    } else {
-                        $sheetRange = "$firstSheetName:$lastSheetName";
-                    }
-
-                    // escape the single-quotes
-                    $sheetRange = str_replace("'", "''", $sheetRange);
-
-                    // if there are special characters, we need to enclose the range in single-quotes
-                    // todo: check if we have identified the whole set of special characters
-                    // it seems that the following characters are not accepted for sheet names
-                    // and we may assume that they are not present: []*/:\?
-                    if (preg_match("/[ !\"@#£$%&{()}<>=+'|^,;-]/", $sheetRange)) {
-                        $sheetRange = "'$sheetRange'";
-                    }
-
-                    return $sheetRange;
-                    break;
-                default:
-                    // TODO: external sheet support
-                    throw new PHPExcel_Reader_Exception('Excel5 reader only supports internal sheets in fomulas');
-                    break;
-            }
-        }
-        return false;
-    }
-
-
-    /**
-     * read BIFF8 constant value array from array data
-     * returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
-     * section 2.5.8
-     *
-     * @param string $arrayData
-     * @return array
-     */
-    private static function readBIFF8ConstantArray($arrayData)
-    {
-        // offset: 0; size: 1; number of columns decreased by 1
-        $nc = ord($arrayData[0]);
-
-        // offset: 1; size: 2; number of rows decreased by 1
-        $nr = self::getInt2d($arrayData, 1);
-        $size = 3; // initialize
-        $arrayData = substr($arrayData, 3);
-
-        // offset: 3; size: var; list of ($nc + 1) * ($nr + 1) constant values
-        $matrixChunks = array();
-        for ($r = 1; $r <= $nr + 1; ++$r) {
-            $items = array();
-            for ($c = 1; $c <= $nc + 1; ++$c) {
-                $constant = self::readBIFF8Constant($arrayData);
-                $items[] = $constant['value'];
-                $arrayData = substr($arrayData, $constant['size']);
-                $size += $constant['size'];
-            }
-            $matrixChunks[] = implode(',', $items); // looks like e.g. '1,"hello"'
-        }
-        $matrix = '{' . implode(';', $matrixChunks) . '}';
-
-        return array(
-            'value' => $matrix,
-            'size' => $size,
-        );
-    }
-
-
-    /**
-     * read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
-     * section 2.5.7
-     * returns e.g. array('value' => '5', 'size' => 9)
-     *
-     * @param string $valueData
-     * @return array
-     */
-    private static function readBIFF8Constant($valueData)
-    {
-        // offset: 0; size: 1; identifier for type of constant
-        $identifier = ord($valueData[0]);
-
-        switch ($identifier) {
-            case 0x00: // empty constant (what is this?)
-                $value = '';
-                $size = 9;
-                break;
-            case 0x01: // number
-                // offset: 1; size: 8; IEEE 754 floating-point value
-                $value = self::extractNumber(substr($valueData, 1, 8));
-                $size = 9;
-                break;
-            case 0x02: // string value
-                // offset: 1; size: var; Unicode string, 16-bit string length
-                $string = self::readUnicodeStringLong(substr($valueData, 1));
-                $value = '"' . $string['value'] . '"';
-                $size = 1 + $string['size'];
-                break;
-            case 0x04: // boolean
-                // offset: 1; size: 1; 0 = FALSE, 1 = TRUE
-                if (ord($valueData[1])) {
-                    $value = 'TRUE';
-                } else {
-                    $value = 'FALSE';
-                }
-                $size = 9;
-                break;
-            case 0x10: // error code
-                // offset: 1; size: 1; error code
-                $value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($valueData[1]));
-                $size = 9;
-                break;
-        }
-        return array(
-            'value' => $value,
-            'size' => $size,
-        );
-    }
-
-
-    /**
-     * Extract RGB color
-     * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4
-     *
-     * @param string $rgb Encoded RGB value (4 bytes)
-     * @return array
-     */
-    private static function readRGB($rgb)
-    {
-        // offset: 0; size 1; Red component
-        $r = ord($rgb{0});
-
-        // offset: 1; size: 1; Green component
-        $g = ord($rgb{1});
-
-        // offset: 2; size: 1; Blue component
-        $b = ord($rgb{2});
-
-        // HEX notation, e.g. 'FF00FC'
-        $rgb = sprintf('%02X%02X%02X', $r, $g, $b);
-
-        return array('rgb' => $rgb);
-    }
-
-
-    /**
-     * Read byte string (8-bit string length)
-     * OpenOffice documentation: 2.5.2
-     *
-     * @param string $subData
-     * @return array
-     */
-    private function readByteStringShort($subData)
-    {
-        // offset: 0; size: 1; length of the string (character count)
-        $ln = ord($subData[0]);
-
-        // offset: 1: size: var; character array (8-bit characters)
-        $value = $this->decodeCodepage(substr($subData, 1, $ln));
-
-        return array(
-            'value' => $value,
-            'size' => 1 + $ln, // size in bytes of data structure
-        );
-    }
-
-
-    /**
-     * Read byte string (16-bit string length)
-     * OpenOffice documentation: 2.5.2
-     *
-     * @param string $subData
-     * @return array
-     */
-    private function readByteStringLong($subData)
-    {
-        // offset: 0; size: 2; length of the string (character count)
-        $ln = self::getInt2d($subData, 0);
-
-        // offset: 2: size: var; character array (8-bit characters)
-        $value = $this->decodeCodepage(substr($subData, 2));
-
-        //return $string;
-        return array(
-            'value' => $value,
-            'size' => 2 + $ln, // size in bytes of data structure
-        );
-    }
-
-
-    /**
-     * Extracts an Excel Unicode short string (8-bit string length)
-     * OpenOffice documentation: 2.5.3
-     * function will automatically find out where the Unicode string ends.
-     *
-     * @param string $subData
-     * @return array
-     */
-    private static function readUnicodeStringShort($subData)
-    {
-        $value = '';
-
-        // offset: 0: size: 1; length of the string (character count)
-        $characterCount = ord($subData[0]);
-
-        $string = self::readUnicodeString(substr($subData, 1), $characterCount);
-
-        // add 1 for the string length
-        $string['size'] += 1;
-
-        return $string;
-    }
-
-
-    /**
-     * Extracts an Excel Unicode long string (16-bit string length)
-     * OpenOffice documentation: 2.5.3
-     * this function is under construction, needs to support rich text, and Asian phonetic settings
-     *
-     * @param string $subData
-     * @return array
-     */
-    private static function readUnicodeStringLong($subData)
-    {
-        $value = '';
-
-        // offset: 0: size: 2; length of the string (character count)
-        $characterCount = self::getInt2d($subData, 0);
-
-        $string = self::readUnicodeString(substr($subData, 2), $characterCount);
-
-        // add 2 for the string length
-        $string['size'] += 2;
-
-        return $string;
-    }
-
-
-    /**
-     * Read Unicode string with no string length field, but with known character count
-     * this function is under construction, needs to support rich text, and Asian phonetic settings
-     * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3
-     *
-     * @param string $subData
-     * @param int $characterCount
-     * @return array
-     */
-    private static function readUnicodeString($subData, $characterCount)
-    {
-        $value = '';
-
-        // offset: 0: size: 1; option flags
-        // bit: 0; mask: 0x01; character compression (0 = compressed 8-bit, 1 = uncompressed 16-bit)
-        $isCompressed = !((0x01 & ord($subData[0])) >> 0);
-
-        // bit: 2; mask: 0x04; Asian phonetic settings
-        $hasAsian = (0x04) & ord($subData[0]) >> 2;
-
-        // bit: 3; mask: 0x08; Rich-Text settings
-        $hasRichText = (0x08) & ord($subData[0]) >> 3;
-
-        // offset: 1: size: var; character array
-        // this offset assumes richtext and Asian phonetic settings are off which is generally wrong
-        // needs to be fixed
-        $value = self::encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed);
-
-        return array(
-            'value' => $value,
-            'size' => $isCompressed ? 1 + $characterCount : 1 + 2 * $characterCount, // the size in bytes including the option flags
-        );
-    }
-
-
-    /**
-     * Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas.
-     * Example:  hello"world  -->  "hello""world"
-     *
-     * @param string $value UTF-8 encoded string
-     * @return string
-     */
-    private static function UTF8toExcelDoubleQuoted($value)
-    {
-        return '"' . str_replace('"', '""', $value) . '"';
-    }
-
-
-    /**
-     * Reads first 8 bytes of a string and return IEEE 754 float
-     *
-     * @param string $data Binary string that is at least 8 bytes long
-     * @return float
-     */
-    private static function extractNumber($data)
-    {
-        $rknumhigh = self::getInt4d($data, 4);
-        $rknumlow = self::getInt4d($data, 0);
-        $sign = ($rknumhigh & 0x80000000) >> 31;
-        $exp = (($rknumhigh & 0x7ff00000) >> 20) - 1023;
-        $mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
-        $mantissalow1 = ($rknumlow & 0x80000000) >> 31;
-        $mantissalow2 = ($rknumlow & 0x7fffffff);
-        $value = $mantissa / pow(2, (20 - $exp));
-
-        if ($mantissalow1 != 0) {
-            $value += 1 / pow(2, (21 - $exp));
-        }
-
-        $value += $mantissalow2 / pow(2, (52 - $exp));
-        if ($sign) {
-            $value *= -1;
-        }
-
-        return $value;
-    }
-
-
-    private static function getIEEE754($rknum)
-    {
-        if (($rknum & 0x02) != 0) {
-            $value = $rknum >> 2;
-        } else {
-            // changes by mmp, info on IEEE754 encoding from
-            // research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
-            // The RK format calls for using only the most significant 30 bits
-            // of the 64 bit floating point value. The other 34 bits are assumed
-            // to be 0 so we use the upper 30 bits of $rknum as follows...
-            $sign = ($rknum & 0x80000000) >> 31;
-            $exp = ($rknum & 0x7ff00000) >> 20;
-            $mantissa = (0x100000 | ($rknum & 0x000ffffc));
-            $value = $mantissa / pow(2, (20- ($exp - 1023)));
-            if ($sign) {
-                $value = -1 * $value;
-            }
-            //end of changes by mmp
-        }
-        if (($rknum & 0x01) != 0) {
-            $value /= 100;
-        }
-        return $value;
-    }
-
-
-    /**
-     * Get UTF-8 string from (compressed or uncompressed) UTF-16 string
-     *
-     * @param string $string
-     * @param bool $compressed
-     * @return string
-     */
-    private static function encodeUTF16($string, $compressed = '')
-    {
-        if ($compressed) {
-            $string = self::uncompressByteString($string);
-        }
-
-        return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
-    }
-
-    /**
-     * Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8.
-     *
-     * @param string $string
-     * @return string
-     */
-    private static function uncompressByteString($string)
-    {
-        $uncompressedString = '';
-        $strLen = strlen($string);
-        for ($i = 0; $i < $strLen; ++$i) {
-            $uncompressedString .= $string[$i] . "\0";
-        }
-
-        return $uncompressedString;
-    }
-
-    /**
-     * Convert string to UTF-8. Only used for BIFF5.
-     *
-     * @param string $string
-     * @return string
-     */
-    private function decodeCodepage($string)
-    {
-        return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->codepage);
-    }
-
-    /**
-     * Read 16-bit unsigned integer
-     *
-     * @param string $data
-     * @param int $pos
-     * @return int
-     */
-    public static function getInt2d($data, $pos)
-    {
-        return ord($data[$pos]) | (ord($data[$pos+1]) << 8);
-    }
-
-    /**
-     * Read 32-bit signed integer
-     *
-     * @param string $data
-     * @param int $pos
-     * @return int
-     */
-    public static function getInt4d($data, $pos)
-    {
-        // FIX: represent numbers correctly on 64-bit system
-        // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
-        // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
-        $_or_24 = ord($data[$pos + 3]);
-        if ($_or_24 >= 128) {
-            // negative number
-            $_ord_24 = -abs((256 - $_or_24) << 24);
-        } else {
-            $_ord_24 = ($_or_24 & 127) << 24;
-        }
-        return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
-    }
-
-    private function parseRichText($is = '')
-    {
-        $value = new PHPExcel_RichText();
-        $value->createText($is);
-
-        return $value;
-    }
-}

+ 0 - 32
libs/PHPExcel/PHPExcel/Reader/Excel5/Color.php

xqd
@@ -1,32 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Color
-{
-    /**
-     * Read color
-     *
-     * @param int $color Indexed color
-     * @param array $palette Color palette
-     * @return array RGB color value, example: array('rgb' => 'FF0000')
-     */
-    public static function map($color, $palette, $version)
-    {
-        if ($color <= 0x07 || $color >= 0x40) {
-            // special built-in color
-            return PHPExcel_Reader_Excel5_Color_BuiltIn::lookup($color);
-        } elseif (isset($palette) && isset($palette[$color - 8])) {
-            // palette color, color index 0x08 maps to pallete index 0
-            return $palette[$color - 8];
-        } else {
-            // default color table
-            if ($version == PHPExcel_Reader_Excel5::XLS_BIFF8) {
-                return PHPExcel_Reader_Excel5_Color_BIFF8::lookup($color);
-            } else {
-                // BIFF5
-                return PHPExcel_Reader_Excel5_Color_BIFF5::lookup($color);
-            }
-        }
-
-        return $color;
-    }
-}

+ 0 - 77
libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BIFF5.php

xqd
@@ -1,77 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Color_BIFF5
-{
-    protected static $map = array(
-        0x08 => '000000',
-        0x09 => 'FFFFFF',
-        0x0A => 'FF0000',
-        0x0B => '00FF00',
-        0x0C => '0000FF',
-        0x0D => 'FFFF00',
-        0x0E => 'FF00FF',
-        0x0F => '00FFFF',
-        0x10 => '800000',
-        0x11 => '008000',
-        0x12 => '000080',
-        0x13 => '808000',
-        0x14 => '800080',
-        0x15 => '008080',
-        0x16 => 'C0C0C0',
-        0x17 => '808080',
-        0x18 => '8080FF',
-        0x19 => '802060',
-        0x1A => 'FFFFC0',
-        0x1B => 'A0E0F0',
-        0x1C => '600080',
-        0x1D => 'FF8080',
-        0x1E => '0080C0',
-        0x1F => 'C0C0FF',
-        0x20 => '000080',
-        0x21 => 'FF00FF',
-        0x22 => 'FFFF00',
-        0x23 => '00FFFF',
-        0x24 => '800080',
-        0x25 => '800000',
-        0x26 => '008080',
-        0x27 => '0000FF',
-        0x28 => '00CFFF',
-        0x29 => '69FFFF',
-        0x2A => 'E0FFE0',
-        0x2B => 'FFFF80',
-        0x2C => 'A6CAF0',
-        0x2D => 'DD9CB3',
-        0x2E => 'B38FEE',
-        0x2F => 'E3E3E3',
-        0x30 => '2A6FF9',
-        0x31 => '3FB8CD',
-        0x32 => '488436',
-        0x33 => '958C41',
-        0x34 => '8E5E42',
-        0x35 => 'A0627A',
-        0x36 => '624FAC',
-        0x37 => '969696',
-        0x38 => '1D2FBE',
-        0x39 => '286676',
-        0x3A => '004500',
-        0x3B => '453E01',
-        0x3C => '6A2813',
-        0x3D => '85396A',
-        0x3E => '4A3285',
-        0x3F => '424242',
-    );
-
-    /**
-     * Map color array from BIFF5 built-in color index
-     *
-     * @param int $color
-     * @return array
-     */
-    public static function lookup($color)
-    {
-        if (isset(self::$map[$color])) {
-            return array('rgb' => self::$map[$color]);
-        }
-        return array('rgb' => '000000');
-    }
-}

+ 0 - 77
libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BIFF8.php

xqd
@@ -1,77 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Color_BIFF8
-{
-    protected static $map = array(
-        0x08 => '000000',
-        0x09 => 'FFFFFF',
-        0x0A => 'FF0000',
-        0x0B => '00FF00',
-        0x0C => '0000FF',
-        0x0D => 'FFFF00',
-        0x0E => 'FF00FF',
-        0x0F => '00FFFF',
-        0x10 => '800000',
-        0x11 => '008000',
-        0x12 => '000080',
-        0x13 => '808000',
-        0x14 => '800080',
-        0x15 => '008080',
-        0x16 => 'C0C0C0',
-        0x17 => '808080',
-        0x18 => '9999FF',
-        0x19 => '993366',
-        0x1A => 'FFFFCC',
-        0x1B => 'CCFFFF',
-        0x1C => '660066',
-        0x1D => 'FF8080',
-        0x1E => '0066CC',
-        0x1F => 'CCCCFF',
-        0x20 => '000080',
-        0x21 => 'FF00FF',
-        0x22 => 'FFFF00',
-        0x23 => '00FFFF',
-        0x24 => '800080',
-        0x25 => '800000',
-        0x26 => '008080',
-        0x27 => '0000FF',
-        0x28 => '00CCFF',
-        0x29 => 'CCFFFF',
-        0x2A => 'CCFFCC',
-        0x2B => 'FFFF99',
-        0x2C => '99CCFF',
-        0x2D => 'FF99CC',
-        0x2E => 'CC99FF',
-        0x2F => 'FFCC99',
-        0x30 => '3366FF',
-        0x31 => '33CCCC',
-        0x32 => '99CC00',
-        0x33 => 'FFCC00',
-        0x34 => 'FF9900',
-        0x35 => 'FF6600',
-        0x36 => '666699',
-        0x37 => '969696',
-        0x38 => '003366',
-        0x39 => '339966',
-        0x3A => '003300',
-        0x3B => '333300',
-        0x3C => '993300',
-        0x3D => '993366',
-        0x3E => '333399',
-        0x3F => '333333',
-    );
-
-   /**
-     * Map color array from BIFF8 built-in color index
-     *
-     * @param int $color
-     * @return array
-     */
-    public static function lookup($color)
-    {
-        if (isset(self::$map[$color])) {
-            return array('rgb' => self::$map[$color]);
-        }
-        return array('rgb' => '000000');
-    }
-}

+ 0 - 31
libs/PHPExcel/PHPExcel/Reader/Excel5/Color/BuiltIn.php

xqd
@@ -1,31 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Color_BuiltIn
-{
-    protected static $map = array(
-        0x00 => '000000',
-        0x01 => 'FFFFFF',
-        0x02 => 'FF0000',
-        0x03 => '00FF00',
-        0x04 => '0000FF',
-        0x05 => 'FFFF00',
-        0x06 => 'FF00FF',
-        0x07 => '00FFFF',
-        0x40 => '000000', // system window text color
-        0x41 => 'FFFFFF', // system window background color
-    );
-
-    /**
-     * Map built-in color to RGB value
-     *
-     * @param int $color Indexed color
-     * @return array
-     */
-    public static function lookup($color)
-    {
-        if (isset(self::$map[$color])) {
-            return array('rgb' => self::$map[$color]);
-        }
-        return array('rgb' => '000000');
-    }
-}

+ 0 - 28
libs/PHPExcel/PHPExcel/Reader/Excel5/ErrorCode.php

xqd
@@ -1,28 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_ErrorCode
-{
-    protected static $map = array(
-        0x00 => '#NULL!',
-        0x07 => '#DIV/0!',
-        0x0F => '#VALUE!',
-        0x17 => '#REF!',
-        0x1D => '#NAME?',
-        0x24 => '#NUM!',
-        0x2A => '#N/A',
-    );
-
-    /**
-     * Map error code, e.g. '#N/A'
-     *
-     * @param int $code
-     * @return string
-     */
-    public static function lookup($code)
-    {
-        if (isset(self::$map[$code])) {
-            return self::$map[$code];
-        }
-        return false;
-    }
-}

+ 0 - 669
libs/PHPExcel/PHPExcel/Reader/Excel5/Escher.php

xqd
@@ -1,669 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_Excel5_Escher
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel5
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Excel5_Escher
-{
-    const DGGCONTAINER      = 0xF000;
-    const BSTORECONTAINER   = 0xF001;
-    const DGCONTAINER       = 0xF002;
-    const SPGRCONTAINER     = 0xF003;
-    const SPCONTAINER       = 0xF004;
-    const DGG               = 0xF006;
-    const BSE               = 0xF007;
-    const DG                = 0xF008;
-    const SPGR              = 0xF009;
-    const SP                = 0xF00A;
-    const OPT               = 0xF00B;
-    const CLIENTTEXTBOX     = 0xF00D;
-    const CLIENTANCHOR      = 0xF010;
-    const CLIENTDATA        = 0xF011;
-    const BLIPJPEG          = 0xF01D;
-    const BLIPPNG           = 0xF01E;
-    const SPLITMENUCOLORS   = 0xF11E;
-    const TERTIARYOPT       = 0xF122;
-
-    /**
-     * Escher stream data (binary)
-     *
-     * @var string
-     */
-    private $data;
-
-    /**
-     * Size in bytes of the Escher stream data
-     *
-     * @var int
-     */
-    private $dataSize;
-
-    /**
-     * Current position of stream pointer in Escher stream data
-     *
-     * @var int
-     */
-    private $pos;
-
-    /**
-     * The object to be returned by the reader. Modified during load.
-     *
-     * @var mixed
-     */
-    private $object;
-
-    /**
-     * Create a new PHPExcel_Reader_Excel5_Escher instance
-     *
-     * @param mixed $object
-     */
-    public function __construct($object)
-    {
-        $this->object = $object;
-    }
-
-    /**
-     * Load Escher stream data. May be a partial Escher stream.
-     *
-     * @param string $data
-     */
-    public function load($data)
-    {
-        $this->data = $data;
-
-        // total byte size of Excel data (workbook global substream + sheet substreams)
-        $this->dataSize = strlen($this->data);
-
-        $this->pos = 0;
-
-        // Parse Escher stream
-        while ($this->pos < $this->dataSize) {
-            // offset: 2; size: 2: Record Type
-            $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
-
-            switch ($fbt) {
-                case self::DGGCONTAINER:
-                    $this->readDggContainer();
-                    break;
-                case self::DGG:
-                    $this->readDgg();
-                    break;
-                case self::BSTORECONTAINER:
-                    $this->readBstoreContainer();
-                    break;
-                case self::BSE:
-                    $this->readBSE();
-                    break;
-                case self::BLIPJPEG:
-                    $this->readBlipJPEG();
-                    break;
-                case self::BLIPPNG:
-                    $this->readBlipPNG();
-                    break;
-                case self::OPT:
-                    $this->readOPT();
-                    break;
-                case self::TERTIARYOPT:
-                    $this->readTertiaryOPT();
-                    break;
-                case self::SPLITMENUCOLORS:
-                    $this->readSplitMenuColors();
-                    break;
-                case self::DGCONTAINER:
-                    $this->readDgContainer();
-                    break;
-                case self::DG:
-                    $this->readDg();
-                    break;
-                case self::SPGRCONTAINER:
-                    $this->readSpgrContainer();
-                    break;
-                case self::SPCONTAINER:
-                    $this->readSpContainer();
-                    break;
-                case self::SPGR:
-                    $this->readSpgr();
-                    break;
-                case self::SP:
-                    $this->readSp();
-                    break;
-                case self::CLIENTTEXTBOX:
-                    $this->readClientTextbox();
-                    break;
-                case self::CLIENTANCHOR:
-                    $this->readClientAnchor();
-                    break;
-                case self::CLIENTDATA:
-                    $this->readClientData();
-                    break;
-                default:
-                    $this->readDefault();
-                    break;
-            }
-        }
-
-        return $this->object;
-    }
-
-    /**
-     * Read a generic record
-     */
-    private function readDefault()
-    {
-        // offset 0; size: 2; recVer and recInstance
-        $verInstance = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos);
-
-        // offset: 2; size: 2: Record Type
-        $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
-
-        // bit: 0-3; mask: 0x000F; recVer
-        $recVer = (0x000F & $verInstance) >> 0;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read DggContainer record (Drawing Group Container)
-     */
-    private function readDggContainer()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // record is a container, read contents
-        $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
-        $this->object->setDggContainer($dggContainer);
-        $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
-        $reader->load($recordData);
-    }
-
-    /**
-     * Read Dgg record (Drawing Group)
-     */
-    private function readDgg()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read BstoreContainer record (Blip Store Container)
-     */
-    private function readBstoreContainer()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // record is a container, read contents
-        $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
-        $this->object->setBstoreContainer($bstoreContainer);
-        $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
-        $reader->load($recordData);
-    }
-
-    /**
-     * Read BSE record
-     */
-    private function readBSE()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // add BSE to BstoreContainer
-        $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
-        $this->object->addBSE($BSE);
-
-        $BSE->setBLIPType($recInstance);
-
-        // offset: 0; size: 1; btWin32 (MSOBLIPTYPE)
-        $btWin32 = ord($recordData[0]);
-
-        // offset: 1; size: 1; btWin32 (MSOBLIPTYPE)
-        $btMacOS = ord($recordData[1]);
-
-        // offset: 2; size: 16; MD4 digest
-        $rgbUid = substr($recordData, 2, 16);
-
-        // offset: 18; size: 2; tag
-        $tag = PHPExcel_Reader_Excel5::getInt2d($recordData, 18);
-
-        // offset: 20; size: 4; size of BLIP in bytes
-        $size = PHPExcel_Reader_Excel5::getInt4d($recordData, 20);
-
-        // offset: 24; size: 4; number of references to this BLIP
-        $cRef = PHPExcel_Reader_Excel5::getInt4d($recordData, 24);
-
-        // offset: 28; size: 4; MSOFO file offset
-        $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28);
-
-        // offset: 32; size: 1; unused1
-        $unused1 = ord($recordData{32});
-
-        // offset: 33; size: 1; size of nameData in bytes (including null terminator)
-        $cbName = ord($recordData{33});
-
-        // offset: 34; size: 1; unused2
-        $unused2 = ord($recordData{34});
-
-        // offset: 35; size: 1; unused3
-        $unused3 = ord($recordData{35});
-
-        // offset: 36; size: $cbName; nameData
-        $nameData = substr($recordData, 36, $cbName);
-
-        // offset: 36 + $cbName, size: var; the BLIP data
-        $blipData = substr($recordData, 36 + $cbName);
-
-        // record is a container, read contents
-        $reader = new PHPExcel_Reader_Excel5_Escher($BSE);
-        $reader->load($blipData);
-    }
-
-    /**
-     * Read BlipJPEG record. Holds raw JPEG image data
-     */
-    private function readBlipJPEG()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        $pos = 0;
-
-        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
-        $rgbUid1 = substr($recordData, 0, 16);
-        $pos += 16;
-
-        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
-        if (in_array($recInstance, array(0x046B, 0x06E3))) {
-            $rgbUid2 = substr($recordData, 16, 16);
-            $pos += 16;
-        }
-
-        // offset: var; size: 1; tag
-        $tag = ord($recordData{$pos});
-        $pos += 1;
-
-        // offset: var; size: var; the raw image data
-        $data = substr($recordData, $pos);
-
-        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
-        $blip->setData($data);
-
-        $this->object->setBlip($blip);
-    }
-
-    /**
-     * Read BlipPNG record. Holds raw PNG image data
-     */
-    private function readBlipPNG()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        $pos = 0;
-
-        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
-        $rgbUid1 = substr($recordData, 0, 16);
-        $pos += 16;
-
-        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
-        if ($recInstance == 0x06E1) {
-            $rgbUid2 = substr($recordData, 16, 16);
-            $pos += 16;
-        }
-
-        // offset: var; size: 1; tag
-        $tag = ord($recordData{$pos});
-        $pos += 1;
-
-        // offset: var; size: var; the raw image data
-        $data = substr($recordData, $pos);
-
-        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
-        $blip->setData($data);
-
-        $this->object->setBlip($blip);
-    }
-
-    /**
-     * Read OPT record. This record may occur within DggContainer record or SpContainer
-     */
-    private function readOPT()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        $this->readOfficeArtRGFOPTE($recordData, $recInstance);
-    }
-
-    /**
-     * Read TertiaryOPT record
-     */
-    private function readTertiaryOPT()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read SplitMenuColors record
-     */
-    private function readSplitMenuColors()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read DgContainer record (Drawing Container)
-     */
-    private function readDgContainer()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // record is a container, read contents
-        $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
-        $this->object->setDgContainer($dgContainer);
-        $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
-        $escher = $reader->load($recordData);
-    }
-
-    /**
-     * Read Dg record (Drawing)
-     */
-    private function readDg()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read SpgrContainer record (Shape Group Container)
-     */
-    private function readSpgrContainer()
-    {
-        // context is either context DgContainer or SpgrContainer
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // record is a container, read contents
-        $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
-
-        if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
-            // DgContainer
-            $this->object->setSpgrContainer($spgrContainer);
-        } else {
-            // SpgrContainer
-            $this->object->addChild($spgrContainer);
-        }
-
-        $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
-        $escher = $reader->load($recordData);
-    }
-
-    /**
-     * Read SpContainer record (Shape Container)
-     */
-    private function readSpContainer()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // add spContainer to spgrContainer
-        $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
-        $this->object->addChild($spContainer);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // record is a container, read contents
-        $reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
-        $escher = $reader->load($recordData);
-    }
-
-    /**
-     * Read Spgr record (Shape Group)
-     */
-    private function readSpgr()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read Sp record (Shape)
-     */
-    private function readSp()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read ClientTextbox record
-     */
-    private function readClientTextbox()
-    {
-        // offset: 0; size: 2; recVer and recInstance
-
-        // bit: 4-15; mask: 0xFFF0; recInstance
-        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
-
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
-     */
-    private function readClientAnchor()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-
-        // offset: 2; size: 2; upper-left corner column index (0-based)
-        $c1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 2);
-
-        // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
-        $startOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 4);
-
-        // offset: 6; size: 2; upper-left corner row index (0-based)
-        $r1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 6);
-
-        // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
-        $startOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 8);
-
-        // offset: 10; size: 2; bottom-right corner column index (0-based)
-        $c2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 10);
-
-        // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
-        $endOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 12);
-
-        // offset: 14; size: 2; bottom-right corner row index (0-based)
-        $r2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 14);
-
-        // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
-        $endOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 16);
-
-        // set the start coordinates
-        $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
-
-        // set the start offsetX
-        $this->object->setStartOffsetX($startOffsetX);
-
-        // set the start offsetY
-        $this->object->setStartOffsetY($startOffsetY);
-
-        // set the end coordinates
-        $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
-
-        // set the end offsetX
-        $this->object->setEndOffsetX($endOffsetX);
-
-        // set the end offsetY
-        $this->object->setEndOffsetY($endOffsetY);
-    }
-
-    /**
-     * Read ClientData record
-     */
-    private function readClientData()
-    {
-        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
-        $recordData = substr($this->data, $this->pos + 8, $length);
-
-        // move stream pointer to next record
-        $this->pos += 8 + $length;
-    }
-
-    /**
-     * Read OfficeArtRGFOPTE table of property-value pairs
-     *
-     * @param string $data Binary data
-     * @param int $n Number of properties
-     */
-    private function readOfficeArtRGFOPTE($data, $n)
-    {
-        $splicedComplexData = substr($data, 6 * $n);
-
-        // loop through property-value pairs
-        for ($i = 0; $i < $n; ++$i) {
-            // read 6 bytes at a time
-            $fopte = substr($data, 6 * $i, 6);
-
-            // offset: 0; size: 2; opid
-            $opid = PHPExcel_Reader_Excel5::getInt2d($fopte, 0);
-
-            // bit: 0-13; mask: 0x3FFF; opid.opid
-            $opidOpid = (0x3FFF & $opid) >> 0;
-
-            // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier
-            $opidFBid = (0x4000 & $opid) >> 14;
-
-            // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data
-            $opidFComplex = (0x8000 & $opid) >> 15;
-
-            // offset: 2; size: 4; the value for this property
-            $op = PHPExcel_Reader_Excel5::getInt4d($fopte, 2);
-
-            if ($opidFComplex) {
-                $complexData = substr($splicedComplexData, 0, $op);
-                $splicedComplexData = substr($splicedComplexData, $op);
-
-                // we store string value with complex data
-                $value = $complexData;
-            } else {
-                // we store integer value
-                $value = $op;
-            }
-
-            $this->object->setOPT($opidOpid, $value);
-        }
-    }
-}

+ 0 - 203
libs/PHPExcel/PHPExcel/Reader/Excel5/MD5.php

xqd
@@ -1,203 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_Excel5_MD5
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel5
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt        LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Excel5_MD5
-{
-    // Context
-    private $a;
-    private $b;
-    private $c;
-    private $d;
-
-    /**
-     * MD5 stream constructor
-     */
-    public function __construct()
-    {
-        $this->reset();
-    }
-
-    /**
-     * Reset the MD5 stream context
-     */
-    public function reset()
-    {
-        $this->a = 0x67452301;
-        $this->b = 0xEFCDAB89;
-        $this->c = 0x98BADCFE;
-        $this->d = 0x10325476;
-    }
-
-    /**
-     * Get MD5 stream context
-     *
-     * @return string
-     */
-    public function getContext()
-    {
-        $s = '';
-        foreach (array('a', 'b', 'c', 'd') as $i) {
-            $v = $this->{$i};
-            $s .= chr($v & 0xff);
-            $s .= chr(($v >> 8) & 0xff);
-            $s .= chr(($v >> 16) & 0xff);
-            $s .= chr(($v >> 24) & 0xff);
-        }
-
-        return $s;
-    }
-
-    /**
-     * Add data to context
-     *
-     * @param string $data Data to add
-     */
-    public function add($data)
-    {
-        $words = array_values(unpack('V16', $data));
-
-        $A = $this->a;
-        $B = $this->b;
-        $C = $this->c;
-        $D = $this->d;
-
-        $F = array('PHPExcel_Reader_Excel5_MD5','f');
-        $G = array('PHPExcel_Reader_Excel5_MD5','g');
-        $H = array('PHPExcel_Reader_Excel5_MD5','h');
-        $I = array('PHPExcel_Reader_Excel5_MD5','i');
-
-        /* ROUND 1 */
-        self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478);
-        self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756);
-        self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db);
-        self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee);
-        self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf);
-        self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a);
-        self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613);
-        self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501);
-        self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8);
-        self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af);
-        self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1);
-        self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be);
-        self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122);
-        self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193);
-        self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e);
-        self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821);
-
-        /* ROUND 2 */
-        self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562);
-        self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340);
-        self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51);
-        self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa);
-        self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d);
-        self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453);
-        self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681);
-        self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8);
-        self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6);
-        self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6);
-        self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87);
-        self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed);
-        self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905);
-        self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8);
-        self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9);
-        self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a);
-
-        /* ROUND 3 */
-        self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942);
-        self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681);
-        self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122);
-        self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c);
-        self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44);
-        self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9);
-        self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60);
-        self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70);
-        self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6);
-        self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa);
-        self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085);
-        self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05);
-        self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039);
-        self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5);
-        self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8);
-        self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665);
-
-        /* ROUND 4 */
-        self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244);
-        self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97);
-        self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7);
-        self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039);
-        self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3);
-        self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92);
-        self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d);
-        self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1);
-        self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f);
-        self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0);
-        self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314);
-        self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1);
-        self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82);
-        self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235);
-        self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb);
-        self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391);
-
-        $this->a = ($this->a + $A) & 0xffffffff;
-        $this->b = ($this->b + $B) & 0xffffffff;
-        $this->c = ($this->c + $C) & 0xffffffff;
-        $this->d = ($this->d + $D) & 0xffffffff;
-    }
-
-    private static function f($X, $Y, $Z)
-    {
-        return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
-    }
-
-    private static function g($X, $Y, $Z)
-    {
-        return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
-    }
-
-    private static function h($X, $Y, $Z)
-    {
-        return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
-    }
-
-    private static function i($X, $Y, $Z)
-    {
-        return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
-    }
-
-    private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
-    {
-        $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
-        $A = self::rotate($A, $s);
-        $A = ($B + $A) & 0xffffffff;
-    }
-
-    private static function rotate($decimal, $bits)
-    {
-        $binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
-        return bindec(substr($binary, $bits).substr($binary, 0, $bits));
-    }
-}

+ 0 - 81
libs/PHPExcel/PHPExcel/Reader/Excel5/RC4.php

xqd
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_Excel5_RC4
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader_Excel5
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Excel5_RC4
-{
-    // Context
-    protected $s = array();
-    protected $i = 0;
-    protected $j = 0;
-
-    /**
-     * RC4 stream decryption/encryption constrcutor
-     *
-     * @param string $key Encryption key/passphrase
-     */
-    public function __construct($key)
-    {
-        $len = strlen($key);
-
-        for ($this->i = 0; $this->i < 256; $this->i++) {
-            $this->s[$this->i] = $this->i;
-        }
-
-        $this->j = 0;
-        for ($this->i = 0; $this->i < 256; $this->i++) {
-            $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
-            $t = $this->s[$this->i];
-            $this->s[$this->i] = $this->s[$this->j];
-            $this->s[$this->j] = $t;
-        }
-        $this->i = $this->j = 0;
-    }
-
-    /**
-     * Symmetric decryption/encryption function
-     *
-     * @param string $data Data to encrypt/decrypt
-     *
-     * @return string
-     */
-    public function RC4($data)
-    {
-        $len = strlen($data);
-        for ($c = 0; $c < $len; $c++) {
-            $this->i = ($this->i + 1) % 256;
-            $this->j = ($this->j + $this->s[$this->i]) % 256;
-            $t = $this->s[$this->i];
-            $this->s[$this->i] = $this->s[$this->j];
-            $this->s[$this->j] = $t;
-
-            $t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
-
-            $data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
-        }
-        return $data;
-    }
-}

+ 0 - 36
libs/PHPExcel/PHPExcel/Reader/Excel5/Style/Border.php

xqd
@@ -1,36 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Style_Border
-{
-    protected static $map = array(
-        0x00 => PHPExcel_Style_Border::BORDER_NONE,
-        0x01 => PHPExcel_Style_Border::BORDER_THIN,
-        0x02 => PHPExcel_Style_Border::BORDER_MEDIUM,
-        0x03 => PHPExcel_Style_Border::BORDER_DASHED,
-        0x04 => PHPExcel_Style_Border::BORDER_DOTTED,
-        0x05 => PHPExcel_Style_Border::BORDER_THICK,
-        0x06 => PHPExcel_Style_Border::BORDER_DOUBLE,
-        0x07 => PHPExcel_Style_Border::BORDER_HAIR,
-        0x08 => PHPExcel_Style_Border::BORDER_MEDIUMDASHED,
-        0x09 => PHPExcel_Style_Border::BORDER_DASHDOT,
-        0x0A => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT,
-        0x0B => PHPExcel_Style_Border::BORDER_DASHDOTDOT,
-        0x0C => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT,
-        0x0D => PHPExcel_Style_Border::BORDER_SLANTDASHDOT,
-    );
-
-    /**
-     * Map border style
-     * OpenOffice documentation: 2.5.11
-     *
-     * @param int $index
-     * @return string
-     */
-    public static function lookup($index)
-    {
-        if (isset(self::$map[$index])) {
-            return self::$map[$index];
-        }
-        return PHPExcel_Style_Border::BORDER_NONE;
-    }
-}

+ 0 - 41
libs/PHPExcel/PHPExcel/Reader/Excel5/Style/FillPattern.php

xqd
@@ -1,41 +0,0 @@
-<?php
-
-class PHPExcel_Reader_Excel5_Style_FillPattern
-{
-    protected static $map = array(
-        0x00 => PHPExcel_Style_Fill::FILL_NONE,
-        0x01 => PHPExcel_Style_Fill::FILL_SOLID,
-        0x02 => PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY,
-        0x03 => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY,
-        0x04 => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY,
-        0x05 => PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL,
-        0x06 => PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL,
-        0x07 => PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN,
-        0x08 => PHPExcel_Style_Fill::FILL_PATTERN_DARKUP,
-        0x09 => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID,
-        0x0A => PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS,
-        0x0B => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL,
-        0x0C => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL,
-        0x0D => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN,
-        0x0E => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP,
-        0x0F => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID,
-        0x10 => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS,
-        0x11 => PHPExcel_Style_Fill::FILL_PATTERN_GRAY125,
-        0x12 => PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625,
-    );
-
-    /**
-     * Get fill pattern from index
-     * OpenOffice documentation: 2.5.12
-     *
-     * @param int $index
-     * @return string
-     */
-    public static function lookup($index)
-    {
-        if (isset(self::$map[$index])) {
-            return self::$map[$index];
-        }
-        return PHPExcel_Style_Fill::FILL_NONE;
-    }
-}

+ 0 - 46
libs/PHPExcel/PHPExcel/Reader/Exception.php

xqd
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_Exception
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Exception extends PHPExcel_Exception
-{
-    /**
-     * Error handler callback
-     *
-     * @param mixed $code
-     * @param mixed $string
-     * @param mixed $file
-     * @param mixed $line
-     * @param mixed $context
-     */
-    public static function errorHandlerCallback($code, $string, $file, $line, $context)
-    {
-        $e = new self($string, $code);
-        $e->line = $line;
-        $e->file = $file;
-        throw $e;
-    }
-}

+ 0 - 850
libs/PHPExcel/PHPExcel/Reader/Gnumeric.php

xqd
@@ -1,850 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_Gnumeric
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Formats
-     *
-     * @var array
-     */
-    private $styles = array();
-
-    /**
-     * Shared Expressions
-     *
-     * @var array
-     */
-    private $expressions = array();
-
-    private $referenceHelper = null;
-
-    /**
-     * Create a new PHPExcel_Reader_Gnumeric
-     */
-    public function __construct()
-    {
-        $this->readFilter     = new PHPExcel_Reader_DefaultReadFilter();
-        $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
-    }
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        // Check if gzlib functions are available
-        if (!function_exists('gzread')) {
-            throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
-        }
-
-        // Read signature data (first 3 bytes)
-        $fh = fopen($pFilename, 'r');
-        $data = fread($fh, 2);
-        fclose($fh);
-
-        if ($data != chr(0x1F).chr(0x8B)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
-     *
-     * @param     string         $pFilename
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function listWorksheetNames($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $xml = new XMLReader();
-        $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
-        $xml->setParserProperty(2, true);
-
-        $worksheetNames = array();
-        while ($xml->read()) {
-            if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
-                $xml->read();    //    Move onto the value node
-                $worksheetNames[] = (string) $xml->value;
-            } elseif ($xml->name == 'gnm:Sheets') {
-                //    break out of the loop once we've got our sheet names rather than parse the entire file
-                break;
-            }
-        }
-
-        return $worksheetNames;
-    }
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $xml = new XMLReader();
-        $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
-        $xml->setParserProperty(2, true);
-
-        $worksheetInfo = array();
-        while ($xml->read()) {
-            if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
-                $tmpInfo = array(
-                    'worksheetName' => '',
-                    'lastColumnLetter' => 'A',
-                    'lastColumnIndex' => 0,
-                    'totalRows' => 0,
-                    'totalColumns' => 0,
-                );
-
-                while ($xml->read()) {
-                    if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
-                        $xml->read();    //    Move onto the value node
-                        $tmpInfo['worksheetName'] = (string) $xml->value;
-                    } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
-                        $xml->read();    //    Move onto the value node
-                        $tmpInfo['lastColumnIndex'] = (int) $xml->value;
-                        $tmpInfo['totalColumns'] = (int) $xml->value + 1;
-                    } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
-                        $xml->read();    //    Move onto the value node
-                        $tmpInfo['totalRows'] = (int) $xml->value + 1;
-                        break;
-                    }
-                }
-                $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-                $worksheetInfo[] = $tmpInfo;
-            }
-        }
-
-        return $worksheetInfo;
-    }
-
-    private function gzfileGetContents($filename)
-    {
-        $file = @gzopen($filename, 'rb');
-        if ($file !== false) {
-            $data = '';
-            while (!gzeof($file)) {
-                $data .= gzread($file, 1024);
-            }
-            gzclose($file);
-        }
-        return $data;
-    }
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param     string         $pFilename
-     * @param    PHPExcel    $objPHPExcel
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $timezoneObj = new DateTimeZone('Europe/London');
-        $GMT = new DateTimeZone('UTC');
-
-        $gFileData = $this->gzfileGetContents($pFilename);
-
-//        echo '<pre>';
-//        echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
-//        echo '</pre><hr />';
-//
-        $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespacesMeta = $xml->getNamespaces(true);
-
-//        var_dump($namespacesMeta);
-//
-        $gnmXML = $xml->children($namespacesMeta['gnm']);
-
-        $docProps = $objPHPExcel->getProperties();
-        //    Document Properties are held differently, depending on the version of Gnumeric
-        if (isset($namespacesMeta['office'])) {
-            $officeXML = $xml->children($namespacesMeta['office']);
-            $officeDocXML = $officeXML->{'document-meta'};
-            $officeDocMetaXML = $officeDocXML->meta;
-
-            foreach ($officeDocMetaXML as $officePropertyData) {
-                $officePropertyDC = array();
-                if (isset($namespacesMeta['dc'])) {
-                    $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
-                }
-                foreach ($officePropertyDC as $propertyName => $propertyValue) {
-                    $propertyValue = (string) $propertyValue;
-                    switch ($propertyName) {
-                        case 'title':
-                            $docProps->setTitle(trim($propertyValue));
-                            break;
-                        case 'subject':
-                            $docProps->setSubject(trim($propertyValue));
-                            break;
-                        case 'creator':
-                            $docProps->setCreator(trim($propertyValue));
-                            $docProps->setLastModifiedBy(trim($propertyValue));
-                            break;
-                        case 'date':
-                            $creationDate = strtotime(trim($propertyValue));
-                            $docProps->setCreated($creationDate);
-                            $docProps->setModified($creationDate);
-                            break;
-                        case 'description':
-                            $docProps->setDescription(trim($propertyValue));
-                            break;
-                    }
-                }
-                $officePropertyMeta = array();
-                if (isset($namespacesMeta['meta'])) {
-                    $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
-                }
-                foreach ($officePropertyMeta as $propertyName => $propertyValue) {
-                    $attributes = $propertyValue->attributes($namespacesMeta['meta']);
-                    $propertyValue = (string) $propertyValue;
-                    switch ($propertyName) {
-                        case 'keyword':
-                            $docProps->setKeywords(trim($propertyValue));
-                            break;
-                        case 'initial-creator':
-                            $docProps->setCreator(trim($propertyValue));
-                            $docProps->setLastModifiedBy(trim($propertyValue));
-                            break;
-                        case 'creation-date':
-                            $creationDate = strtotime(trim($propertyValue));
-                            $docProps->setCreated($creationDate);
-                            $docProps->setModified($creationDate);
-                            break;
-                        case 'user-defined':
-                            list(, $attrName) = explode(':', $attributes['name']);
-                            switch ($attrName) {
-                                case 'publisher':
-                                    $docProps->setCompany(trim($propertyValue));
-                                    break;
-                                case 'category':
-                                    $docProps->setCategory(trim($propertyValue));
-                                    break;
-                                case 'manager':
-                                    $docProps->setManager(trim($propertyValue));
-                                    break;
-                            }
-                            break;
-                    }
-                }
-            }
-        } elseif (isset($gnmXML->Summary)) {
-            foreach ($gnmXML->Summary->Item as $summaryItem) {
-                $propertyName = $summaryItem->name;
-                $propertyValue = $summaryItem->{'val-string'};
-                switch ($propertyName) {
-                    case 'title':
-                        $docProps->setTitle(trim($propertyValue));
-                        break;
-                    case 'comments':
-                        $docProps->setDescription(trim($propertyValue));
-                        break;
-                    case 'keywords':
-                        $docProps->setKeywords(trim($propertyValue));
-                        break;
-                    case 'category':
-                        $docProps->setCategory(trim($propertyValue));
-                        break;
-                    case 'manager':
-                        $docProps->setManager(trim($propertyValue));
-                        break;
-                    case 'author':
-                        $docProps->setCreator(trim($propertyValue));
-                        $docProps->setLastModifiedBy(trim($propertyValue));
-                        break;
-                    case 'company':
-                        $docProps->setCompany(trim($propertyValue));
-                        break;
-                }
-            }
-        }
-
-        $worksheetID = 0;
-        foreach ($gnmXML->Sheets->Sheet as $sheet) {
-            $worksheetName = (string) $sheet->Name;
-//            echo '<b>Worksheet: ', $worksheetName,'</b><br />';
-            if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) {
-                continue;
-            }
-
-            $maxRow = $maxCol = 0;
-
-            // Create new Worksheet
-            $objPHPExcel->createSheet();
-            $objPHPExcel->setActiveSheetIndex($worksheetID);
-            //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
-            //        cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
-            //        name in line with the formula, not the reverse
-            $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
-
-            if ((!$this->readDataOnly) && (isset($sheet->PrintInformation))) {
-                if (isset($sheet->PrintInformation->Margins)) {
-                    foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
-                        $marginAttributes = $margin->attributes();
-                        $marginSize = 72 / 100;    //    Default
-                        switch ($marginAttributes['PrefUnit']) {
-                            case 'mm':
-                                $marginSize = intval($marginAttributes['Points']) / 100;
-                                break;
-                        }
-                        switch ($key) {
-                            case 'top':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
-                                break;
-                            case 'bottom':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
-                                break;
-                            case 'left':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
-                                break;
-                            case 'right':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
-                                break;
-                            case 'header':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
-                                break;
-                            case 'footer':
-                                $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
-                                break;
-                        }
-                    }
-                }
-            }
-
-            foreach ($sheet->Cells->Cell as $cell) {
-                $cellAttributes = $cell->attributes();
-                $row = (int) $cellAttributes->Row + 1;
-                $column = (int) $cellAttributes->Col;
-
-                if ($row > $maxRow) {
-                    $maxRow = $row;
-                }
-                if ($column > $maxCol) {
-                    $maxCol = $column;
-                }
-
-                $column = PHPExcel_Cell::stringFromColumnIndex($column);
-
-                // Read cell?
-                if ($this->getReadFilter() !== null) {
-                    if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
-                        continue;
-                    }
-                }
-
-                $ValueType = $cellAttributes->ValueType;
-                $ExprID = (string) $cellAttributes->ExprID;
-//                echo 'Cell ', $column, $row,'<br />';
-//                echo 'Type is ', $ValueType,'<br />';
-//                echo 'Value is ', $cell,'<br />';
-                $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
-                if ($ExprID > '') {
-                    if (((string) $cell) > '') {
-                        $this->expressions[$ExprID] = array(
-                            'column'    => $cellAttributes->Col,
-                            'row'        => $cellAttributes->Row,
-                            'formula'    => (string) $cell
-                        );
-//                        echo 'NEW EXPRESSION ', $ExprID,'<br />';
-                    } else {
-                        $expression = $this->expressions[$ExprID];
-
-                        $cell = $this->referenceHelper->updateFormulaReferences(
-                            $expression['formula'],
-                            'A1',
-                            $cellAttributes->Col - $expression['column'],
-                            $cellAttributes->Row - $expression['row'],
-                            $worksheetName
-                        );
-//                        echo 'SHARED EXPRESSION ', $ExprID,'<br />';
-//                        echo 'New Value is ', $cell,'<br />';
-                    }
-                    $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
-                } else {
-                    switch ($ValueType) {
-                        case '10':        //    NULL
-                            $type = PHPExcel_Cell_DataType::TYPE_NULL;
-                            break;
-                        case '20':        //    Boolean
-                            $type = PHPExcel_Cell_DataType::TYPE_BOOL;
-                            $cell = ($cell == 'TRUE') ? true: false;
-                            break;
-                        case '30':        //    Integer
-                            $cell = intval($cell);
-                            // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case
-                        case '40':        //    Float
-                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                            break;
-                        case '50':        //    Error
-                            $type = PHPExcel_Cell_DataType::TYPE_ERROR;
-                            break;
-                        case '60':        //    String
-                            $type = PHPExcel_Cell_DataType::TYPE_STRING;
-                            break;
-                        case '70':        //    Cell Range
-                        case '80':        //    Array
-                    }
-                }
-                $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
-            }
-
-            if ((!$this->readDataOnly) && (isset($sheet->Objects))) {
-                foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
-                    $commentAttributes = $comment->attributes();
-                    //    Only comment objects are handled at the moment
-                    if ($commentAttributes->Text) {
-                        $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->parseRichText((string)$commentAttributes->Text));
-                    }
-                }
-            }
-//            echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
-//
-            foreach ($sheet->Styles->StyleRegion as $styleRegion) {
-                $styleAttributes = $styleRegion->attributes();
-                if (($styleAttributes['startRow'] <= $maxRow) &&
-                    ($styleAttributes['startCol'] <= $maxCol)) {
-                    $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
-                    $startRow = $styleAttributes['startRow'] + 1;
-
-                    $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
-                    $endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn);
-                    $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
-                    $endRow += 1;
-                    $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow;
-//                    echo $cellRange,'<br />';
-
-                    $styleAttributes = $styleRegion->Style->attributes();
-//                    var_dump($styleAttributes);
-//                    echo '<br />';
-
-                    //    We still set the number format mask for date/time values, even if readDataOnly is true
-                    if ((!$this->readDataOnly) ||
-                        (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
-                        $styleArray = array();
-                        $styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
-                        //    If readDataOnly is false, we set all formatting information
-                        if (!$this->readDataOnly) {
-                            switch ($styleAttributes['HAlign']) {
-                                case '1':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
-                                    break;
-                                case '2':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
-                                    break;
-                                case '4':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
-                                    break;
-                                case '8':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
-                                    break;
-                                case '16':
-                                case '64':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
-                                    break;
-                                case '32':
-                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
-                                    break;
-                            }
-
-                            switch ($styleAttributes['VAlign']) {
-                                case '1':
-                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
-                                    break;
-                                case '2':
-                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
-                                    break;
-                                case '4':
-                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
-                                    break;
-                                case '8':
-                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
-                                    break;
-                            }
-
-                            $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
-                            $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
-                            $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
-
-                            $RGB = self::parseGnumericColour($styleAttributes["Fore"]);
-                            $styleArray['font']['color']['rgb'] = $RGB;
-                            $RGB = self::parseGnumericColour($styleAttributes["Back"]);
-                            $shade = $styleAttributes["Shade"];
-                            if (($RGB != '000000') || ($shade != '0')) {
-                                $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
-                                $RGB2 = self::parseGnumericColour($styleAttributes["PatternColor"]);
-                                $styleArray['fill']['endcolor']['rgb'] = $RGB2;
-                                switch ($shade) {
-                                    case '1':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
-                                        break;
-                                    case '2':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
-                                        break;
-                                    case '3':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
-                                        break;
-                                    case '4':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
-                                        break;
-                                    case '5':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
-                                        break;
-                                    case '6':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
-                                        break;
-                                    case '7':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
-                                        break;
-                                    case '8':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
-                                        break;
-                                    case '9':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
-                                        break;
-                                    case '10':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
-                                        break;
-                                    case '11':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
-                                        break;
-                                    case '12':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
-                                        break;
-                                    case '13':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
-                                        break;
-                                    case '14':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
-                                        break;
-                                    case '15':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
-                                        break;
-                                    case '16':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
-                                        break;
-                                    case '17':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
-                                        break;
-                                    case '18':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
-                                        break;
-                                    case '19':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
-                                        break;
-                                    case '20':
-                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
-                                        break;
-                                }
-                            }
-
-                            $fontAttributes = $styleRegion->Style->Font->attributes();
-//                            var_dump($fontAttributes);
-//                            echo '<br />';
-                            $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
-                            $styleArray['font']['size'] = intval($fontAttributes['Unit']);
-                            $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
-                            $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
-                            $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
-                            switch ($fontAttributes['Underline']) {
-                                case '1':
-                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
-                                    break;
-                                case '2':
-                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
-                                    break;
-                                case '3':
-                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
-                                    break;
-                                case '4':
-                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
-                                    break;
-                                default:
-                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
-                                    break;
-                            }
-                            switch ($fontAttributes['Script']) {
-                                case '1':
-                                    $styleArray['font']['superScript'] = true;
-                                    break;
-                                case '-1':
-                                    $styleArray['font']['subScript'] = true;
-                                    break;
-                            }
-
-                            if (isset($styleRegion->Style->StyleBorder)) {
-                                if (isset($styleRegion->Style->StyleBorder->Top)) {
-                                    $styleArray['borders']['top'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes());
-                                }
-                                if (isset($styleRegion->Style->StyleBorder->Bottom)) {
-                                    $styleArray['borders']['bottom'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes());
-                                }
-                                if (isset($styleRegion->Style->StyleBorder->Left)) {
-                                    $styleArray['borders']['left'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes());
-                                }
-                                if (isset($styleRegion->Style->StyleBorder->Right)) {
-                                    $styleArray['borders']['right'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes());
-                                }
-                                if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
-                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
-                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH;
-                                } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
-                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
-                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP;
-                                } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
-                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
-                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
-                                }
-                            }
-                            if (isset($styleRegion->Style->HyperLink)) {
-                                //    TO DO
-                                $hyperlink = $styleRegion->Style->HyperLink->attributes();
-                            }
-                        }
-//                        var_dump($styleArray);
-//                        echo '<br />';
-                        $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
-                    }
-                }
-            }
-
-            if ((!$this->readDataOnly) && (isset($sheet->Cols))) {
-                //    Column Widths
-                $columnAttributes = $sheet->Cols->attributes();
-                $defaultWidth = $columnAttributes['DefaultSizePts']  / 5.4;
-                $c = 0;
-                foreach ($sheet->Cols->ColInfo as $columnOverride) {
-                    $columnAttributes = $columnOverride->attributes();
-                    $column = $columnAttributes['No'];
-                    $columnWidth = $columnAttributes['Unit']  / 5.4;
-                    $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false;
-                    $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1;
-                    while ($c < $column) {
-                        $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
-                        ++$c;
-                    }
-                    while (($c < ($column+$columnCount)) && ($c <= $maxCol)) {
-                        $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth);
-                        if ($hidden) {
-                            $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false);
-                        }
-                        ++$c;
-                    }
-                }
-                while ($c <= $maxCol) {
-                    $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
-                    ++$c;
-                }
-            }
-
-            if ((!$this->readDataOnly) && (isset($sheet->Rows))) {
-                //    Row Heights
-                $rowAttributes = $sheet->Rows->attributes();
-                $defaultHeight = $rowAttributes['DefaultSizePts'];
-                $r = 0;
-
-                foreach ($sheet->Rows->RowInfo as $rowOverride) {
-                    $rowAttributes = $rowOverride->attributes();
-                    $row = $rowAttributes['No'];
-                    $rowHeight = $rowAttributes['Unit'];
-                    $hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false;
-                    $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1;
-                    while ($r < $row) {
-                        ++$r;
-                        $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
-                    }
-                    while (($r < ($row+$rowCount)) && ($r < $maxRow)) {
-                        ++$r;
-                        $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight);
-                        if ($hidden) {
-                            $objPHPExcel->getActiveSheet()->getRowDimension($r)->setVisible(false);
-                        }
-                    }
-                }
-                while ($r < $maxRow) {
-                    ++$r;
-                    $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
-                }
-            }
-
-            //    Handle Merged Cells in this worksheet
-            if (isset($sheet->MergedRegions)) {
-                foreach ($sheet->MergedRegions->Merge as $mergeCells) {
-                    if (strpos($mergeCells, ':') !== false) {
-                        $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
-                    }
-                }
-            }
-
-            $worksheetID++;
-        }
-
-        //    Loop through definedNames (global named ranges)
-        if (isset($gnmXML->Names)) {
-            foreach ($gnmXML->Names->Name as $namedRange) {
-                $name = (string) $namedRange->name;
-                $range = (string) $namedRange->value;
-                if (stripos($range, '#REF!') !== false) {
-                    continue;
-                }
-
-                $range = explode('!', $range);
-                $range[0] = trim($range[0], "'");
-                if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
-                    $extractedRange = str_replace('$', '', $range[1]);
-                    $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
-                }
-            }
-        }
-
-        // Return
-        return $objPHPExcel;
-    }
-
-    private static function parseBorderAttributes($borderAttributes)
-    {
-        $styleArray = array();
-        if (isset($borderAttributes["Color"])) {
-            $styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes["Color"]);
-        }
-
-        switch ($borderAttributes["Style"]) {
-            case '0':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
-                break;
-            case '1':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                break;
-            case '2':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
-                break;
-            case '3':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
-                break;
-            case '4':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
-                break;
-            case '5':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
-                break;
-            case '6':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
-                break;
-            case '7':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
-                break;
-            case '8':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
-                break;
-            case '9':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
-                break;
-            case '10':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
-                break;
-            case '11':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
-                break;
-            case '12':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
-                break;
-            case '13':
-                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
-                break;
-        }
-        return $styleArray;
-    }
-
-    private function parseRichText($is = '')
-    {
-        $value = new PHPExcel_RichText();
-        $value->createText($is);
-
-        return $value;
-    }
-
-    private static function parseGnumericColour($gnmColour)
-    {
-        list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
-        $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
-        $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
-        $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2);
-        return $gnmR . $gnmG . $gnmB;
-    }
-}

+ 0 - 549
libs/PHPExcel/PHPExcel/Reader/HTML.php

xqd
@@ -1,549 +0,0 @@
-<?php
-
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_HTML
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-/** PHPExcel root directory */
-class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-
-    /**
-     * Input encoding
-     *
-     * @var string
-     */
-    protected $inputEncoding = 'ANSI';
-
-    /**
-     * Sheet index to read
-     *
-     * @var int
-     */
-    protected $sheetIndex = 0;
-
-    /**
-     * Formats
-     *
-     * @var array
-     */
-    protected $formats = array(
-        'h1' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 24,
-            ),
-        ), //    Bold, 24pt
-        'h2' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 18,
-            ),
-        ), //    Bold, 18pt
-        'h3' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 13.5,
-            ),
-        ), //    Bold, 13.5pt
-        'h4' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 12,
-            ),
-        ), //    Bold, 12pt
-        'h5' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 10,
-            ),
-        ), //    Bold, 10pt
-        'h6' => array(
-            'font' => array(
-                'bold' => true,
-                'size' => 7.5,
-            ),
-        ), //    Bold, 7.5pt
-        'a' => array(
-            'font' => array(
-                'underline' => true,
-                'color' => array(
-                    'argb' => PHPExcel_Style_Color::COLOR_BLUE,
-                ),
-            ),
-        ), //    Blue underlined
-        'hr' => array(
-            'borders' => array(
-                'bottom' => array(
-                    'style' => PHPExcel_Style_Border::BORDER_THIN,
-                    'color' => array(
-                        PHPExcel_Style_Color::COLOR_BLACK,
-                    ),
-                ),
-            ),
-        ), //    Bottom border
-    );
-
-    protected $rowspan = array();
-
-    /**
-     * Create a new PHPExcel_Reader_HTML
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-    /**
-     * Validate that the current file is an HTML file
-     *
-     * @return boolean
-     */
-    protected function isValidFormat()
-    {
-        //    Reading 2048 bytes should be enough to validate that the format is HTML
-        $data = fread($this->fileHandle, 2048);
-        if ((strpos($data, '<') !== false) &&
-                (strlen($data) !== strlen(strip_tags($data)))) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param  string                    $pFilename
-     * @return PHPExcel
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    /**
-     * Set input encoding
-     *
-     * @param string $pValue Input encoding
-     */
-    public function setInputEncoding($pValue = 'ANSI')
-    {
-        $this->inputEncoding = $pValue;
-
-        return $this;
-    }
-
-    /**
-     * Get input encoding
-     *
-     * @return string
-     */
-    public function getInputEncoding()
-    {
-        return $this->inputEncoding;
-    }
-
-    //    Data Array used for testing only, should write to PHPExcel object on completion of tests
-    protected $dataArray = array();
-    protected $tableLevel = 0;
-    protected $nestedColumn = array('A');
-
-    protected function setTableStartColumn($column)
-    {
-        if ($this->tableLevel == 0) {
-            $column = 'A';
-        }
-        ++$this->tableLevel;
-        $this->nestedColumn[$this->tableLevel] = $column;
-
-        return $this->nestedColumn[$this->tableLevel];
-    }
-
-    protected function getTableStartColumn()
-    {
-        return $this->nestedColumn[$this->tableLevel];
-    }
-
-    protected function releaseTableStartColumn()
-    {
-        --$this->tableLevel;
-
-        return array_pop($this->nestedColumn);
-    }
-
-    protected function flushCell($sheet, $column, $row, &$cellContent)
-    {
-        if (is_string($cellContent)) {
-            //    Simple String content
-            if (trim($cellContent) > '') {
-                //    Only actually write it if there's content in the string
-//                echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
-                //    Write to worksheet to be done here...
-                //    ... we return the cell so we can mess about with styles more easily
-                $sheet->setCellValue($column . $row, $cellContent, true);
-                $this->dataArray[$row][$column] = $cellContent;
-            }
-        } else {
-            //    We have a Rich Text run
-            //    TODO
-            $this->dataArray[$row][$column] = 'RICH TEXT: ' . $cellContent;
-        }
-        $cellContent = (string) '';
-    }
-
-    protected function processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent, $format = null)
-    {
-        foreach ($element->childNodes as $child) {
-            if ($child instanceof DOMText) {
-                $domText = preg_replace('/\s+/u', ' ', trim($child->nodeValue));
-                if (is_string($cellContent)) {
-                    //    simply append the text if the cell content is a plain text string
-                    $cellContent .= $domText;
-                } else {
-                    //    but if we have a rich text run instead, we need to append it correctly
-                    //    TODO
-                }
-            } elseif ($child instanceof DOMElement) {
-//                echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
-
-                $attributeArray = array();
-                foreach ($child->attributes as $attribute) {
-//                    echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
-                    $attributeArray[$attribute->name] = $attribute->value;
-                }
-
-                switch ($child->nodeName) {
-                    case 'meta':
-                        foreach ($attributeArray as $attributeName => $attributeValue) {
-                            switch ($attributeName) {
-                                case 'content':
-                                    //    TODO
-                                    //    Extract character set, so we can convert to UTF-8 if required
-                                    break;
-                            }
-                        }
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        break;
-                    case 'title':
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        $sheet->setTitle($cellContent);
-                        $cellContent = '';
-                        break;
-                    case 'span':
-                    case 'div':
-                    case 'font':
-                    case 'i':
-                    case 'em':
-                    case 'strong':
-                    case 'b':
-//                        echo 'STYLING, SPAN OR DIV<br />';
-                        if ($cellContent > '') {
-                            $cellContent .= ' ';
-                        }
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        if ($cellContent > '') {
-                            $cellContent .= ' ';
-                        }
-//                        echo 'END OF STYLING, SPAN OR DIV<br />';
-                        break;
-                    case 'hr':
-                        $this->flushCell($sheet, $column, $row, $cellContent);
-                        ++$row;
-                        if (isset($this->formats[$child->nodeName])) {
-                            $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
-                        } else {
-                            $cellContent = '----------';
-                            $this->flushCell($sheet, $column, $row, $cellContent);
-                        }
-                        ++$row;
-                        // Add a break after a horizontal rule, simply by allowing the code to dropthru
-                    case 'br':
-                        if ($this->tableLevel > 0) {
-                            //    If we're inside a table, replace with a \n
-                            $cellContent .= "\n";
-                        } else {
-                            //    Otherwise flush our existing content and move the row cursor on
-                            $this->flushCell($sheet, $column, $row, $cellContent);
-                            ++$row;
-                        }
-//                        echo 'HARD LINE BREAK: ' , '<br />';
-                        break;
-                    case 'a':
-//                        echo 'START OF HYPERLINK: ' , '<br />';
-                        foreach ($attributeArray as $attributeName => $attributeValue) {
-                            switch ($attributeName) {
-                                case 'href':
-//                                    echo 'Link to ' , $attributeValue , '<br />';
-                                    $sheet->getCell($column . $row)->getHyperlink()->setUrl($attributeValue);
-                                    if (isset($this->formats[$child->nodeName])) {
-                                        $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
-                                    }
-                                    break;
-                            }
-                        }
-                        $cellContent .= ' ';
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                        echo 'END OF HYPERLINK:' , '<br />';
-                        break;
-                    case 'h1':
-                    case 'h2':
-                    case 'h3':
-                    case 'h4':
-                    case 'h5':
-                    case 'h6':
-                    case 'ol':
-                    case 'ul':
-                    case 'p':
-                        if ($this->tableLevel > 0) {
-                            //    If we're inside a table, replace with a \n
-                            $cellContent .= "\n";
-//                            echo 'LIST ENTRY: ' , '<br />';
-                            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                            echo 'END OF LIST ENTRY:' , '<br />';
-                        } else {
-                            if ($cellContent > '') {
-                                $this->flushCell($sheet, $column, $row, $cellContent);
-                                $row++;
-                            }
-//                            echo 'START OF PARAGRAPH: ' , '<br />';
-                            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                            echo 'END OF PARAGRAPH:' , '<br />';
-                            $this->flushCell($sheet, $column, $row, $cellContent);
-
-                            if (isset($this->formats[$child->nodeName])) {
-                                $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
-                            }
-
-                            $row++;
-                            $column = 'A';
-                        }
-                        break;
-                    case 'li':
-                        if ($this->tableLevel > 0) {
-                            //    If we're inside a table, replace with a \n
-                            $cellContent .= "\n";
-//                            echo 'LIST ENTRY: ' , '<br />';
-                            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                            echo 'END OF LIST ENTRY:' , '<br />';
-                        } else {
-                            if ($cellContent > '') {
-                                $this->flushCell($sheet, $column, $row, $cellContent);
-                            }
-                            ++$row;
-//                            echo 'LIST ENTRY: ' , '<br />';
-                            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                            echo 'END OF LIST ENTRY:' , '<br />';
-                            $this->flushCell($sheet, $column, $row, $cellContent);
-                            $column = 'A';
-                        }
-                        break;
-                    case 'table':
-                        $this->flushCell($sheet, $column, $row, $cellContent);
-                        $column = $this->setTableStartColumn($column);
-//                        echo 'START OF TABLE LEVEL ' , $this->tableLevel , '<br />';
-                        if ($this->tableLevel > 1) {
-                            --$row;
-                        }
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                        echo 'END OF TABLE LEVEL ' , $this->tableLevel , '<br />';
-                        $column = $this->releaseTableStartColumn();
-                        if ($this->tableLevel > 1) {
-                            ++$column;
-                        } else {
-                            ++$row;
-                        }
-                        break;
-                    case 'thead':
-                    case 'tbody':
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        break;
-                    case 'tr':
-                        $column = $this->getTableStartColumn();
-                        $cellContent = '';
-//                        echo 'START OF TABLE ' , $this->tableLevel , ' ROW<br />';
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        ++$row;
-//                        echo 'END OF TABLE ' , $this->tableLevel , ' ROW<br />';
-                        break;
-                    case 'th':
-                    case 'td':
-//                        echo 'START OF TABLE ' , $this->tableLevel , ' CELL<br />';
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-//                        echo 'END OF TABLE ' , $this->tableLevel , ' CELL<br />';
-
-                        while (isset($this->rowspan[$column . $row])) {
-                            ++$column;
-                        }
-
-                        $this->flushCell($sheet, $column, $row, $cellContent);
-
-//                        if (isset($attributeArray['style']) && !empty($attributeArray['style'])) {
-//                            $styleAry = $this->getPhpExcelStyleArray($attributeArray['style']);
-//
-//                            if (!empty($styleAry)) {
-//                                $sheet->getStyle($column . $row)->applyFromArray($styleAry);
-//                            }
-//                        }
-
-                        if (isset($attributeArray['rowspan']) && isset($attributeArray['colspan'])) {
-                            //create merging rowspan and colspan
-                            $columnTo = $column;
-                            for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) {
-                                ++$columnTo;
-                            }
-                            $range = $column . $row . ':' . $columnTo . ($row + $attributeArray['rowspan'] - 1);
-                            foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) {
-                                $this->rowspan[$value] = true;
-                            }
-                            $sheet->mergeCells($range);
-                            $column = $columnTo;
-                        } elseif (isset($attributeArray['rowspan'])) {
-                            //create merging rowspan
-                            $range = $column . $row . ':' . $column . ($row + $attributeArray['rowspan'] - 1);
-                            foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) {
-                                $this->rowspan[$value] = true;
-                            }
-                            $sheet->mergeCells($range);
-                        } elseif (isset($attributeArray['colspan'])) {
-                            //create merging colspan
-                            $columnTo = $column;
-                            for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) {
-                                ++$columnTo;
-                            }
-                            $sheet->mergeCells($column . $row . ':' . $columnTo . $row);
-                            $column = $columnTo;
-                        }
-                        ++$column;
-                        break;
-                    case 'body':
-                        $row = 1;
-                        $column = 'A';
-                        $content = '';
-                        $this->tableLevel = 0;
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                        break;
-                    default:
-                        $this->processDomElement($child, $sheet, $row, $column, $cellContent);
-                }
-            }
-        }
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param  string                    $pFilename
-     * @param  PHPExcel                  $objPHPExcel
-     * @return PHPExcel
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        // Open file to validate
-        $this->openFile($pFilename);
-        if (!$this->isValidFormat()) {
-            fclose($this->fileHandle);
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file.");
-        }
-        //    Close after validating
-        fclose($this->fileHandle);
-
-        // Create new PHPExcel
-        while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
-            $objPHPExcel->createSheet();
-        }
-        $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
-
-        //    Create a new DOM object
-        $dom = new domDocument;
-        //    Reload the HTML file into the DOM object
-        $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanFile($pFilename), 'HTML-ENTITIES', 'UTF-8'));
-        if ($loaded === false) {
-            throw new PHPExcel_Reader_Exception('Failed to load ' . $pFilename . ' as a DOM Document');
-        }
-
-        //    Discard white space
-        $dom->preserveWhiteSpace = false;
-
-        $row = 0;
-        $column = 'A';
-        $content = '';
-        $this->processDomElement($dom, $objPHPExcel->getActiveSheet(), $row, $column, $content);
-
-        // Return
-        return $objPHPExcel;
-    }
-
-    /**
-     * Get sheet index
-     *
-     * @return int
-     */
-    public function getSheetIndex()
-    {
-        return $this->sheetIndex;
-    }
-
-    /**
-     * Set sheet index
-     *
-     * @param  int                  $pValue Sheet index
-     * @return PHPExcel_Reader_HTML
-     */
-    public function setSheetIndex($pValue = 0)
-    {
-        $this->sheetIndex = $pValue;
-
-        return $this;
-    }
-
-    /**
-     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
-     *
-     * @param     string         $xml
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function securityScan($xml)
-    {
-        $pattern = '/\\0?' . implode('\\0?', str_split('<!ENTITY')) . '\\0?/';
-        if (preg_match($pattern, $xml)) {
-            throw new PHPExcel_Reader_Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
-        }
-        return $xml;
-    }
-}

+ 0 - 39
libs/PHPExcel/PHPExcel/Reader/IReadFilter.php

xqd
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_IReadFilter
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-interface PHPExcel_Reader_IReadFilter
-{
-    /**
-     * Should this cell be read?
-     *
-     * @param    $column           Column address (as a string value like "A", or "IV")
-     * @param    $row              Row number
-     * @param    $worksheetName    Optional worksheet name
-     * @return   boolean
-     */
-    public function readCell($column, $row, $worksheetName = '');
-}

+ 0 - 46
libs/PHPExcel/PHPExcel/Reader/IReader.php

xqd
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * PHPExcel_Reader_IReader
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-interface PHPExcel_Reader_IReader
-{
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     */
-    public function canRead($pFilename);
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return  PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename);
-}

+ 0 - 696
libs/PHPExcel/PHPExcel/Reader/OOCalc.php

xqd
@@ -1,696 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_OOCalc
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Formats
-     *
-     * @var array
-     */
-    private $styles = array();
-
-    /**
-     * Create a new PHPExcel_Reader_OOCalc
-     */
-    public function __construct()
-    {
-        $this->readFilter     = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-    /**
-     * Can the current PHPExcel_Reader_IReader read the file?
-     *
-     * @param     string         $pFilename
-     * @return     boolean
-     * @throws PHPExcel_Reader_Exception
-     */
-    public function canRead($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        // Check if zip class exists
-//        if (!class_exists($zipClass, false)) {
-//            throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
-//        }
-
-        $mimeType = 'UNKNOWN';
-        // Load file
-        $zip = new $zipClass;
-        if ($zip->open($pFilename) === true) {
-            // check if it is an OOXML archive
-            $stat = $zip->statName('mimetype');
-            if ($stat && ($stat['size'] <= 255)) {
-                $mimeType = $zip->getFromName($stat['name']);
-            } elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
-                $xml = simplexml_load_string($this->securityScan($zip->getFromName('META-INF/manifest.xml')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-                $namespacesContent = $xml->getNamespaces(true);
-                if (isset($namespacesContent['manifest'])) {
-                    $manifest = $xml->children($namespacesContent['manifest']);
-                    foreach ($manifest as $manifestDataSet) {
-                        $manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']);
-                        if ($manifestAttributes->{'full-path'} == '/') {
-                            $mimeType = (string) $manifestAttributes->{'media-type'};
-                            break;
-                        }
-                    }
-                }
-            }
-
-            $zip->close();
-
-            return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet');
-        }
-
-        return false;
-    }
-
-
-    /**
-     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
-     *
-     * @param     string         $pFilename
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function listWorksheetNames($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        if (!$zip->open($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
-        }
-
-        $worksheetNames = array();
-
-        $xml = new XMLReader();
-        $res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
-        $xml->setParserProperty(2, true);
-
-        //    Step into the first level of content of the XML
-        $xml->read();
-        while ($xml->read()) {
-            //    Quickly jump through to the office:body node
-            while ($xml->name !== 'office:body') {
-                if ($xml->isEmptyElement) {
-                    $xml->read();
-                } else {
-                    $xml->next();
-                }
-            }
-            //    Now read each node until we find our first table:table node
-            while ($xml->read()) {
-                if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
-                    //    Loop through each table:table node reading the table:name attribute for each worksheet name
-                    do {
-                        $worksheetNames[] = $xml->getAttribute('table:name');
-                        $xml->next();
-                    } while ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT);
-                }
-            }
-        }
-
-        return $worksheetNames;
-    }
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $worksheetInfo = array();
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        if (!$zip->open($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
-        }
-
-        $xml = new XMLReader();
-        $res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
-        $xml->setParserProperty(2, true);
-
-        //    Step into the first level of content of the XML
-        $xml->read();
-        while ($xml->read()) {
-            //    Quickly jump through to the office:body node
-            while ($xml->name !== 'office:body') {
-                if ($xml->isEmptyElement) {
-                    $xml->read();
-                } else {
-                    $xml->next();
-                }
-            }
-                //    Now read each node until we find our first table:table node
-            while ($xml->read()) {
-                if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
-                    $worksheetNames[] = $xml->getAttribute('table:name');
-
-                    $tmpInfo = array(
-                        'worksheetName' => $xml->getAttribute('table:name'),
-                        'lastColumnLetter' => 'A',
-                        'lastColumnIndex' => 0,
-                        'totalRows' => 0,
-                        'totalColumns' => 0,
-                    );
-
-                    //    Loop through each child node of the table:table element reading
-                    $currCells = 0;
-                    do {
-                        $xml->read();
-                        if ($xml->name == 'table:table-row' && $xml->nodeType == XMLReader::ELEMENT) {
-                            $rowspan = $xml->getAttribute('table:number-rows-repeated');
-                            $rowspan = empty($rowspan) ? 1 : $rowspan;
-                            $tmpInfo['totalRows'] += $rowspan;
-                            $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
-                            $currCells = 0;
-                            //    Step into the row
-                            $xml->read();
-                            do {
-                                if ($xml->name == 'table:table-cell' && $xml->nodeType == XMLReader::ELEMENT) {
-                                    if (!$xml->isEmptyElement) {
-                                        $currCells++;
-                                        $xml->next();
-                                    } else {
-                                        $xml->read();
-                                    }
-                                } elseif ($xml->name == 'table:covered-table-cell' && $xml->nodeType == XMLReader::ELEMENT) {
-                                    $mergeSize = $xml->getAttribute('table:number-columns-repeated');
-                                    $currCells += $mergeSize;
-                                    $xml->read();
-                                }
-                            } while ($xml->name != 'table:table-row');
-                        }
-                    } while ($xml->name != 'table:table');
-
-                    $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
-                    $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
-                    $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-                    $worksheetInfo[] = $tmpInfo;
-                }
-            }
-
-//                foreach ($workbookData->table as $worksheetDataSet) {
-//                    $worksheetData = $worksheetDataSet->children($namespacesContent['table']);
-//                    $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
-//
-//                    $rowIndex = 0;
-//                    foreach ($worksheetData as $key => $rowData) {
-//                        switch ($key) {
-//                            case 'table-row' :
-//                                $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
-//                                $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
-//                                        $rowDataTableAttributes['number-rows-repeated'] : 1;
-//                                $columnIndex = 0;
-//
-//                                foreach ($rowData as $key => $cellData) {
-//                                    $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
-//                                    $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
-//                                        $cellDataTableAttributes['number-columns-repeated'] : 1;
-//                                    $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
-//                                    if (isset($cellDataOfficeAttributes['value-type'])) {
-//                                        $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex + $colRepeats - 1);
-//                                        $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex + $rowRepeats);
-//                                    }
-//                                    $columnIndex += $colRepeats;
-//                                }
-//                                $rowIndex += $rowRepeats;
-//                                break;
-//                        }
-//                    }
-//
-//                    $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
-//                    $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
-//
-//                }
-//            }
-        }
-
-        return $worksheetInfo;
-    }
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
-    {
-        $styleAttributeValue = strtolower($styleAttributeValue);
-        foreach ($styleList as $style) {
-            if ($styleAttributeValue == strtolower($style)) {
-                $styleAttributeValue = $style;
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param     string         $pFilename
-     * @param    PHPExcel    $objPHPExcel
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        // Check if file exists
-        if (!file_exists($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
-        }
-
-        $timezoneObj = new DateTimeZone('Europe/London');
-        $GMT = new DateTimeZone('UTC');
-
-        $zipClass = PHPExcel_Settings::getZipClass();
-
-        $zip = new $zipClass;
-        if (!$zip->open($pFilename)) {
-            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
-        }
-
-//        echo '<h1>Meta Information</h1>';
-        $xml = simplexml_load_string($this->securityScan($zip->getFromName("meta.xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespacesMeta = $xml->getNamespaces(true);
-//        echo '<pre>';
-//        print_r($namespacesMeta);
-//        echo '</pre><hr />';
-
-        $docProps = $objPHPExcel->getProperties();
-        $officeProperty = $xml->children($namespacesMeta['office']);
-        foreach ($officeProperty as $officePropertyData) {
-            $officePropertyDC = array();
-            if (isset($namespacesMeta['dc'])) {
-                $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
-            }
-            foreach ($officePropertyDC as $propertyName => $propertyValue) {
-                $propertyValue = (string) $propertyValue;
-                switch ($propertyName) {
-                    case 'title':
-                        $docProps->setTitle($propertyValue);
-                        break;
-                    case 'subject':
-                        $docProps->setSubject($propertyValue);
-                        break;
-                    case 'creator':
-                        $docProps->setCreator($propertyValue);
-                        $docProps->setLastModifiedBy($propertyValue);
-                        break;
-                    case 'date':
-                        $creationDate = strtotime($propertyValue);
-                        $docProps->setCreated($creationDate);
-                        $docProps->setModified($creationDate);
-                        break;
-                    case 'description':
-                        $docProps->setDescription($propertyValue);
-                        break;
-                }
-            }
-            $officePropertyMeta = array();
-            if (isset($namespacesMeta['dc'])) {
-                $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
-            }
-            foreach ($officePropertyMeta as $propertyName => $propertyValue) {
-                $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
-                $propertyValue = (string) $propertyValue;
-                switch ($propertyName) {
-                    case 'initial-creator':
-                        $docProps->setCreator($propertyValue);
-                        break;
-                    case 'keyword':
-                        $docProps->setKeywords($propertyValue);
-                        break;
-                    case 'creation-date':
-                        $creationDate = strtotime($propertyValue);
-                        $docProps->setCreated($creationDate);
-                        break;
-                    case 'user-defined':
-                        $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
-                        foreach ($propertyValueAttributes as $key => $value) {
-                            if ($key == 'name') {
-                                $propertyValueName = (string) $value;
-                            } elseif ($key == 'value-type') {
-                                switch ($value) {
-                                    case 'date':
-                                        $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
-                                        $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
-                                        break;
-                                    case 'boolean':
-                                        $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
-                                        $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
-                                        break;
-                                    case 'float':
-                                        $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
-                                        $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
-                                        break;
-                                    default:
-                                        $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
-                                }
-                            }
-                        }
-                        $docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType);
-                        break;
-                }
-            }
-        }
-
-
-//        echo '<h1>Workbook Content</h1>';
-        $xml = simplexml_load_string($this->securityScan($zip->getFromName("content.xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
-        $namespacesContent = $xml->getNamespaces(true);
-//        echo '<pre>';
-//        print_r($namespacesContent);
-//        echo '</pre><hr />';
-
-        $workbook = $xml->children($namespacesContent['office']);
-        foreach ($workbook->body->spreadsheet as $workbookData) {
-            $workbookData = $workbookData->children($namespacesContent['table']);
-            $worksheetID = 0;
-            foreach ($workbookData->table as $worksheetDataSet) {
-                $worksheetData = $worksheetDataSet->children($namespacesContent['table']);
-//                print_r($worksheetData);
-//                echo '<br />';
-                $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
-//                print_r($worksheetDataAttributes);
-//                echo '<br />';
-                if ((isset($this->loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) &&
-                    (!in_array($worksheetDataAttributes['name'], $this->loadSheetsOnly))) {
-                    continue;
-                }
-
-//                echo '<h2>Worksheet '.$worksheetDataAttributes['name'].'</h2>';
-                // Create new Worksheet
-                $objPHPExcel->createSheet();
-                $objPHPExcel->setActiveSheetIndex($worksheetID);
-                if (isset($worksheetDataAttributes['name'])) {
-                    $worksheetName = (string) $worksheetDataAttributes['name'];
-                    //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
-                    //        formula cells... during the load, all formulae should be correct, and we're simply
-                    //        bringing the worksheet name in line with the formula, not the reverse
-                    $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
-                }
-
-                $rowID = 1;
-                foreach ($worksheetData as $key => $rowData) {
-//                    echo '<b>'.$key.'</b><br />';
-                    switch ($key) {
-                        case 'table-header-rows':
-                            foreach ($rowData as $key => $cellData) {
-                                $rowData = $cellData;
-                                break;
-                            }
-                        case 'table-row':
-                            $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
-                            $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
-                            $columnID = 'A';
-                            foreach ($rowData as $key => $cellData) {
-                                if ($this->getReadFilter() !== null) {
-                                    if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
-                                        continue;
-                                    }
-                                }
-
-//                                echo '<b>'.$columnID.$rowID.'</b><br />';
-                                $cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
-                                $cellDataOffice = $cellData->children($namespacesContent['office']);
-                                $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
-                                $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
-
-//                                echo 'Office Attributes: ';
-//                                print_r($cellDataOfficeAttributes);
-//                                echo '<br />Table Attributes: ';
-//                                print_r($cellDataTableAttributes);
-//                                echo '<br />Cell Data Text';
-//                                print_r($cellDataText);
-//                                echo '<br />';
-//
-                                $type = $formatting = $hyperlink = null;
-                                $hasCalculatedValue = false;
-                                $cellDataFormula = '';
-                                if (isset($cellDataTableAttributes['formula'])) {
-                                    $cellDataFormula = $cellDataTableAttributes['formula'];
-                                    $hasCalculatedValue = true;
-                                }
-
-                                if (isset($cellDataOffice->annotation)) {
-//                                    echo 'Cell has comment<br />';
-                                    $annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
-                                    $textArray = array();
-                                    foreach ($annotationText as $t) {
-                                        if (isset($t->span)) {
-                                            foreach ($t->span as $text) {
-                                                $textArray[] = (string)$text;
-                                            }
-                                        } else {
-                                            $textArray[] = (string) $t;
-                                        }
-                                    }
-                                    $text = implode("\n", $textArray);
-//                                    echo $text, '<br />';
-                                    $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text));
-//                                                                    ->setAuthor( $author )
-                                }
-
-                                if (isset($cellDataText->p)) {
-                                    // Consolidate if there are multiple p records (maybe with spans as well)
-                                    $dataArray = array();
-                                    // Text can have multiple text:p and within those, multiple text:span.
-                                    // text:p newlines, but text:span does not.
-                                    // Also, here we assume there is no text data is span fields are specified, since
-                                    // we have no way of knowing proper positioning anyway.
-                                    foreach ($cellDataText->p as $pData) {
-                                        if (isset($pData->span)) {
-                                            // span sections do not newline, so we just create one large string here
-                                            $spanSection = "";
-                                            foreach ($pData->span as $spanData) {
-                                                $spanSection .= $spanData;
-                                            }
-                                            array_push($dataArray, $spanSection);
-                                        } else {
-                                            array_push($dataArray, $pData);
-                                        }
-                                    }
-                                    $allCellDataText = implode($dataArray, "\n");
-
-//                                    echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
-                                    switch ($cellDataOfficeAttributes['value-type']) {
-                                        case 'string':
-                                            $type = PHPExcel_Cell_DataType::TYPE_STRING;
-                                            $dataValue = $allCellDataText;
-                                            if (isset($dataValue->a)) {
-                                                $dataValue = $dataValue->a;
-                                                $cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']);
-                                                $hyperlink = $cellXLinkAttributes['href'];
-                                            }
-                                            break;
-                                        case 'boolean':
-                                            $type = PHPExcel_Cell_DataType::TYPE_BOOL;
-                                            $dataValue = ($allCellDataText == 'TRUE') ? true : false;
-                                            break;
-                                        case 'percentage':
-                                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                            $dataValue = (float) $cellDataOfficeAttributes['value'];
-                                            if (floor($dataValue) == $dataValue) {
-                                                $dataValue = (integer) $dataValue;
-                                            }
-                                            $formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
-                                            break;
-                                        case 'currency':
-                                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                            $dataValue = (float) $cellDataOfficeAttributes['value'];
-                                            if (floor($dataValue) == $dataValue) {
-                                                $dataValue = (integer) $dataValue;
-                                            }
-                                            $formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
-                                            break;
-                                        case 'float':
-                                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                            $dataValue = (float) $cellDataOfficeAttributes['value'];
-                                            if (floor($dataValue) == $dataValue) {
-                                                if ($dataValue == (integer) $dataValue) {
-                                                    $dataValue = (integer) $dataValue;
-                                                } else {
-                                                    $dataValue = (float) $dataValue;
-                                                }
-                                            }
-                                            break;
-                                        case 'date':
-                                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                            $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
-                                            $dateObj->setTimeZone($timezoneObj);
-                                            list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
-                                            $dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
-                                            if ($dataValue != floor($dataValue)) {
-                                                $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
-                                            } else {
-                                                $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
-                                            }
-                                            break;
-                                        case 'time':
-                                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
-                                            $dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
-                                            $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
-                                            break;
-                                    }
-//                                    echo 'Data value is '.$dataValue.'<br />';
-//                                    if ($hyperlink !== null) {
-//                                        echo 'Hyperlink is '.$hyperlink.'<br />';
-//                                    }
-                                } else {
-                                    $type = PHPExcel_Cell_DataType::TYPE_NULL;
-                                    $dataValue = null;
-                                }
-
-                                if ($hasCalculatedValue) {
-                                    $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
-//                                    echo 'Formula: ', $cellDataFormula, PHP_EOL;
-                                    $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
-                                    $temp = explode('"', $cellDataFormula);
-                                    $tKey = false;
-                                    foreach ($temp as &$value) {
-                                        //    Only replace in alternate array entries (i.e. non-quoted blocks)
-                                        if ($tKey = !$tKey) {
-                                            $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value);    //  Cell range reference in another sheet
-                                            $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value);       //  Cell reference in another sheet
-                                            $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value);    //  Cell range reference
-                                            $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value);                  //  Simple cell reference
-                                            $value = PHPExcel_Calculation::translateSeparator(';', ',', $value, $inBraces);
-                                        }
-                                    }
-                                    unset($value);
-                                    //    Then rebuild the formula string
-                                    $cellDataFormula = implode('"', $temp);
-//                                    echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
-                                }
-
-                                $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $cellDataTableAttributes['number-columns-repeated'] : 1;
-                                if ($type !== null) {
-                                    for ($i = 0; $i < $colRepeats; ++$i) {
-                                        if ($i > 0) {
-                                            ++$columnID;
-                                        }
-                                        if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) {
-                                            for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
-                                                $rID = $rowID + $rowAdjust;
-                                                $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
-                                                if ($hasCalculatedValue) {
-//                                                    echo 'Forumla result is '.$dataValue.'<br />';
-                                                    $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
-                                                }
-                                                if ($formatting !== null) {
-                                                    $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
-                                                } else {
-                                                    $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL);
-                                                }
-                                                if ($hyperlink !== null) {
-                                                    $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-
-                                //    Merged cells
-                                if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) {
-                                    if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->readDataOnly)) {
-                                        $columnTo = $columnID;
-                                        if (isset($cellDataTableAttributes['number-columns-spanned'])) {
-                                            $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2);
-                                        }
-                                        $rowTo = $rowID;
-                                        if (isset($cellDataTableAttributes['number-rows-spanned'])) {
-                                            $rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1;
-                                        }
-                                        $cellRange = $columnID.$rowID.':'.$columnTo.$rowTo;
-                                        $objPHPExcel->getActiveSheet()->mergeCells($cellRange);
-                                    }
-                                }
-
-                                ++$columnID;
-                            }
-                            $rowID += $rowRepeats;
-                            break;
-                    }
-                }
-                ++$worksheetID;
-            }
-        }
-
-        // Return
-        return $objPHPExcel;
-    }
-
-    private function parseRichText($is = '')
-    {
-        $value = new PHPExcel_RichText();
-
-        $value->createText($is);
-
-        return $value;
-    }
-}

+ 0 - 478
libs/PHPExcel/PHPExcel/Reader/SYLK.php

xqd
@@ -1,478 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Reader_SYLK
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Reader
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
-{
-    /**
-     * Input encoding
-     *
-     * @var string
-     */
-    private $inputEncoding = 'ANSI';
-
-    /**
-     * Sheet index to read
-     *
-     * @var int
-     */
-    private $sheetIndex = 0;
-
-    /**
-     * Formats
-     *
-     * @var array
-     */
-    private $formats = array();
-
-    /**
-     * Format Count
-     *
-     * @var int
-     */
-    private $format = 0;
-
-    /**
-     * Create a new PHPExcel_Reader_SYLK
-     */
-    public function __construct()
-    {
-        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
-    }
-
-    /**
-     * Validate that the current file is a SYLK file
-     *
-     * @return boolean
-     */
-    protected function isValidFormat()
-    {
-        // Read sample data (first 2 KB will do)
-        $data = fread($this->fileHandle, 2048);
-
-        // Count delimiters in file
-        $delimiterCount = substr_count($data, ';');
-        if ($delimiterCount < 1) {
-            return false;
-        }
-
-        // Analyze first line looking for ID; signature
-        $lines = explode("\n", $data);
-        if (substr($lines[0], 0, 4) != 'ID;P') {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Set input encoding
-     *
-     * @param string $pValue Input encoding
-     */
-    public function setInputEncoding($pValue = 'ANSI')
-    {
-        $this->inputEncoding = $pValue;
-        return $this;
-    }
-
-    /**
-     * Get input encoding
-     *
-     * @return string
-     */
-    public function getInputEncoding()
-    {
-        return $this->inputEncoding;
-    }
-
-    /**
-     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
-     *
-     * @param   string     $pFilename
-     * @throws   PHPExcel_Reader_Exception
-     */
-    public function listWorksheetInfo($pFilename)
-    {
-        // Open file
-        $this->openFile($pFilename);
-        if (!$this->isValidFormat()) {
-            fclose($this->fileHandle);
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-        $fileHandle = $this->fileHandle;
-        rewind($fileHandle);
-
-        $worksheetInfo = array();
-        $worksheetInfo[0]['worksheetName'] = 'Worksheet';
-        $worksheetInfo[0]['lastColumnLetter'] = 'A';
-        $worksheetInfo[0]['lastColumnIndex'] = 0;
-        $worksheetInfo[0]['totalRows'] = 0;
-        $worksheetInfo[0]['totalColumns'] = 0;
-
-        // Loop through file
-        $rowData = array();
-
-        // loop through one row (line) at a time in the file
-        $rowIndex = 0;
-        while (($rowData = fgets($fileHandle)) !== false) {
-            $columnIndex = 0;
-
-            // convert SYLK encoded $rowData to UTF-8
-            $rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
-
-            // explode each row at semicolons while taking into account that literal semicolon (;)
-            // is escaped like this (;;)
-            $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
-
-            $dataType = array_shift($rowData);
-            if ($dataType == 'C') {
-                //  Read cell value data
-                foreach ($rowData as $rowDatum) {
-                    switch ($rowDatum{0}) {
-                        case 'C':
-                        case 'X':
-                            $columnIndex = substr($rowDatum, 1) - 1;
-                            break;
-                        case 'R':
-                        case 'Y':
-                            $rowIndex = substr($rowDatum, 1);
-                            break;
-                    }
-
-                    $worksheetInfo[0]['totalRows'] = max($worksheetInfo[0]['totalRows'], $rowIndex);
-                    $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], $columnIndex);
-                }
-            }
-        }
-
-        $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
-        $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
-
-        // Close file
-        fclose($fileHandle);
-
-        return $worksheetInfo;
-    }
-
-    /**
-     * Loads PHPExcel from file
-     *
-     * @param     string         $pFilename
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function load($pFilename)
-    {
-        // Create new PHPExcel
-        $objPHPExcel = new PHPExcel();
-
-        // Load into this instance
-        return $this->loadIntoExisting($pFilename, $objPHPExcel);
-    }
-
-    /**
-     * Loads PHPExcel from file into PHPExcel instance
-     *
-     * @param     string         $pFilename
-     * @param    PHPExcel    $objPHPExcel
-     * @return     PHPExcel
-     * @throws     PHPExcel_Reader_Exception
-     */
-    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
-    {
-        // Open file
-        $this->openFile($pFilename);
-        if (!$this->isValidFormat()) {
-            fclose($this->fileHandle);
-            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
-        }
-        $fileHandle = $this->fileHandle;
-        rewind($fileHandle);
-
-        // Create new PHPExcel
-        while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
-            $objPHPExcel->createSheet();
-        }
-        $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
-
-        $fromFormats    = array('\-',    '\ ');
-        $toFormats        = array('-',    ' ');
-
-        // Loop through file
-        $rowData = array();
-        $column = $row = '';
-
-        // loop through one row (line) at a time in the file
-        while (($rowData = fgets($fileHandle)) !== false) {
-            // convert SYLK encoded $rowData to UTF-8
-            $rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
-
-            // explode each row at semicolons while taking into account that literal semicolon (;)
-            // is escaped like this (;;)
-            $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
-
-            $dataType = array_shift($rowData);
-            //    Read shared styles
-            if ($dataType == 'P') {
-                $formatArray = array();
-                foreach ($rowData as $rowDatum) {
-                    switch ($rowDatum{0}) {
-                        case 'P':
-                            $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
-                            break;
-                        case 'E':
-                        case 'F':
-                            $formatArray['font']['name'] = substr($rowDatum, 1);
-                            break;
-                        case 'L':
-                            $formatArray['font']['size'] = substr($rowDatum, 1);
-                            break;
-                        case 'S':
-                            $styleSettings = substr($rowDatum, 1);
-                            for ($i=0; $i<strlen($styleSettings); ++$i) {
-                                switch ($styleSettings{$i}) {
-                                    case 'I':
-                                        $formatArray['font']['italic'] = true;
-                                        break;
-                                    case 'D':
-                                        $formatArray['font']['bold'] = true;
-                                        break;
-                                    case 'T':
-                                        $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'B':
-                                        $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'L':
-                                        $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'R':
-                                        $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                }
-                            }
-                            break;
-                    }
-                }
-                $this->formats['P'.$this->format++] = $formatArray;
-            //    Read cell value data
-            } elseif ($dataType == 'C') {
-                $hasCalculatedValue = false;
-                $cellData = $cellDataFormula = '';
-                foreach ($rowData as $rowDatum) {
-                    switch ($rowDatum{0}) {
-                        case 'C':
-                        case 'X':
-                            $column = substr($rowDatum, 1);
-                            break;
-                        case 'R':
-                        case 'Y':
-                            $row = substr($rowDatum, 1);
-                            break;
-                        case 'K':
-                            $cellData = substr($rowDatum, 1);
-                            break;
-                        case 'E':
-                            $cellDataFormula = '='.substr($rowDatum, 1);
-                            //    Convert R1C1 style references to A1 style references (but only when not quoted)
-                            $temp = explode('"', $cellDataFormula);
-                            $key = false;
-                            foreach ($temp as &$value) {
-                                //    Only count/replace in alternate array entries
-                                if ($key = !$key) {
-                                    preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
-                                    //    Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
-                                    //        through the formula from left to right. Reversing means that we work right to left.through
-                                    //        the formula
-                                    $cellReferences = array_reverse($cellReferences);
-                                    //    Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
-                                    //        then modify the formula to use that new reference
-                                    foreach ($cellReferences as $cellReference) {
-                                        $rowReference = $cellReference[2][0];
-                                        //    Empty R reference is the current row
-                                        if ($rowReference == '') {
-                                            $rowReference = $row;
-                                        }
-                                        //    Bracketed R references are relative to the current row
-                                        if ($rowReference{0} == '[') {
-                                            $rowReference = $row + trim($rowReference, '[]');
-                                        }
-                                        $columnReference = $cellReference[4][0];
-                                        //    Empty C reference is the current column
-                                        if ($columnReference == '') {
-                                            $columnReference = $column;
-                                        }
-                                        //    Bracketed C references are relative to the current column
-                                        if ($columnReference{0} == '[') {
-                                            $columnReference = $column + trim($columnReference, '[]');
-                                        }
-                                        $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
-
-                                        $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
-                                    }
-                                }
-                            }
-                            unset($value);
-                            //    Then rebuild the formula string
-                            $cellDataFormula = implode('"', $temp);
-                            $hasCalculatedValue = true;
-                            break;
-                    }
-                }
-                $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
-                $cellData = PHPExcel_Calculation::unwrapResult($cellData);
-
-                // Set cell value
-                $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
-                if ($hasCalculatedValue) {
-                    $cellData = PHPExcel_Calculation::unwrapResult($cellData);
-                    $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
-                }
-            //    Read cell formatting
-            } elseif ($dataType == 'F') {
-                $formatStyle = $columnWidth = $styleSettings = '';
-                $styleData = array();
-                foreach ($rowData as $rowDatum) {
-                    switch ($rowDatum{0}) {
-                        case 'C':
-                        case 'X':
-                            $column = substr($rowDatum, 1);
-                            break;
-                        case 'R':
-                        case 'Y':
-                            $row = substr($rowDatum, 1);
-                            break;
-                        case 'P':
-                            $formatStyle = $rowDatum;
-                            break;
-                        case 'W':
-                            list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
-                            break;
-                        case 'S':
-                            $styleSettings = substr($rowDatum, 1);
-                            for ($i=0; $i<strlen($styleSettings); ++$i) {
-                                switch ($styleSettings{$i}) {
-                                    case 'I':
-                                        $styleData['font']['italic'] = true;
-                                        break;
-                                    case 'D':
-                                        $styleData['font']['bold'] = true;
-                                        break;
-                                    case 'T':
-                                        $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'B':
-                                        $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'L':
-                                        $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                    case 'R':
-                                        $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
-                                        break;
-                                }
-                            }
-                            break;
-                    }
-                }
-                if (($formatStyle > '') && ($column > '') && ($row > '')) {
-                    $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
-                    if (isset($this->formats[$formatStyle])) {
-                        $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
-                    }
-                }
-                if ((!empty($styleData)) && ($column > '') && ($row > '')) {
-                    $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
-                    $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
-                }
-                if ($columnWidth > '') {
-                    if ($startCol == $endCol) {
-                        $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
-                        $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
-                    } else {
-                        $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
-                        $endCol = PHPExcel_Cell::stringFromColumnIndex($endCol-1);
-                        $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
-                        do {
-                            $objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth);
-                        } while ($startCol != $endCol);
-                    }
-                }
-            } else {
-                foreach ($rowData as $rowDatum) {
-                    switch ($rowDatum{0}) {
-                        case 'C':
-                        case 'X':
-                            $column = substr($rowDatum, 1);
-                            break;
-                        case 'R':
-                        case 'Y':
-                            $row = substr($rowDatum, 1);
-                            break;
-                    }
-                }
-            }
-        }
-
-        // Close file
-        fclose($fileHandle);
-
-        // Return
-        return $objPHPExcel;
-    }
-
-    /**
-     * Get sheet index
-     *
-     * @return int
-     */
-    public function getSheetIndex()
-    {
-        return $this->sheetIndex;
-    }
-
-    /**
-     * Set sheet index
-     *
-     * @param    int        $pValue        Sheet index
-     * @return PHPExcel_Reader_SYLK
-     */
-    public function setSheetIndex($pValue = 0)
-    {
-        $this->sheetIndex = $pValue;
-        return $this;
-    }
-}

+ 0 - 913
libs/PHPExcel/PHPExcel/ReferenceHelper.php

xqd
@@ -1,913 +0,0 @@
-<?php
-
-/**
- * PHPExcel_ReferenceHelper (Singleton)
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_ReferenceHelper
-{
-    /**    Constants                */
-    /**    Regular Expressions      */
-    const REFHELPER_REGEXP_CELLREF      = '((\w*|\'[^!]*\')!)?(?<![:a-z\$])(\$?[a-z]{1,3}\$?\d+)(?=[^:!\d\'])';
-    const REFHELPER_REGEXP_CELLRANGE    = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}\$?\d+):(\$?[a-z]{1,3}\$?\d+)';
-    const REFHELPER_REGEXP_ROWRANGE     = '((\w*|\'[^!]*\')!)?(\$?\d+):(\$?\d+)';
-    const REFHELPER_REGEXP_COLRANGE     = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}):(\$?[a-z]{1,3})';
-
-    /**
-     * Instance of this class
-     *
-     * @var PHPExcel_ReferenceHelper
-     */
-    private static $instance;
-
-    /**
-     * Get an instance of this class
-     *
-     * @return PHPExcel_ReferenceHelper
-     */
-    public static function getInstance()
-    {
-        if (!isset(self::$instance) || (self::$instance === null)) {
-            self::$instance = new PHPExcel_ReferenceHelper();
-        }
-
-        return self::$instance;
-    }
-
-    /**
-     * Create a new PHPExcel_ReferenceHelper
-     */
-    protected function __construct()
-    {
-    }
-
-    /**
-     * Compare two column addresses
-     * Intended for use as a Callback function for sorting column addresses by column
-     *
-     * @param   string   $a  First column to test (e.g. 'AA')
-     * @param   string   $b  Second column to test (e.g. 'Z')
-     * @return  integer
-     */
-    public static function columnSort($a, $b)
-    {
-        return strcasecmp(strlen($a) . $a, strlen($b) . $b);
-    }
-
-    /**
-     * Compare two column addresses
-     * Intended for use as a Callback function for reverse sorting column addresses by column
-     *
-     * @param   string   $a  First column to test (e.g. 'AA')
-     * @param   string   $b  Second column to test (e.g. 'Z')
-     * @return  integer
-     */
-    public static function columnReverseSort($a, $b)
-    {
-        return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
-    }
-
-    /**
-     * Compare two cell addresses
-     * Intended for use as a Callback function for sorting cell addresses by column and row
-     *
-     * @param   string   $a  First cell to test (e.g. 'AA1')
-     * @param   string   $b  Second cell to test (e.g. 'Z1')
-     * @return  integer
-     */
-    public static function cellSort($a, $b)
-    {
-        sscanf($a, '%[A-Z]%d', $ac, $ar);
-        sscanf($b, '%[A-Z]%d', $bc, $br);
-
-        if ($ar == $br) {
-            return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
-        }
-        return ($ar < $br) ? -1 : 1;
-    }
-
-    /**
-     * Compare two cell addresses
-     * Intended for use as a Callback function for sorting cell addresses by column and row
-     *
-     * @param   string   $a  First cell to test (e.g. 'AA1')
-     * @param   string   $b  Second cell to test (e.g. 'Z1')
-     * @return  integer
-     */
-    public static function cellReverseSort($a, $b)
-    {
-        sscanf($a, '%[A-Z]%d', $ac, $ar);
-        sscanf($b, '%[A-Z]%d', $bc, $br);
-
-        if ($ar == $br) {
-            return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
-        }
-        return ($ar < $br) ? 1 : -1;
-    }
-
-    /**
-     * Test whether a cell address falls within a defined range of cells
-     *
-     * @param   string     $cellAddress        Address of the cell we're testing
-     * @param   integer    $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer    $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     * @param   integer    $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer    $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @return  boolean
-     */
-    private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
-    {
-        list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
-        $cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
-        //    Is cell within the range of rows/columns if we're deleting
-        if ($pNumRows < 0 &&
-            ($cellRow >= ($beforeRow + $pNumRows)) &&
-            ($cellRow < $beforeRow)) {
-            return true;
-        } elseif ($pNumCols < 0 &&
-            ($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
-            ($cellColumnIndex < $beforeColumnIndex)) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Update page breaks when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aBreaks = $pSheet->getBreaks();
-        ($pNumCols > 0 || $pNumRows > 0) ?
-            uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
-            uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort'));
-
-        foreach ($aBreaks as $key => $value) {
-            if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
-                //    If we're deleting, then clear any defined breaks that are within the range
-                //        of rows/columns that we're deleting
-                $pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
-            } else {
-                //    Otherwise update any affected breaks by inserting a new break at the appropriate point
-                //        and removing the old affected break
-                $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-                if ($key != $newReference) {
-                    $pSheet->setBreak($newReference, $value)
-                        ->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
-                }
-            }
-        }
-    }
-
-    /**
-     * Update cell comments when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aComments = $pSheet->getComments();
-        $aNewComments = array(); // the new array of all comments
-
-        foreach ($aComments as $key => &$value) {
-            // Any comments inside a deleted range will be ignored
-            if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
-                // Otherwise build a new array of comments indexed by the adjusted cell reference
-                $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-                $aNewComments[$newReference] = $value;
-            }
-        }
-        //    Replace the comments array with the new set of comments
-        $pSheet->setComments($aNewComments);
-    }
-
-    /**
-     * Update hyperlinks when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aHyperlinkCollection = $pSheet->getHyperlinkCollection();
-        ($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
-
-        foreach ($aHyperlinkCollection as $key => $value) {
-            $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-            if ($key != $newReference) {
-                $pSheet->setHyperlink($newReference, $value);
-                $pSheet->setHyperlink($key, null);
-            }
-        }
-    }
-
-    /**
-     * Update data validations when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aDataValidationCollection = $pSheet->getDataValidationCollection();
-        ($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
-        
-        foreach ($aDataValidationCollection as $key => $value) {
-            $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-            if ($key != $newReference) {
-                $pSheet->setDataValidation($newReference, $value);
-                $pSheet->setDataValidation($key, null);
-            }
-        }
-    }
-
-    /**
-     * Update merged cells when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aMergeCells = $pSheet->getMergeCells();
-        $aNewMergeCells = array(); // the new array of all merge cells
-        foreach ($aMergeCells as $key => &$value) {
-            $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-            $aNewMergeCells[$newReference] = $newReference;
-        }
-        $pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
-    }
-
-    /**
-     * Update protected cells when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aProtectedCells = $pSheet->getProtectedCells();
-        ($pNumCols > 0 || $pNumRows > 0) ?
-            uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
-            uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort'));
-        foreach ($aProtectedCells as $key => $value) {
-            $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
-            if ($key != $newReference) {
-                $pSheet->protectCells($newReference, $value, true);
-                $pSheet->unprotectCells($key);
-            }
-        }
-    }
-
-    /**
-     * Update column dimensions when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
-        if (!empty($aColumnDimensions)) {
-            foreach ($aColumnDimensions as $objColumnDimension) {
-                $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
-                list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
-                if ($objColumnDimension->getColumnIndex() != $newReference) {
-                    $objColumnDimension->setColumnIndex($newReference);
-                }
-            }
-            $pSheet->refreshColumnDimensions();
-        }
-    }
-
-    /**
-     * Update row dimensions when inserting/deleting rows/columns
-     *
-     * @param   PHPExcel_Worksheet  $pSheet             The worksheet that we're editing
-     * @param   string              $pBefore            Insert/Delete before this cell address (e.g. 'A1')
-     * @param   integer             $beforeColumnIndex  Index number of the column we're inserting/deleting before
-     * @param   integer             $pNumCols           Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $beforeRow          Number of the row we're inserting/deleting before
-     * @param   integer             $pNumRows           Number of rows to insert/delete (negative values indicate deletion)
-     */
-    protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
-    {
-        $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
-        if (!empty($aRowDimensions)) {
-            foreach ($aRowDimensions as $objRowDimension) {
-                $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
-                list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
-                if ($objRowDimension->getRowIndex() != $newReference) {
-                    $objRowDimension->setRowIndex($newReference);
-                }
-            }
-            $pSheet->refreshRowDimensions();
-
-            $copyDimension = $pSheet->getRowDimension($beforeRow - 1);
-            for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
-                $newDimension = $pSheet->getRowDimension($i);
-                $newDimension->setRowHeight($copyDimension->getRowHeight());
-                $newDimension->setVisible($copyDimension->getVisible());
-                $newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
-                $newDimension->setCollapsed($copyDimension->getCollapsed());
-            }
-        }
-    }
-
-    /**
-     * Insert a new column or row, updating all possible related data
-     *
-     * @param   string              $pBefore    Insert before this cell address (e.g. 'A1')
-     * @param   integer             $pNumCols   Number of columns to insert/delete (negative values indicate deletion)
-     * @param   integer             $pNumRows   Number of rows to insert/delete (negative values indicate deletion)
-     * @param   PHPExcel_Worksheet  $pSheet     The worksheet that we're editing
-     * @throws  PHPExcel_Exception
-     */
-    public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null)
-    {
-        $remove = ($pNumCols < 0 || $pNumRows < 0);
-        $aCellCollection = $pSheet->getCellCollection();
-
-        // Get coordinates of $pBefore
-        $beforeColumn    = 'A';
-        $beforeRow        = 1;
-        list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
-        $beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn);
-
-        // Clear cells if we are removing columns or rows
-        $highestColumn    = $pSheet->getHighestColumn();
-        $highestRow    = $pSheet->getHighestRow();
-
-        // 1. Clear column strips if we are removing columns
-        if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) {
-            for ($i = 1; $i <= $highestRow - 1; ++$i) {
-                for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) {
-                    $coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i;
-                    $pSheet->removeConditionalStyles($coordinate);
-                    if ($pSheet->cellExists($coordinate)) {
-                        $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL);
-                        $pSheet->getCell($coordinate)->setXfIndex(0);
-                    }
-                }
-            }
-        }
-
-        // 2. Clear row strips if we are removing rows
-        if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) {
-            for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
-                for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) {
-                    $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j;
-                    $pSheet->removeConditionalStyles($coordinate);
-                    if ($pSheet->cellExists($coordinate)) {
-                        $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL);
-                        $pSheet->getCell($coordinate)->setXfIndex(0);
-                    }
-                }
-            }
-        }
-
-        // Loop through cells, bottom-up, and change cell coordinates
-        if ($remove) {
-            // It's faster to reverse and pop than to use unshift, especially with large cell collections
-            $aCellCollection = array_reverse($aCellCollection);
-        }
-        while ($cellID = array_pop($aCellCollection)) {
-            $cell = $pSheet->getCell($cellID);
-            $cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
-
-            if ($cellIndex-1 + $pNumCols < 0) {
-                continue;
-            }
-
-            // New coordinates
-            $newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
-
-            // Should the cell be updated? Move value and cellXf index from one cell to another.
-            if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) {
-                // Update cell styles
-                $pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
-
-                // Insert this cell at its new location
-                if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
-                    // Formula should be adjusted
-                    $pSheet->getCell($newCoordinates)
-                           ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
-                } else {
-                    // Formula should not be adjusted
-                    $pSheet->getCell($newCoordinates)->setValue($cell->getValue());
-                }
-
-                // Clear the original cell
-                $pSheet->getCellCacheController()->deleteCacheData($cellID);
-            } else {
-                /*    We don't need to update styles for rows/columns before our insertion position,
-                        but we do still need to adjust any formulae    in those cells                    */
-                if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
-                    // Formula should be adjusted
-                    $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
-                }
-
-            }
-        }
-
-        // Duplicate styles for the newly inserted cells
-        $highestColumn    = $pSheet->getHighestColumn();
-        $highestRow    = $pSheet->getHighestRow();
-
-        if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
-            for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
-                // Style
-                $coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
-                if ($pSheet->cellExists($coordinate)) {
-                    $xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
-                    $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
-                        $pSheet->getConditionalStyles($coordinate) : false;
-                    for ($j = $beforeColumnIndex - 1; $j <= $beforeColumnIndex - 2 + $pNumCols; ++$j) {
-                        $pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex);
-                        if ($conditionalStyles) {
-                            $cloned = array();
-                            foreach ($conditionalStyles as $conditionalStyle) {
-                                $cloned[] = clone $conditionalStyle;
-                            }
-                            $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j) . $i, $cloned);
-                        }
-                    }
-                }
-
-            }
-        }
-
-        if ($pNumRows > 0 && $beforeRow - 1 > 0) {
-            for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
-                // Style
-                $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
-                if ($pSheet->cellExists($coordinate)) {
-                    $xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
-                    $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
-                        $pSheet->getConditionalStyles($coordinate) : false;
-                    for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) {
-                        $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex);
-                        if ($conditionalStyles) {
-                            $cloned = array();
-                            foreach ($conditionalStyles as $conditionalStyle) {
-                                $cloned[] = clone $conditionalStyle;
-                            }
-                            $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $cloned);
-                        }
-                    }
-                }
-            }
-        }
-
-        // Update worksheet: column dimensions
-        $this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: row dimensions
-        $this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        //    Update worksheet: page breaks
-        $this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        //    Update worksheet: comments
-        $this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: hyperlinks
-        $this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: data validations
-        $this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: merge cells
-        $this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: protected cells
-        $this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
-
-        // Update worksheet: autofilter
-        $autoFilter = $pSheet->getAutoFilter();
-        $autoFilterRange = $autoFilter->getRange();
-        if (!empty($autoFilterRange)) {
-            if ($pNumCols != 0) {
-                $autoFilterColumns = array_keys($autoFilter->getColumns());
-                if (count($autoFilterColumns) > 0) {
-                    sscanf($pBefore, '%[A-Z]%d', $column, $row);
-                    $columnIndex = PHPExcel_Cell::columnIndexFromString($column);
-                    list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
-                    if ($columnIndex <= $rangeEnd[0]) {
-                        if ($pNumCols < 0) {
-                            //    If we're actually deleting any columns that fall within the autofilter range,
-                            //        then we delete any rules for those columns
-                            $deleteColumn = $columnIndex + $pNumCols - 1;
-                            $deleteCount = abs($pNumCols);
-                            for ($i = 1; $i <= $deleteCount; ++$i) {
-                                if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn), $autoFilterColumns)) {
-                                    $autoFilter->clearColumn(PHPExcel_Cell::stringFromColumnIndex($deleteColumn));
-                                }
-                                ++$deleteColumn;
-                            }
-                        }
-                        $startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0];
-
-                        //    Shuffle columns in autofilter range
-                        if ($pNumCols > 0) {
-                            //    For insert, we shuffle from end to beginning to avoid overwriting
-                            $startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
-                            $toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
-                            $endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
-
-                            $startColRef = $startCol;
-                            $endColRef = $rangeEnd[0];
-                            $toColRef = $rangeEnd[0]+$pNumCols;
-
-                            do {
-                                $autoFilter->shiftColumn(PHPExcel_Cell::stringFromColumnIndex($endColRef-1), PHPExcel_Cell::stringFromColumnIndex($toColRef-1));
-                                --$endColRef;
-                                --$toColRef;
-                            } while ($startColRef <= $endColRef);
-                        } else {
-                            //    For delete, we shuffle from beginning to end to avoid overwriting
-                            $startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
-                            $toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
-                            $endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
-                            do {
-                                $autoFilter->shiftColumn($startColID, $toColID);
-                                ++$startColID;
-                                ++$toColID;
-                            } while ($startColID != $endColID);
-                        }
-                    }
-                }
-            }
-            $pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows));
-        }
-
-        // Update worksheet: freeze pane
-        if ($pSheet->getFreezePane() != '') {
-            $pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows));
-        }
-
-        // Page setup
-        if ($pSheet->getPageSetup()->isPrintAreaSet()) {
-            $pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows));
-        }
-
-        // Update worksheet: drawings
-        $aDrawings = $pSheet->getDrawingCollection();
-        foreach ($aDrawings as $objDrawing) {
-            $newReference = $this->updateCellReference($objDrawing->getCoordinates(), $pBefore, $pNumCols, $pNumRows);
-            if ($objDrawing->getCoordinates() != $newReference) {
-                $objDrawing->setCoordinates($newReference);
-            }
-        }
-
-        // Update workbook: named ranges
-        if (count($pSheet->getParent()->getNamedRanges()) > 0) {
-            foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
-                if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
-                    $namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
-                }
-            }
-        }
-
-        // Garbage collect
-        $pSheet->garbageCollect();
-    }
-
-    /**
-     * Update references within formulas
-     *
-     * @param    string    $pFormula    Formula to update
-     * @param    int        $pBefore    Insert before this one
-     * @param    int        $pNumCols    Number of columns to insert
-     * @param    int        $pNumRows    Number of rows to insert
-     * @param   string  $sheetName  Worksheet name/title
-     * @return    string    Updated formula
-     * @throws    PHPExcel_Exception
-     */
-    public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
-    {
-        //    Update cell references in the formula
-        $formulaBlocks = explode('"', $pFormula);
-        $i = false;
-        foreach ($formulaBlocks as &$formulaBlock) {
-            //    Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
-            if ($i = !$i) {
-                $adjustCount = 0;
-                $newCellTokens = $cellTokens = array();
-                //    Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
-                if ($matchCount > 0) {
-                    foreach ($matches as $match) {
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
-                        $fromString .= $match[3].':'.$match[4];
-                        $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2);
-                        $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2);
-
-                        if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
-                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
-                                $toString .= $modified3.':'.$modified4;
-                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
-                                $column = 100000;
-                                $row = 10000000 + trim($match[3], '$');
-                                $cellIndex = $column.$row;
-
-                                $newCellTokens[$cellIndex] = preg_quote($toString);
-                                $cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i';
-                                ++$adjustCount;
-                            }
-                        }
-                    }
-                }
-                //    Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
-                if ($matchCount > 0) {
-                    foreach ($matches as $match) {
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
-                        $fromString .= $match[3].':'.$match[4];
-                        $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
-                        $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
-
-                        if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
-                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
-                                $toString .= $modified3.':'.$modified4;
-                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
-                                $column = PHPExcel_Cell::columnIndexFromString(trim($match[3], '$')) + 100000;
-                                $row = 10000000;
-                                $cellIndex = $column.$row;
-
-                                $newCellTokens[$cellIndex] = preg_quote($toString);
-                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i';
-                                ++$adjustCount;
-                            }
-                        }
-                    }
-                }
-                //    Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
-                if ($matchCount > 0) {
-                    foreach ($matches as $match) {
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
-                        $fromString .= $match[3].':'.$match[4];
-                        $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
-                        $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
-
-                        if ($match[3].$match[4] !== $modified3.$modified4) {
-                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
-                                $toString .= $modified3.':'.$modified4;
-                                list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
-                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
-                                $column = PHPExcel_Cell::columnIndexFromString(trim($column, '$')) + 100000;
-                                $row = trim($row, '$') + 10000000;
-                                $cellIndex = $column.$row;
-
-                                $newCellTokens[$cellIndex] = preg_quote($toString);
-                                $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i';
-                                ++$adjustCount;
-                            }
-                        }
-                    }
-                }
-                //    Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5)
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
-
-                if ($matchCount > 0) {
-                    foreach ($matches as $match) {
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
-                        $fromString .= $match[3];
-
-                        $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
-                        if ($match[3] !== $modified3) {
-                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
-                                $toString .= $modified3;
-                                list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
-                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
-                                $column = PHPExcel_Cell::columnIndexFromString(trim($column, '$')) + 100000;
-                                $row = trim($row, '$') + 10000000;
-                                $cellIndex = $row . $column;
-
-                                $newCellTokens[$cellIndex] = preg_quote($toString);
-                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i';
-                                ++$adjustCount;
-                            }
-                        }
-                    }
-                }
-                if ($adjustCount > 0) {
-                    if ($pNumCols > 0 || $pNumRows > 0) {
-                        krsort($cellTokens);
-                        krsort($newCellTokens);
-                    } else {
-                        ksort($cellTokens);
-                        ksort($newCellTokens);
-                    }   //  Update cell references in the formula
-                    $formulaBlock = str_replace('\\', '', preg_replace($cellTokens, $newCellTokens, $formulaBlock));
-                }
-            }
-        }
-        unset($formulaBlock);
-
-        //    Then rebuild the formula string
-        return implode('"', $formulaBlocks);
-    }
-
-    /**
-     * Update cell reference
-     *
-     * @param    string    $pCellRange            Cell range
-     * @param    int        $pBefore            Insert before this one
-     * @param    int        $pNumCols            Number of columns to increment
-     * @param    int        $pNumRows            Number of rows to increment
-     * @return    string    Updated cell range
-     * @throws    PHPExcel_Exception
-     */
-    public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
-    {
-        // Is it in another worksheet? Will not have to update anything.
-        if (strpos($pCellRange, "!") !== false) {
-            return $pCellRange;
-        // Is it a range or a single cell?
-        } elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
-            // Single cell
-            return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
-        } elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
-            // Range
-            return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
-        } else {
-            // Return original
-            return $pCellRange;
-        }
-    }
-
-    /**
-     * Update named formulas (i.e. containing worksheet references / named ranges)
-     *
-     * @param PHPExcel $pPhpExcel    Object to update
-     * @param string $oldName        Old name (name to replace)
-     * @param string $newName        New name
-     */
-    public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
-    {
-        if ($oldName == '') {
-            return;
-        }
-
-        foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
-            foreach ($sheet->getCellCollection(false) as $cellID) {
-                $cell = $sheet->getCell($cellID);
-                if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
-                    $formula = $cell->getValue();
-                    if (strpos($formula, $oldName) !== false) {
-                        $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
-                        $formula = str_replace($oldName . "!", $newName . "!", $formula);
-                        $cell->setValueExplicit($formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Update cell range
-     *
-     * @param    string    $pCellRange            Cell range    (e.g. 'B2:D4', 'B:C' or '2:3')
-     * @param    int        $pBefore            Insert before this one
-     * @param    int        $pNumCols            Number of columns to increment
-     * @param    int        $pNumRows            Number of rows to increment
-     * @return    string    Updated cell range
-     * @throws    PHPExcel_Exception
-     */
-    private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
-    {
-        if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
-            // Update range
-            $range = PHPExcel_Cell::splitRange($pCellRange);
-            $ic = count($range);
-            for ($i = 0; $i < $ic; ++$i) {
-                $jc = count($range[$i]);
-                for ($j = 0; $j < $jc; ++$j) {
-                    if (ctype_alpha($range[$i][$j])) {
-                        $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
-                        $range[$i][$j] = $r[0];
-                    } elseif (ctype_digit($range[$i][$j])) {
-                        $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
-                        $range[$i][$j] = $r[1];
-                    } else {
-                        $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
-                    }
-                }
-            }
-
-            // Recreate range string
-            return PHPExcel_Cell::buildRange($range);
-        } else {
-            throw new PHPExcel_Exception("Only cell ranges may be passed to this method.");
-        }
-    }
-
-    /**
-     * Update single cell reference
-     *
-     * @param    string    $pCellReference        Single cell reference
-     * @param    int        $pBefore            Insert before this one
-     * @param    int        $pNumCols            Number of columns to increment
-     * @param    int        $pNumRows            Number of rows to increment
-     * @return    string    Updated cell reference
-     * @throws    PHPExcel_Exception
-     */
-    private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
-    {
-        if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
-            // Get coordinates of $pBefore
-            list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
-
-            // Get coordinates of $pCellReference
-            list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
-
-            // Verify which parts should be updated
-            $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
-            $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
-
-            // Create new column reference
-            if ($updateColumn) {
-                $newColumn    = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
-            }
-
-            // Create new row reference
-            if ($updateRow) {
-                $newRow    = $newRow + $pNumRows;
-            }
-
-            // Return new reference
-            return $newColumn . $newRow;
-        } else {
-            throw new PHPExcel_Exception("Only single cell references may be passed to this method.");
-        }
-    }
-
-    /**
-     * __clone implementation. Cloning should not be allowed in a Singleton!
-     *
-     * @throws    PHPExcel_Exception
-     */
-    final public function __clone()
-    {
-        throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
-    }
-}

+ 0 - 191
libs/PHPExcel/PHPExcel/RichText.php

xqd
@@ -1,191 +0,0 @@
-<?php
-
-/**
- * PHPExcel_RichText
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_RichText
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_RichText implements PHPExcel_IComparable
-{
-    /**
-     * Rich text elements
-     *
-     * @var PHPExcel_RichText_ITextElement[]
-     */
-    private $richTextElements;
-
-    /**
-     * Create a new PHPExcel_RichText instance
-     *
-     * @param PHPExcel_Cell $pCell
-     * @throws PHPExcel_Exception
-     */
-    public function __construct(PHPExcel_Cell $pCell = null)
-    {
-        // Initialise variables
-        $this->richTextElements = array();
-
-        // Rich-Text string attached to cell?
-        if ($pCell !== null) {
-            // Add cell text and style
-            if ($pCell->getValue() != "") {
-                $objRun = new PHPExcel_RichText_Run($pCell->getValue());
-                $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
-                $this->addText($objRun);
-            }
-
-            // Set parent value
-            $pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING);
-        }
-    }
-
-    /**
-     * Add text
-     *
-     * @param PHPExcel_RichText_ITextElement $pText Rich text element
-     * @throws PHPExcel_Exception
-     * @return PHPExcel_RichText
-     */
-    public function addText(PHPExcel_RichText_ITextElement $pText = null)
-    {
-        $this->richTextElements[] = $pText;
-        return $this;
-    }
-
-    /**
-     * Create text
-     *
-     * @param string $pText Text
-     * @return PHPExcel_RichText_TextElement
-     * @throws PHPExcel_Exception
-     */
-    public function createText($pText = '')
-    {
-        $objText = new PHPExcel_RichText_TextElement($pText);
-        $this->addText($objText);
-        return $objText;
-    }
-
-    /**
-     * Create text run
-     *
-     * @param string $pText Text
-     * @return PHPExcel_RichText_Run
-     * @throws PHPExcel_Exception
-     */
-    public function createTextRun($pText = '')
-    {
-        $objText = new PHPExcel_RichText_Run($pText);
-        $this->addText($objText);
-        return $objText;
-    }
-
-    /**
-     * Get plain text
-     *
-     * @return string
-     */
-    public function getPlainText()
-    {
-        // Return value
-        $returnValue = '';
-
-        // Loop through all PHPExcel_RichText_ITextElement
-        foreach ($this->richTextElements as $text) {
-            $returnValue .= $text->getText();
-        }
-
-        // Return
-        return $returnValue;
-    }
-
-    /**
-     * Convert to string
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->getPlainText();
-    }
-
-    /**
-     * Get Rich Text elements
-     *
-     * @return PHPExcel_RichText_ITextElement[]
-     */
-    public function getRichTextElements()
-    {
-        return $this->richTextElements;
-    }
-
-    /**
-     * Set Rich Text elements
-     *
-     * @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
-     * @throws PHPExcel_Exception
-     * @return PHPExcel_RichText
-     */
-    public function setRichTextElements($pElements = null)
-    {
-        if (is_array($pElements)) {
-            $this->richTextElements = $pElements;
-        } else {
-            throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
-        }
-        return $this;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        $hashElements = '';
-        foreach ($this->richTextElements as $element) {
-            $hashElements .= $element->getHashCode();
-        }
-
-        return md5(
-            $hashElements .
-            __CLASS__
-        );
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 56
libs/PHPExcel/PHPExcel/RichText/ITextElement.php

xqd
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * PHPExcel_RichText_ITextElement
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_RichText
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-interface PHPExcel_RichText_ITextElement
-{
-    /**
-     * Get text
-     *
-     * @return string    Text
-     */
-    public function getText();
-
-    /**
-     * Set text
-     *
-     * @param     $pText string    Text
-     * @return PHPExcel_RichText_ITextElement
-     */
-    public function setText($pText = '');
-
-    /**
-     * Get font
-     *
-     * @return PHPExcel_Style_Font
-     */
-    public function getFont();
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode();
-}

+ 0 - 98
libs/PHPExcel/PHPExcel/RichText/Run.php

xqd
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * PHPExcel_RichText_Run
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_RichText
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
-{
-    /**
-     * Font
-     *
-     * @var PHPExcel_Style_Font
-     */
-    private $font;
-
-    /**
-     * Create a new PHPExcel_RichText_Run instance
-     *
-     * @param     string        $pText        Text
-     */
-    public function __construct($pText = '')
-    {
-        // Initialise variables
-        $this->setText($pText);
-        $this->font = new PHPExcel_Style_Font();
-    }
-
-    /**
-     * Get font
-     *
-     * @return PHPExcel_Style_Font
-     */
-    public function getFont()
-    {
-        return $this->font;
-    }
-
-    /**
-     * Set font
-     *
-     * @param    PHPExcel_Style_Font        $pFont        Font
-     * @throws     PHPExcel_Exception
-     * @return PHPExcel_RichText_ITextElement
-     */
-    public function setFont(PHPExcel_Style_Font $pFont = null)
-    {
-        $this->font = $pFont;
-        return $this;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        return md5(
-            $this->getText() .
-            $this->font->getHashCode() .
-            __CLASS__
-        );
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 105
libs/PHPExcel/PHPExcel/RichText/TextElement.php

xqd
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * PHPExcel_RichText_TextElement
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_RichText
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
-{
-    /**
-     * Text
-     *
-     * @var string
-     */
-    private $text;
-
-    /**
-     * Create a new PHPExcel_RichText_TextElement instance
-     *
-     * @param     string        $pText        Text
-     */
-    public function __construct($pText = '')
-    {
-        // Initialise variables
-        $this->text = $pText;
-    }
-
-    /**
-     * Get text
-     *
-     * @return string    Text
-     */
-    public function getText()
-    {
-        return $this->text;
-    }
-
-    /**
-     * Set text
-     *
-     * @param     $pText string    Text
-     * @return PHPExcel_RichText_ITextElement
-     */
-    public function setText($pText = '')
-    {
-        $this->text = $pText;
-        return $this;
-    }
-
-    /**
-     * Get font
-     *
-     * @return PHPExcel_Style_Font
-     */
-    public function getFont()
-    {
-        return null;
-    }
-
-    /**
-     * Get hash code
-     *
-     * @return string    Hash code
-     */
-    public function getHashCode()
-    {
-        return md5(
-            $this->text .
-            __CLASS__
-        );
-    }
-
-    /**
-     * Implement PHP __clone to create a deep clone, not just a shallow copy.
-     */
-    public function __clone()
-    {
-        $vars = get_object_vars($this);
-        foreach ($vars as $key => $value) {
-            if (is_object($value)) {
-                $this->$key = clone $value;
-            } else {
-                $this->$key = $value;
-            }
-        }
-    }
-}

+ 0 - 389
libs/PHPExcel/PHPExcel/Settings.php

xqd
@@ -1,389 +0,0 @@
-<?php
-
-/** PHPExcel root directory */
-if (!defined('PHPEXCEL_ROOT')) {
-    /**
-     * @ignore
-     */
-    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
-    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
-}
-
-/**
- * PHPExcel_Settings
- *
- * Copyright (c) 2006 - 2015 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @category   PHPExcel
- * @package    PHPExcel_Settings
- * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
- * @version    ##VERSION##, ##DATE##
- */
-class PHPExcel_Settings
-{
-    /**    constants */
-    /**    Available Zip library classes */
-    const PCLZIP     = 'PHPExcel_Shared_ZipArchive';
-    const ZIPARCHIVE = 'ZipArchive';
-
-    /**    Optional Chart Rendering libraries */
-    const CHART_RENDERER_JPGRAPH = 'jpgraph';
-
-    /**    Optional PDF Rendering libraries */
-    const PDF_RENDERER_TCPDF  = 'tcPDF';
-    const PDF_RENDERER_DOMPDF = 'DomPDF';
-    const PDF_RENDERER_MPDF   = 'mPDF';
-
-
-    private static $chartRenderers = array(
-        self::CHART_RENDERER_JPGRAPH,
-    );
-
-    private static $pdfRenderers = array(
-        self::PDF_RENDERER_TCPDF,
-        self::PDF_RENDERER_DOMPDF,
-        self::PDF_RENDERER_MPDF,
-    );
-
-
-    /**
-     * Name of the class used for Zip file management
-     *    e.g.
-     *        ZipArchive
-     *
-     * @var string
-     */
-    private static $zipClass = self::ZIPARCHIVE;
-
-
-    /**
-     * Name of the external Library used for rendering charts
-     *    e.g.
-     *        jpgraph
-     *
-     * @var string
-     */
-    private static $chartRendererName;
-
-    /**
-     * Directory Path to the external Library used for rendering charts
-     *
-     * @var string
-     */
-    private static $chartRendererPath;
-
-
-    /**
-     * Name of the external Library used for rendering PDF files
-     *    e.g.
-     *         mPDF
-     *
-     * @var string
-     */
-    private static $pdfRendererName;
-
-    /**
-     * Directory Path to the external Library used for rendering PDF files
-     *
-     * @var string
-     */
-    private static $pdfRendererPath;
-
-    /**
-     * Default options for libxml loader
-     *
-     * @var int
-     */
-    private static $libXmlLoaderOptions = null;
-
-    /**
-     * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
-     *
-     * @param string $zipClass    The Zip handler class that PHPExcel should use for Zip file management
-     *      e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
-     * @return    boolean    Success or failure
-     */
-    public static function setZipClass($zipClass)
-    {
-        if (($zipClass === self::PCLZIP) ||
-            ($zipClass === self::ZIPARCHIVE)) {
-            self::$zipClass = $zipClass;
-            return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
-     *    or Zip file management
-     *
-     * @return string Name of the Zip handler Class that PHPExcel is configured to use
-     *    for Zip file management
-     *    e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
-     */
-    public static function getZipClass()
-    {
-        return self::$zipClass;
-    }
-
-
-    /**
-     * Return the name of the method that is currently configured for cell cacheing
-     *
-     * @return string Name of the cacheing method
-     */
-    public static function getCacheStorageMethod()
-    {
-        return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
-    }
-
-
-    /**
-     * Return the name of the class that is currently being used for cell cacheing
-     *
-     * @return string Name of the class currently being used for cacheing
-     */
-    public static function getCacheStorageClass()
-    {
-        return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
-    }
-
-
-    /**
-     * Set the method that should be used for cell cacheing
-     *
-     * @param string $method Name of the cacheing method
-     * @param array $arguments Optional configuration arguments for the cacheing method
-     * @return boolean Success or failure
-     */
-    public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, $arguments = array())
-    {
-        return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
-    }
-
-
-    /**
-     * Set the locale code to use for formula translations and any special formatting
-     *
-     * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
-     * @return boolean Success or failure
-     */
-    public static function setLocale($locale = 'en_us')
-    {
-        return PHPExcel_Calculation::getInstance()->setLocale($locale);
-    }
-
-
-    /**
-     * Set details of the external library that PHPExcel should use for rendering charts
-     *
-     * @param string $libraryName    Internal reference name of the library
-     *    e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
-     * @param string $libraryBaseDir Directory path to the library's base folder
-     *
-     * @return    boolean    Success or failure
-     */
-    public static function setChartRenderer($libraryName, $libraryBaseDir)
-    {
-        if (!self::setChartRendererName($libraryName)) {
-            return false;
-        }
-        return self::setChartRendererPath($libraryBaseDir);
-    }
-
-
-    /**
-     * Identify to PHPExcel the external library to use for rendering charts
-     *
-     * @param string $libraryName    Internal reference name of the library
-     *    e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
-     *
-     * @return    boolean    Success or failure
-     */
-    public static function setChartRendererName($libraryName)
-    {
-        if (!in_array($libraryName, self::$chartRenderers)) {
-            return false;
-        }
-        self::$chartRendererName = $libraryName;
-
-        return true;
-    }
-
-
-    /**
-     * Tell PHPExcel where to find the external library to use for rendering charts
-     *
-     * @param string $libraryBaseDir    Directory path to the library's base folder
-     * @return    boolean    Success or failure
-     */
-    public static function setChartRendererPath($libraryBaseDir)
-    {
-        if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
-            return false;
-        }
-        self::$chartRendererPath = $libraryBaseDir;
-
-        return true;
-    }
-
-
-    /**
-     * Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph)
-     *
-     * @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is
-     *    currently configured to use
-     *    e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
-     */
-    public static function getChartRendererName()
-    {
-        return self::$chartRendererName;
-    }
-
-
-    /**
-     * Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use
-     *
-     * @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
-     *     currently configured to use
-     */
-    public static function getChartRendererPath()
-    {
-        return self::$chartRendererPath;
-    }
-
-
-    /**
-     * Set details of the external library that PHPExcel should use for rendering PDF files
-     *
-     * @param string $libraryName Internal reference name of the library
-     *     e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
-     *     PHPExcel_Settings::PDF_RENDERER_DOMPDF
-     *  or PHPExcel_Settings::PDF_RENDERER_MPDF
-     * @param string $libraryBaseDir Directory path to the library's base folder
-     *
-     * @return boolean Success or failure
-     */
-    public static function setPdfRenderer($libraryName, $libraryBaseDir)
-    {
-        if (!self::setPdfRendererName($libraryName)) {
-            return false;
-        }
-        return self::setPdfRendererPath($libraryBaseDir);
-    }
-
-
-    /**
-     * Identify to PHPExcel the external library to use for rendering PDF files
-     *
-     * @param string $libraryName Internal reference name of the library
-     *     e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
-     *    PHPExcel_Settings::PDF_RENDERER_DOMPDF
-     *     or PHPExcel_Settings::PDF_RENDERER_MPDF
-     *
-     * @return boolean Success or failure
-     */
-    public static function setPdfRendererName($libraryName)
-    {
-        if (!in_array($libraryName, self::$pdfRenderers)) {
-            return false;
-        }
-        self::$pdfRendererName = $libraryName;
-
-        return true;
-    }
-
-
-    /**
-     * Tell PHPExcel where to find the external library to use for rendering PDF files
-     *
-     * @param string $libraryBaseDir Directory path to the library's base folder
-     * @return boolean Success or failure
-     */
-    public static function setPdfRendererPath($libraryBaseDir)
-    {
-        if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
-            return false;
-        }
-        self::$pdfRendererPath = $libraryBaseDir;
-
-        return true;
-    }
-
-
-    /**
-     * Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf)
-     *
-     * @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is
-     *     currently configured to use
-     *  e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
-     *  PHPExcel_Settings::PDF_RENDERER_DOMPDF
-     *  or PHPExcel_Settings::PDF_RENDERER_MPDF
-     */
-    public static function getPdfRendererName()
-    {
-        return self::$pdfRendererName;
-    }
-
-    /**
-     * Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use
-     *
-     * @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
-     *        currently configured to use
-     */
-    public static function getPdfRendererPath()
-    {
-        return self::$pdfRendererPath;
-    }
-
-    /**
-     * Set options for libxml loader
-     *
-     * @param   int   $options   Options for libxml loader
-     */
-    public static function setLibXmlLoaderOptions($options = null)
-    {
-        if (is_null($options) && defined('LIBXML_DTDLOAD')) {
-            $options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
-        }
-        if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
-            @libxml_disable_entity_loader((bool) $options);
-        }
-        self::$libXmlLoaderOptions = $options;
-    }
-
-    /**
-     * Get defined options for libxml loader.
-     * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
-     *
-     * @return int Default options for libxml loader
-     */
-    public static function getLibXmlLoaderOptions()
-    {
-        if (is_null(self::$libXmlLoaderOptions) && defined('LIBXML_DTDLOAD')) {
-            self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
-        } elseif (is_null(self::$libXmlLoaderOptions)) {
-            self::$libXmlLoaderOptions = true;
-        }
-        if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
-            @libxml_disable_entity_loader((bool) self::$libXmlLoaderOptions);
-        }
-        return self::$libXmlLoaderOptions;
-    }
-}

部分文件因为文件数量过多而无法显示