Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
2b045ba74a
@ -19,7 +19,7 @@ FPDI 1.5.2 Apache Software License 2.0 Yes
|
|||||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||||
PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||||
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||||
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -38,10 +38,17 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel
|
class PHPExcel
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Unique ID
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_uniqueID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document properties
|
* Document properties
|
||||||
*
|
*
|
||||||
@ -63,6 +70,13 @@ class PHPExcel
|
|||||||
*/
|
*/
|
||||||
private $_workSheetCollection = array();
|
private $_workSheetCollection = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculation Engine
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Calculation
|
||||||
|
*/
|
||||||
|
private $_calculationEngine = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Active sheet index
|
* Active sheet index
|
||||||
*
|
*
|
||||||
@ -98,11 +112,253 @@ class PHPExcel
|
|||||||
*/
|
*/
|
||||||
private $_cellStyleXfCollection = array();
|
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=NULL;
|
||||||
|
/**
|
||||||
|
* _macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, NULL if not signed
|
||||||
|
*
|
||||||
|
* @var binary
|
||||||
|
*/
|
||||||
|
private $_macrosCertificate=NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _ribbonXMLData : NULL if workbook is'nt Excel 2007 or not contain a customized UI
|
||||||
|
*
|
||||||
|
* @var NULL|string
|
||||||
|
*/
|
||||||
|
private $_ribbonXMLData=NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _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=NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The workbook has macros ?
|
||||||
|
*
|
||||||
|
* @return true if workbook has macros, false if not
|
||||||
|
*/
|
||||||
|
public function hasMacros(){
|
||||||
|
return $this->_hasMacros;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define if a workbook has macros
|
||||||
|
*
|
||||||
|
* @param true|false
|
||||||
|
*/
|
||||||
|
public function setHasMacros($hasMacros=false){
|
||||||
|
$this->_hasMacros=(bool)$hasMacros;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the macros code
|
||||||
|
*
|
||||||
|
* @param binary string|null
|
||||||
|
*/
|
||||||
|
public function setMacrosCode($MacrosCode){
|
||||||
|
$this->_macrosCode=$MacrosCode;
|
||||||
|
$this->setHasMacros(!is_null($MacrosCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the macros code
|
||||||
|
*
|
||||||
|
* @return binary|null
|
||||||
|
*/
|
||||||
|
public function getMacrosCode(){
|
||||||
|
return $this->_macrosCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the macros certificate
|
||||||
|
*
|
||||||
|
* @param binary|null
|
||||||
|
*/
|
||||||
|
public function setMacrosCertificate($Certificate=NULL){
|
||||||
|
$this->_macrosCertificate=$Certificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the project signed ?
|
||||||
|
*
|
||||||
|
* @return true|false
|
||||||
|
*/
|
||||||
|
public function hasMacrosCertificate(){
|
||||||
|
return !is_null($this->_macrosCertificate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the macros certificate
|
||||||
|
*
|
||||||
|
* @return binary|null
|
||||||
|
*/
|
||||||
|
public function getMacrosCertificate(){
|
||||||
|
return $this->_macrosCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all macros, certificate from spreadsheet
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
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];
|
||||||
|
}//else $ReturnData stay at null
|
||||||
|
break;
|
||||||
|
}//default: $ReturnData at null
|
||||||
|
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 true|false
|
||||||
|
*/
|
||||||
|
public function hasRibbon(){
|
||||||
|
return !is_null($this->_ribbonXMLData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This workbook have additionnal object for the ribbon ?
|
||||||
|
*
|
||||||
|
* @return 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
|
* Create a new PHPExcel with one Worksheet
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->_uniqueID = uniqid();
|
||||||
|
$this->_calculationEngine = PHPExcel_Calculation::getInstance($this);
|
||||||
|
|
||||||
// Initialise worksheet collection and add one worksheet
|
// Initialise worksheet collection and add one worksheet
|
||||||
$this->_workSheetCollection = array();
|
$this->_workSheetCollection = array();
|
||||||
$this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
|
$this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
|
||||||
@ -126,13 +382,23 @@ class PHPExcel
|
|||||||
$this->addCellStyleXf(new PHPExcel_Style);
|
$this->addCellStyleXf(new PHPExcel_Style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code to execute when this worksheet is unset()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
PHPExcel_Calculation::unsetInstance($this);
|
||||||
|
$this->disconnectWorksheets();
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect all worksheets from this PHPExcel workbook object,
|
* Disconnect all worksheets from this PHPExcel workbook object,
|
||||||
* typically so that the PHPExcel object can be unset
|
* typically so that the PHPExcel object can be unset
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function disconnectWorksheets() {
|
public function disconnectWorksheets()
|
||||||
|
{
|
||||||
|
$worksheet = NULL;
|
||||||
foreach($this->_workSheetCollection as $k => &$worksheet) {
|
foreach($this->_workSheetCollection as $k => &$worksheet) {
|
||||||
$worksheet->disconnectCells();
|
$worksheet->disconnectCells();
|
||||||
$this->_workSheetCollection[$k] = null;
|
$this->_workSheetCollection[$k] = null;
|
||||||
@ -141,6 +407,16 @@ class PHPExcel
|
|||||||
$this->_workSheetCollection = array();
|
$this->_workSheetCollection = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the calculation engine for this worksheet
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Calculation
|
||||||
|
*/
|
||||||
|
public function getCalculationEngine()
|
||||||
|
{
|
||||||
|
return $this->_calculationEngine;
|
||||||
|
} // function getCellCacheController()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties
|
* Get properties
|
||||||
*
|
*
|
||||||
@ -196,7 +472,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function createSheet($iSheetIndex = NULL)
|
public function createSheet($iSheetIndex = NULL)
|
||||||
{
|
{
|
||||||
@ -206,7 +482,7 @@ class PHPExcel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chech if a sheet with a specified name already exists
|
* Check if a sheet with a specified name already exists
|
||||||
*
|
*
|
||||||
* @param string $pSheetName Name of the worksheet to check
|
* @param string $pSheetName Name of the worksheet to check
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@ -222,12 +498,14 @@ class PHPExcel
|
|||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
|
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
|
||||||
{
|
{
|
||||||
if ($this->sheetNameExists($pSheet->getTitle())) {
|
if ($this->sheetNameExists($pSheet->getTitle())) {
|
||||||
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
|
throw new PHPExcel_Exception(
|
||||||
|
"Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($iSheetIndex === NULL) {
|
if($iSheetIndex === NULL) {
|
||||||
@ -249,6 +527,11 @@ class PHPExcel
|
|||||||
++$this->_activeSheetIndex;
|
++$this->_activeSheetIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($pSheet->getParent() === null) {
|
||||||
|
$pSheet->rebindParent($this);
|
||||||
|
}
|
||||||
|
|
||||||
return $pSheet;
|
return $pSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,12 +539,17 @@ class PHPExcel
|
|||||||
* Remove sheet by index
|
* Remove sheet by index
|
||||||
*
|
*
|
||||||
* @param int $pIndex Active sheet index
|
* @param int $pIndex Active sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeSheetByIndex($pIndex = 0)
|
public function removeSheetByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
|
||||||
throw new Exception("Sheet index is out of bounds.");
|
$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 {
|
} else {
|
||||||
array_splice($this->_workSheetCollection, $pIndex, 1);
|
array_splice($this->_workSheetCollection, $pIndex, 1);
|
||||||
}
|
}
|
||||||
@ -278,12 +566,17 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param int $pIndex Sheet index
|
* @param int $pIndex Sheet index
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getSheet($pIndex = 0)
|
public function getSheet($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
|
||||||
throw new Exception("Sheet index is out of bounds.");
|
$numSheets = count($this->_workSheetCollection);
|
||||||
|
|
||||||
|
if ($pIndex > $numSheets - 1) {
|
||||||
|
throw new PHPExcel_Exception(
|
||||||
|
"Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}."
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return $this->_workSheetCollection[$pIndex];
|
return $this->_workSheetCollection[$pIndex];
|
||||||
}
|
}
|
||||||
@ -304,18 +597,17 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param string $pName Sheet name
|
* @param string $pName Sheet name
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function getSheetByName($pName = '')
|
public function getSheetByName($pName = '')
|
||||||
{
|
{
|
||||||
$worksheetCount = count($this->_workSheetCollection);
|
$worksheetCount = count($this->_workSheetCollection);
|
||||||
for ($i = 0; $i < $worksheetCount; ++$i) {
|
for ($i = 0; $i < $worksheetCount; ++$i) {
|
||||||
if ($this->_workSheetCollection[$i]->getTitle() == $pName) {
|
if ($this->_workSheetCollection[$i]->getTitle() === $pName) {
|
||||||
return $this->_workSheetCollection[$i];
|
return $this->_workSheetCollection[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,7 +615,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
* @return Sheet index
|
* @return Sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getIndex(PHPExcel_Worksheet $pSheet)
|
public function getIndex(PHPExcel_Worksheet $pSheet)
|
||||||
{
|
{
|
||||||
@ -332,6 +624,8 @@ class PHPExcel
|
|||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new PHPExcel_Exception("Sheet does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,7 +634,7 @@ class PHPExcel
|
|||||||
* @param string $sheetName Sheet name to modify index for
|
* @param string $sheetName Sheet name to modify index for
|
||||||
* @param int $newIndex New index for the sheet
|
* @param int $newIndex New index for the sheet
|
||||||
* @return New sheet index
|
* @return New sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function setIndexByName($sheetName, $newIndex)
|
public function setIndexByName($sheetName, $newIndex)
|
||||||
{
|
{
|
||||||
@ -383,13 +677,17 @@ class PHPExcel
|
|||||||
* Set active sheet index
|
* Set active sheet index
|
||||||
*
|
*
|
||||||
* @param int $pIndex Active sheet index
|
* @param int $pIndex Active sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setActiveSheetIndex($pIndex = 0)
|
public function setActiveSheetIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
$numSheets = count($this->_workSheetCollection);
|
||||||
throw new Exception("Active sheet index is out of bounds.");
|
|
||||||
|
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 {
|
} else {
|
||||||
$this->_activeSheetIndex = $pIndex;
|
$this->_activeSheetIndex = $pIndex;
|
||||||
}
|
}
|
||||||
@ -401,7 +699,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param string $pValue Sheet title
|
* @param string $pValue Sheet title
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function setActiveSheetIndexByName($pValue = '')
|
public function setActiveSheetIndexByName($pValue = '')
|
||||||
{
|
{
|
||||||
@ -410,7 +708,7 @@ class PHPExcel
|
|||||||
return $worksheet;
|
return $worksheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Workbook does not contain sheet:' . $pValue);
|
throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,12 +732,12 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet External sheet to add
|
* @param PHPExcel_Worksheet $pSheet External sheet to add
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
|
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
|
||||||
if ($this->sheetNameExists($pSheet->getTitle())) {
|
if ($this->sheetNameExists($pSheet->getTitle())) {
|
||||||
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
|
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
|
// count how many cellXfs there are in this workbook currently, we will need this below
|
||||||
@ -607,18 +905,29 @@ class PHPExcel
|
|||||||
return false;
|
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
|
* Get default style
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Style
|
* @return PHPExcel_Style
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getDefaultStyle()
|
public function getDefaultStyle()
|
||||||
{
|
{
|
||||||
if (isset($this->_cellXfCollection[0])) {
|
if (isset($this->_cellXfCollection[0])) {
|
||||||
return $this->_cellXfCollection[0];
|
return $this->_cellXfCollection[0];
|
||||||
}
|
}
|
||||||
throw new Exception('No default style found for this workbook');
|
throw new PHPExcel_Exception('No default style found for this workbook');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -636,12 +945,12 @@ class PHPExcel
|
|||||||
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
|
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
|
||||||
*
|
*
|
||||||
* @param int $pIndex Index to cellXf
|
* @param int $pIndex Index to cellXf
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeCellXfByIndex($pIndex = 0)
|
public function removeCellXfByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_cellXfCollection) - 1) {
|
if ($pIndex > count($this->_cellXfCollection) - 1) {
|
||||||
throw new Exception("CellXf index is out of bounds.");
|
throw new PHPExcel_Exception("CellXf index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
// first remove the cellXf
|
// first remove the cellXf
|
||||||
array_splice($this->_cellXfCollection, $pIndex, 1);
|
array_splice($this->_cellXfCollection, $pIndex, 1);
|
||||||
@ -725,12 +1034,12 @@ class PHPExcel
|
|||||||
* Remove cellStyleXf by index
|
* Remove cellStyleXf by index
|
||||||
*
|
*
|
||||||
* @param int $pIndex
|
* @param int $pIndex
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeCellStyleXfByIndex($pIndex = 0)
|
public function removeCellStyleXfByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
|
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
|
||||||
throw new Exception("CellStyleXf index is out of bounds.");
|
throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
|
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
|
||||||
}
|
}
|
||||||
@ -812,12 +1121,19 @@ class PHPExcel
|
|||||||
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
||||||
$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
|
$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// also do garbage collection for all the sheets
|
// also do garbage collection for all the sheets
|
||||||
foreach ($this->getWorksheetIterator() as $sheet) {
|
|
||||||
$sheet->garbageCollect();
|
$sheet->garbageCollect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the unique ID value assigned to this spreadsheet workbook
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getID() {
|
||||||
|
return $this->_uniqueID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,18 +20,18 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PHPExcel_Autoloader::Register();
|
PHPExcel_Autoloader::Register();
|
||||||
// As we always try to run the autoloader before anything else, we can use it to do a few
|
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||||
// simple checks and initialisations
|
// simple checks and initialisations
|
||||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
//PHPExcel_Shared_ZipStreamWrapper::register();
|
||||||
// check mbstring.func_overload
|
// check mbstring.func_overload
|
||||||
if (ini_get('mbstring.func_overload') & 2) {
|
if (ini_get('mbstring.func_overload') & 2) {
|
||||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||||
}
|
}
|
||||||
PHPExcel_Shared_String::buildCharacterSets();
|
PHPExcel_Shared_String::buildCharacterSets();
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ PHPExcel_Shared_String::buildCharacterSets();
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Autoloader
|
class PHPExcel_Autoloader
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ class PHPExcel_Autoloader
|
|||||||
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
||||||
'.php';
|
'.php';
|
||||||
|
|
||||||
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
|
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
|
||||||
// Can't load
|
// Can't load
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -58,15 +58,15 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
|
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -113,10 +113,10 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
}
|
}
|
||||||
// Check if the requested entry still exists in apc
|
// Check if the requested entry still exists in apc
|
||||||
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||||
if ($success === false) {
|
if ($success === FALSE) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -141,10 +141,10 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (parent::isDataSet($pCoord)) {
|
if (parent::isDataSet($pCoord)) {
|
||||||
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||||
if ($obj === false) {
|
if ($obj === FALSE) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
@ -154,20 +154,34 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->_currentObject = unserialize($obj);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
// Delete the entry from APC
|
// Delete the entry from APC
|
||||||
@ -183,6 +197,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
@ -194,14 +209,14 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
foreach($cacheList as $cellID) {
|
foreach($cacheList as $cellID) {
|
||||||
if ($cellID != $this->_currentObjectID) {
|
if ($cellID != $this->_currentObjectID) {
|
||||||
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
|
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
|
||||||
if ($obj === false) {
|
if ($obj === FALSE) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC');
|
||||||
}
|
}
|
||||||
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
|
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$cellID.' in APC');
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,13 +283,13 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
*/
|
*/
|
||||||
public static function cacheMethodIsAvailable() {
|
public static function cacheMethodIsAvailable() {
|
||||||
if (!function_exists('apc_store')) {
|
if (!function_exists('apc_store')) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (apc_sma_info() === false) {
|
if (apc_sma_info() === FALSE) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
||||||
|
|
||||||
@ -86,6 +86,16 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the parent worksheet for this cell collection
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return $this->_parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
@ -101,12 +111,33 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
} // function isDataSet()
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
if (isset($this->_cellCache[$fromAddress])) {
|
||||||
|
$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
|
||||||
|
unset($this->_cellCache[$fromAddress]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or Update a cell in cache
|
* Add or Update a cell in cache
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateCacheData(PHPExcel_Cell $cell) {
|
public function updateCacheData(PHPExcel_Cell $cell) {
|
||||||
return $this->addCacheData($cell->getCoordinate(),$cell);
|
return $this->addCacheData($cell->getCoordinate(),$cell);
|
||||||
@ -117,7 +148,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
@ -151,7 +182,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
public function getSortedCellList() {
|
public function getSortedCellList() {
|
||||||
$sortKeys = array();
|
$sortKeys = array();
|
||||||
foreach ($this->getCellList() as $coord) {
|
foreach ($this->getCellList() as $coord) {
|
||||||
list($column,$row) = sscanf($coord,'%[A-Z]%d');
|
sscanf($coord,'%[A-Z]%d', $column, $row);
|
||||||
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
|
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
|
||||||
}
|
}
|
||||||
ksort($sortKeys);
|
ksort($sortKeys);
|
||||||
@ -172,7 +203,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
$col = array('A' => '1A');
|
$col = array('A' => '1A');
|
||||||
$row = array(1);
|
$row = array(1);
|
||||||
foreach ($this->getCellList() as $coord) {
|
foreach ($this->getCellList() as $coord) {
|
||||||
list($c,$r) = sscanf($coord,'%[A-Z]%d');
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
$row[$r] = $r;
|
$row[$r] = $r;
|
||||||
$col[$c] = strlen($c).$c;
|
$col[$c] = strlen($c).$c;
|
||||||
}
|
}
|
||||||
@ -188,28 +219,89 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the cell address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentAddress()
|
||||||
|
{
|
||||||
|
return $this->_currentObjectID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the column address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentColumn()
|
||||||
|
{
|
||||||
|
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
|
return $column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the row address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentRow()
|
||||||
|
{
|
||||||
|
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get highest worksheet column
|
* 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
|
* @return string Highest column name
|
||||||
*/
|
*/
|
||||||
public function getHighestColumn()
|
public function getHighestColumn($row = null)
|
||||||
{
|
{
|
||||||
|
if ($row == null) {
|
||||||
$colRow = $this->getHighestRowAndColumn();
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
return $colRow['column'];
|
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
|
* 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
|
* @return int Highest row number
|
||||||
*/
|
*/
|
||||||
public function getHighestRow()
|
public function getHighestRow($column = null)
|
||||||
{
|
{
|
||||||
|
if ($column == null) {
|
||||||
$colRow = $this->getHighestRowAndColumn();
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
return $colRow['row'];
|
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
|
* Generate a unique ID for cache referencing
|
||||||
@ -232,9 +324,12 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
|
if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
|
||||||
$this->_currentObject->attach($parent);
|
$this->_currentObject->attach($this);
|
||||||
}
|
}
|
||||||
} // function copyCellCollection()
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -40,14 +40,14 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_fileName = null;
|
private $_fileName = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File handle for this cache file
|
* File handle for this cache file
|
||||||
*
|
*
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_fileHandle = null;
|
private $_fileHandle = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory/Folder where the cache file is located
|
* Directory/Folder where the cache file is located
|
||||||
@ -62,10 +62,10 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
fseek($this->_fileHandle,0,SEEK_END);
|
fseek($this->_fileHandle,0,SEEK_END);
|
||||||
@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -124,14 +124,28 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
|||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
||||||
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_CachedObjectStorage_ICache
|
interface PHPExcel_CachedObjectStorage_ICache
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell);
|
public function addCacheData($pCoord, PHPExcel_Cell $cell);
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateCacheData(PHPExcel_Cell $cell);
|
public function updateCacheData(PHPExcel_Cell $cell);
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to retrieve
|
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord);
|
public function getCacheData($pCoord);
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ interface PHPExcel_CachedObjectStorage_ICache
|
|||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord);
|
public function deleteCacheData($pCoord);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
|
$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
|
||||||
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]);
|
$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cell collection and disconnect from our parent
|
* Clear the cell collection and disconnect from our parent
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -62,17 +62,17 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$obj = serialize($this->_currentObject);
|
$obj = serialize($this->_currentObject);
|
||||||
if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
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)) {
|
if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
@ -87,7 +87,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -121,7 +121,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->_currentObject = unserialize($obj);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
// Delete the entry from Memcache
|
// Delete the entry from Memcache
|
||||||
@ -199,11 +213,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache');
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache');
|
||||||
}
|
}
|
||||||
if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$cellID.' in MemCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +264,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
// Set a new Memcache object and connect to the Memcache server
|
// Set a new Memcache object and connect to the Memcache server
|
||||||
$this->_memcache = new Memcache();
|
$this->_memcache = new Memcache();
|
||||||
if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
||||||
throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
|
throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
|
||||||
}
|
}
|
||||||
$this->_cacheTime = $cacheTime;
|
$this->_cacheTime = $cacheTime;
|
||||||
|
|
||||||
@ -264,10 +278,10 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
|||||||
*
|
*
|
||||||
* @param string $host Memcache server
|
* @param string $host Memcache server
|
||||||
* @param integer $port Memcache port
|
* @param integer $port Memcache port
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function failureCallback($host, $port) {
|
public function failureCallback($host, $port) {
|
||||||
throw new Exception('memcache '.$host.':'.$port.' failed');
|
throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,20 +31,32 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy method callable from CacheBase, but unused by Memory cache
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return PHPExcel_Cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
$this->_cellCache[$pCoord] = $cell;
|
$this->_cellCache[$pCoord] = $cell;
|
||||||
|
|
||||||
|
// Set current entry to the new/updated entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
return $cell;
|
return $cell;
|
||||||
} // function addCacheData()
|
} // function addCacheData()
|
||||||
|
|
||||||
@ -53,16 +65,20 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
// Check if the entry that has been requested actually exists
|
// Check if the entry that has been requested actually exists
|
||||||
if (!isset($this->_cellCache[$pCoord])) {
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
$this->_currentObjectID = NULL;
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_cellCache[$pCoord];
|
return $this->_cellCache[$pCoord];
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
@ -80,7 +96,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
|||||||
$newCollection = array();
|
$newCollection = array();
|
||||||
foreach($this->_cellCache as $k => &$cell) {
|
foreach($this->_cellCache as $k => &$cell) {
|
||||||
$newCollection[$k] = clone $cell;
|
$newCollection[$k] = clone $cell;
|
||||||
$newCollection[$k]->attach($parent);
|
$newCollection[$k]->attach($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_cellCache = $newCollection;
|
$this->_cellCache = $newCollection;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject));
|
$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject));
|
||||||
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord]));
|
$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord]));
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cell collection and disconnect from our parent
|
* Clear the cell collection and disconnect from our parent
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
|
$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
|
||||||
@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($this->_cellCache[$pCoord]);
|
$this->_currentObject = unserialize($this->_cellCache[$pCoord]);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cell collection and disconnect from our parent
|
* Clear the cell collection and disconnect from our parent
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -54,10 +54,10 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
fseek($this->_fileHandle,0,SEEK_END);
|
fseek($this->_fileHandle,0,SEEK_END);
|
||||||
@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -97,7 +97,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -116,14 +116,28 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
|
|||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
||||||
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -54,14 +54,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
|
if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
@ -74,7 +74,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -93,7 +93,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
@ -116,8 +116,8 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
|
|
||||||
$cellResult = $cellResultSet->fetchSingle();
|
$cellResult = $cellResultSet->fetchSingle();
|
||||||
$this->_currentObject = unserialize($cellResult);
|
$this->_currentObject = unserialize($cellResult);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
@ -139,7 +139,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return false;
|
return false;
|
||||||
@ -152,7 +152,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
@ -163,22 +163,52 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
if (!$this->_DBHandle->queryExec($query))
|
if (!$this->_DBHandle->queryExec($query))
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
} // function deleteCacheData()
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'";
|
||||||
|
$result = $this->_DBHandle->exec($query);
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
||||||
|
$result = $this->_DBHandle->exec($query);
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all cell addresses currently held in cache
|
* Get a list of all cell addresses currently held in cache
|
||||||
*
|
*
|
||||||
* @return array of string
|
* @return array of string
|
||||||
*/
|
*/
|
||||||
public function getCellList() {
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||||
$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
|
$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
|
||||||
if ($cellIdsResult === false)
|
if ($cellIdsResult === false)
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
$cellKeys = array();
|
$cellKeys = array();
|
||||||
foreach($cellIdsResult as $row) {
|
foreach($cellIdsResult as $row) {
|
||||||
@ -196,11 +226,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
// Get a new id for the new table name
|
// Get a new id for the new table name
|
||||||
$tableName = str_replace('.','_',$this->_getUniqueID());
|
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_'.$this->_TableName))
|
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
// Copy the existing cell cache file
|
// Copy the existing cell cache file
|
||||||
$this->_TableName = $tableName;
|
$this->_TableName = $tableName;
|
||||||
@ -238,9 +271,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
|
|
||||||
$this->_DBHandle = new SQLiteDatabase($_DBName);
|
$this->_DBHandle = new SQLiteDatabase($_DBName);
|
||||||
if ($this->_DBHandle === false)
|
if ($this->_DBHandle === false)
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||||
throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
@ -249,6 +282,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
|||||||
* Destroy this cell collection
|
* Destroy this cell collection
|
||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
|
if (!is_null($this->_DBHandle)) {
|
||||||
|
$this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName);
|
||||||
|
}
|
||||||
$this->_DBHandle = null;
|
$this->_DBHandle = null;
|
||||||
} // function __destruct()
|
} // function __destruct()
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -49,23 +49,50 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
*/
|
*/
|
||||||
private $_DBHandle = null;
|
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",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$query = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
|
$this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
|
||||||
$query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
|
$this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
|
||||||
$query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
|
$result = $this->_insertQuery->execute();
|
||||||
$result = $query->execute();
|
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
@ -78,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -97,7 +124,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -106,21 +133,23 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
}
|
}
|
||||||
$this->_storeData();
|
$this->_storeData();
|
||||||
|
|
||||||
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
$cellResult = $this->_DBHandle->querySingle($query);
|
$cellResult = $this->_selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === FALSE) {
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
} elseif (is_null($cellResult)) {
|
}
|
||||||
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
if ($cellData === FALSE) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
$this->_currentObject = unserialize($cellResult);
|
$this->_currentObject = unserialize($cellData['value']);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
@ -135,19 +164,18 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord) {
|
public function isDataSet($pCoord) {
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
$cellResult = $this->_DBHandle->querySingle($query);
|
$cellResult = $this->_selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === FALSE) {
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
} elseif (is_null($cellResult)) {
|
|
||||||
// Return null if requested entry doesn't exist in cache
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
return ($cellData === FALSE) ? FALSE : TRUE;
|
||||||
} // function isDataSet()
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
@ -155,34 +183,65 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
if ($pCoord === $this->_currentObjectID) {
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
$this->_currentObjectID = $this->_currentObject = null;
|
$this->_currentObjectID = $this->_currentObject = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
$result = $this->_DBHandle->exec($query);
|
$result = $this->_deleteQuery->execute();
|
||||||
if ($result === false)
|
if ($result === FALSE)
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = FALSE;
|
||||||
} // function deleteCacheData()
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT);
|
||||||
|
$result = $this->_deleteQuery->execute();
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT);
|
||||||
|
$this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT);
|
||||||
|
$result = $this->_updateQuery->execute();
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all cell addresses currently held in cache
|
* Get a list of all cell addresses currently held in cache
|
||||||
*
|
*
|
||||||
* @return array of string
|
* @return array of string
|
||||||
*/
|
*/
|
||||||
public function getCellList() {
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
$query = "SELECT id FROM kvp_".$this->_TableName;
|
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||||
$cellIdsResult = $this->_DBHandle->query($query);
|
$cellIdsResult = $this->_DBHandle->query($query);
|
||||||
if ($cellIdsResult === false)
|
if ($cellIdsResult === false)
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
$cellKeys = array();
|
$cellKeys = array();
|
||||||
while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
|
while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
|
||||||
@ -200,11 +259,14 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
// Get a new id for the new table name
|
// Get a new id for the new table name
|
||||||
$tableName = str_replace('.','_',$this->_getUniqueID());
|
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_'.$this->_TableName))
|
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
// Copy the existing cell cache file
|
// Copy the existing cell cache file
|
||||||
$this->_TableName = $tableName;
|
$this->_TableName = $tableName;
|
||||||
@ -242,10 +304,15 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
|
|
||||||
$this->_DBHandle = new SQLite3($_DBName);
|
$this->_DBHandle = new SQLite3($_DBName);
|
||||||
if ($this->_DBHandle === false)
|
if ($this->_DBHandle === false)
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||||
throw new Exception($this->_DBHandle->lastErrorMsg());
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||||
|
$this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
|
||||||
|
$this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId");
|
||||||
|
$this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
@ -254,6 +321,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
|||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
if (!is_null($this->_DBHandle)) {
|
if (!is_null($this->_DBHandle)) {
|
||||||
|
$this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName);
|
||||||
$this->_DBHandle->close();
|
$this->_DBHandle->close();
|
||||||
}
|
}
|
||||||
$this->_DBHandle = null;
|
$this->_DBHandle = null;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
@ -55,22 +55,22 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _storeData() {
|
protected function _storeData() {
|
||||||
if ($this->_currentCellIsDirty) {
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
$obj = serialize($this->_currentObject);
|
$obj = serialize($this->_currentObject);
|
||||||
if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
|
if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
|
||||||
if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_currentCellIsDirty = false;
|
$this->_currentCellIsDirty = false;
|
||||||
@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param PHPExcel_Cell $cell Cell to update
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
@ -119,7 +119,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Wincache, so clear it from the cache array
|
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord) {
|
public function getCacheData($pCoord) {
|
||||||
@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
// Set current entry to the requested entry
|
// Set current entry to the requested entry
|
||||||
$this->_currentObjectID = $pCoord;
|
$this->_currentObjectID = $pCoord;
|
||||||
$this->_currentObject = unserialize($obj);
|
$this->_currentObject = unserialize($obj);
|
||||||
// Re-attach the parent worksheet
|
// Re-attach this as the cell's parent
|
||||||
$this->_currentObject->attach($this->_parent);
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
// Return requested entry
|
// Return requested entry
|
||||||
return $this->_currentObject;
|
return $this->_currentObject;
|
||||||
} // function getCacheData()
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord) {
|
public function deleteCacheData($pCoord) {
|
||||||
// Delete the entry from Wincache
|
// Delete the entry from Wincache
|
||||||
@ -200,11 +214,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
|||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||||
}
|
}
|
||||||
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
|
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new Exception('Failed to store cell '.$cellID.' in Wincache');
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,10 +20,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +32,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_CachedObjectStorage
|
* @package PHPExcel_CachedObjectStorage
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_CachedObjectStorageFactory
|
class PHPExcel_CachedObjectStorageFactory
|
||||||
{
|
{
|
||||||
@ -198,7 +198,7 @@ class PHPExcel_CachedObjectStorageFactory
|
|||||||
|
|
||||||
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
||||||
foreach($arguments as $k => $v) {
|
foreach($arguments as $k => $v) {
|
||||||
if (isset(self::$_storageMethodParameters[$method][$k])) {
|
if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
|
||||||
self::$_storageMethodParameters[$method][$k] = $v;
|
self::$_storageMethodParameters[$method][$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,4 +236,16 @@ class PHPExcel_CachedObjectStorageFactory
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
} // function getInstance()
|
} // function getInstance()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cache storage
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
public static function finalize()
|
||||||
|
{
|
||||||
|
self::$_cacheStorageMethod = NULL;
|
||||||
|
self::$_cacheStorageClass = NULL;
|
||||||
|
self::$_storageMethodParameters = array();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
*
|
||||||
|
* @category PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CalcEngine_CyclicReferenceStack {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The call stack for calculated cells
|
||||||
|
*
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
private $_stack = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of entries on the stack
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function count() {
|
||||||
|
return count($this->_stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Push a new entry onto the stack
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
*/
|
||||||
|
public function push($value) {
|
||||||
|
$this->_stack[] = $value;
|
||||||
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop the last entry from the stack
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function pop() {
|
||||||
|
return array_pop($this->_stack);
|
||||||
|
} // function pop()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to see if a specified entry exists on the stack
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to test
|
||||||
|
*/
|
||||||
|
public function onStack($value) {
|
||||||
|
return in_array($value, $this->_stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the stack
|
||||||
|
*/
|
||||||
|
public function clear() {
|
||||||
|
$this->_stack = array();
|
||||||
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of all entries on the stack
|
||||||
|
*
|
||||||
|
* @return mixed[]
|
||||||
|
*/
|
||||||
|
public function showStack() {
|
||||||
|
return $this->_stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
153
htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php
Normal file
153
htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CalcEngine_Logger
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CalcEngine_Logger {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to determine whether a debug log should be generated by the calculation engine
|
||||||
|
* If true, then a debug log will be generated
|
||||||
|
* If false, then a debug log will not be generated
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_writeDebugLog = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||||
|
* If true, then a debug log will be echoed
|
||||||
|
* If false, then a debug log will not be echoed
|
||||||
|
* A debug log can only be echoed if it is generated
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_echoDebugLog = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The debug log generated by the calculation engine
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private $_debugLog = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calculation engine cell reference stack
|
||||||
|
*
|
||||||
|
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
*/
|
||||||
|
private $_cellStack;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a Calculation engine logger
|
||||||
|
*
|
||||||
|
* @param PHPExcel_CalcEngine_CyclicReferenceStack $stack
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) {
|
||||||
|
$this->_cellStack = $stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable Calculation engine logging
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*/
|
||||||
|
public function setWriteDebugLog($pValue = FALSE) {
|
||||||
|
$this->_writeDebugLog = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether calculation engine logging is enabled or disabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getWriteDebugLog() {
|
||||||
|
return $this->_writeDebugLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable echoing of debug log information
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*/
|
||||||
|
public function setEchoDebugLog($pValue = FALSE) {
|
||||||
|
$this->_echoDebugLog = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether echoing of debug log information is enabled or disabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getEchoDebugLog() {
|
||||||
|
return $this->_echoDebugLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an entry to the calculation engine debug log
|
||||||
|
*/
|
||||||
|
public function writeDebugLog() {
|
||||||
|
// Only write the debug log if logging is enabled
|
||||||
|
if ($this->_writeDebugLog) {
|
||||||
|
$message = implode(func_get_args());
|
||||||
|
$cellReference = implode(' -> ', $this->_cellStack->showStack());
|
||||||
|
if ($this->_echoDebugLog) {
|
||||||
|
echo $cellReference,
|
||||||
|
($this->_cellStack->count() > 0 ? ' => ' : ''),
|
||||||
|
$message,
|
||||||
|
PHP_EOL;
|
||||||
|
}
|
||||||
|
$this->_debugLog[] = $cellReference .
|
||||||
|
($this->_cellStack->count() > 0 ? ' => ' : '') .
|
||||||
|
$message;
|
||||||
|
}
|
||||||
|
} // function _writeDebug()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the calculation engine debug log
|
||||||
|
*/
|
||||||
|
public function clearLog() {
|
||||||
|
$this->_debugLog = array();
|
||||||
|
} // function flushLogger()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the calculation engine debug log
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getLog() {
|
||||||
|
return $this->_debugLog;
|
||||||
|
} // function flushLogger()
|
||||||
|
|
||||||
|
} // class PHPExcel_CalcEngine_Logger
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Database {
|
class PHPExcel_Calculation_Database {
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_DateTime {
|
class PHPExcel_Calculation_DateTime {
|
||||||
|
|
||||||
@ -56,6 +56,18 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
} // function _isLeapYear()
|
} // function _isLeapYear()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of days between two dates based on a 360 day calendar
|
||||||
|
*
|
||||||
|
* @param integer $startDay Day of month of the start date
|
||||||
|
* @param integer $startMonth Month of the start date
|
||||||
|
* @param integer $startYear Year of the start date
|
||||||
|
* @param integer $endDay Day of month of the start date
|
||||||
|
* @param integer $endMonth Month of the start date
|
||||||
|
* @param integer $endYear Year of the start date
|
||||||
|
* @param boolean $methodUS Whether to use the US method or the European method of calculation
|
||||||
|
* @return integer Number of days between the start date and the end date
|
||||||
|
*/
|
||||||
private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
|
private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
|
||||||
if ($startDay == 31) {
|
if ($startDay == 31) {
|
||||||
--$startDay;
|
--$startDay;
|
||||||
@ -92,7 +104,7 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
|
(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||||
$dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
|
$dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
|
||||||
} else {
|
} else {
|
||||||
$saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
$saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||||
@ -238,6 +250,10 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DATE(year,month,day)
|
* DATE(year,month,day)
|
||||||
*
|
*
|
||||||
|
* PHPExcel is a lot more forgiving than MS Excel when passing non numeric values to this function.
|
||||||
|
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
|
||||||
|
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Date/Time Functions
|
* @category Date/Time Functions
|
||||||
* @param integer $year The value of the year argument can include one to four digits.
|
* @param integer $year The value of the year argument can include one to four digits.
|
||||||
@ -278,6 +294,14 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
||||||
$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
||||||
|
|
||||||
|
if (($month !== NULL) && (!is_numeric($month))) {
|
||||||
|
$month = PHPExcel_Shared_Date::monthStringToNumber($month);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($day !== NULL) && (!is_numeric($day))) {
|
||||||
|
$day = PHPExcel_Shared_Date::dayStringToNumber($day);
|
||||||
|
}
|
||||||
|
|
||||||
$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
|
$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
|
||||||
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
||||||
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
||||||
@ -720,6 +744,10 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_bool($method)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
$PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
|
||||||
$startDay = $PHPStartDateObject->format('j');
|
$startDay = $PHPStartDateObject->format('j');
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ define('EULER', 2.71828182845904523536);
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Engineering {
|
class PHPExcel_Calculation_Engineering {
|
||||||
|
|
||||||
@ -741,8 +741,6 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _cleanComplex
|
|
||||||
*
|
|
||||||
* Cleans the leading characters in a complex number string
|
* Cleans the leading characters in a complex number string
|
||||||
*
|
*
|
||||||
* @param string $complexNumber The complex number to clean
|
* @param string $complexNumber The complex number to clean
|
||||||
@ -756,20 +754,25 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
return $complexNumber;
|
return $complexNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
private static function _nbrConversionFormat($xVal,$places) {
|
* Formats a number base string value with leading zeroes
|
||||||
|
*
|
||||||
|
* @param string $xVal The "number" to pad
|
||||||
|
* @param integer $places The length that we want to pad this value
|
||||||
|
* @return string The padded "number"
|
||||||
|
*/
|
||||||
|
private static function _nbrConversionFormat($xVal, $places) {
|
||||||
if (!is_null($places)) {
|
if (!is_null($places)) {
|
||||||
if (strlen($xVal) <= $places) {
|
if (strlen($xVal) <= $places) {
|
||||||
return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10);
|
return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
|
||||||
} else {
|
} else {
|
||||||
return PHPExcel_Calculation_Functions::NaN();
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return substr($xVal,-10);
|
return substr($xVal, -10);
|
||||||
} // function _nbrConversionFormat()
|
} // function _nbrConversionFormat()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BESSELI
|
* BESSELI
|
||||||
*
|
*
|
||||||
@ -1932,7 +1935,7 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
/**
|
/**
|
||||||
* IMLOG2
|
* IMLOG2
|
||||||
*
|
*
|
||||||
* Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
|
* Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* IMLOG2(complexNumber)
|
* IMLOG2(complexNumber)
|
||||||
@ -2356,7 +2359,6 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
* Returns an array of units of measure, for a specified conversion group, or for all groups
|
* 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
|
* @param string $group The group whose units of measure you want to retrieve
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getConversionGroupUnits($group = NULL) {
|
public static function getConversionGroupUnits($group = NULL) {
|
||||||
@ -2373,6 +2375,7 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
/**
|
/**
|
||||||
* getConversionGroupUnitDetails
|
* getConversionGroupUnitDetails
|
||||||
*
|
*
|
||||||
|
* @param string $group The group whose units of measure you want to retrieve
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getConversionGroupUnitDetails($group = NULL) {
|
public static function getConversionGroupUnitDetails($group = NULL) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,9 +31,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Exception extends Exception {
|
class PHPExcel_Calculation_Exception extends PHPExcel_Exception {
|
||||||
/**
|
/**
|
||||||
* Error handler callback
|
* Error handler callback
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_ExceptionHandler {
|
class PHPExcel_Calculation_ExceptionHandler {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ define('FINANCIAL_PRECISION', 1.0e-08);
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Financial {
|
class PHPExcel_Calculation_Financial {
|
||||||
|
|
||||||
@ -1206,13 +1206,22 @@ class PHPExcel_Calculation_Financial {
|
|||||||
/**
|
/**
|
||||||
* FVSCHEDULE
|
* 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) {
|
public static function FVSCHEDULE($principal, $schedule) {
|
||||||
$principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
|
$principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
|
||||||
$schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
|
$schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
|
||||||
|
|
||||||
foreach($schedule as $n) {
|
foreach($schedule as $rate) {
|
||||||
$principal *= 1 + $n;
|
$principal *= 1 + $rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $principal;
|
return $principal;
|
||||||
@ -1227,13 +1236,13 @@ class PHPExcel_Calculation_Financial {
|
|||||||
* Excel Function:
|
* Excel Function:
|
||||||
* INTRATE(settlement,maturity,investment,redemption[,basis])
|
* INTRATE(settlement,maturity,investment,redemption[,basis])
|
||||||
*
|
*
|
||||||
* @param mixed settlement The security's settlement date.
|
* @param mixed $settlement The security's settlement date.
|
||||||
* The security settlement date is the date after the issue date when the security is traded to the buyer.
|
* The security settlement date is the date after the issue date when the security is traded to the buyer.
|
||||||
* @param mixed maturity The security's maturity date.
|
* @param mixed $maturity The security's maturity date.
|
||||||
* The maturity date is the date when the security expires.
|
* The maturity date is the date when the security expires.
|
||||||
* @param integer investment The amount invested in the security.
|
* @param integer $investment The amount invested in the security.
|
||||||
* @param integer redemption The amount to be received at maturity.
|
* @param integer $redemption The amount to be received at maturity.
|
||||||
* @param integer basis The type of day count to use.
|
* @param integer $basis The type of day count to use.
|
||||||
* 0 or omitted US (NASD) 30/360
|
* 0 or omitted US (NASD) 30/360
|
||||||
* 1 Actual/actual
|
* 1 Actual/actual
|
||||||
* 2 Actual/360
|
* 2 Actual/360
|
||||||
@ -1273,6 +1282,9 @@ class PHPExcel_Calculation_Financial {
|
|||||||
*
|
*
|
||||||
* Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
|
* 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 float $rate Interest rate per period
|
||||||
* @param int $per Period for which we want to find the interest
|
* @param int $per Period for which we want to find the interest
|
||||||
* @param int $nper Number of periods
|
* @param int $nper Number of periods
|
||||||
@ -1302,7 +1314,25 @@ class PHPExcel_Calculation_Financial {
|
|||||||
return $interestAndPrincipal[0];
|
return $interestAndPrincipal[0];
|
||||||
} // function IPMT()
|
} // function IPMT()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IRR
|
||||||
|
*
|
||||||
|
* Returns the internal rate of return for a series of cash flows represented by the numbers in values.
|
||||||
|
* These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
|
||||||
|
* at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
|
||||||
|
* for an investment consisting of payments (negative values) and income (positive values) that occur at regular
|
||||||
|
* periods.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* IRR(values[,guess])
|
||||||
|
*
|
||||||
|
* @param float[] $values An array or a reference to cells that contain numbers for which you want
|
||||||
|
* to calculate the internal rate of return.
|
||||||
|
* Values must contain at least one positive value and one negative value to
|
||||||
|
* calculate the internal rate of return.
|
||||||
|
* @param float $guess A number that you guess is close to the result of IRR
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
public static function IRR($values, $guess = 0.1) {
|
public static function IRR($values, $guess = 0.1) {
|
||||||
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
||||||
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
||||||
@ -1336,8 +1366,10 @@ class PHPExcel_Calculation_Financial {
|
|||||||
$dx *= 0.5;
|
$dx *= 0.5;
|
||||||
$x_mid = $rtb + $dx;
|
$x_mid = $rtb + $dx;
|
||||||
$f_mid = self::NPV($x_mid, $values);
|
$f_mid = self::NPV($x_mid, $values);
|
||||||
if ($f_mid <= 0.0) $rtb = $x_mid;
|
if ($f_mid <= 0.0)
|
||||||
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
|
$rtb = $x_mid;
|
||||||
|
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION))
|
||||||
|
return $x_mid;
|
||||||
}
|
}
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
} // function IRR()
|
} // function IRR()
|
||||||
@ -1384,6 +1416,22 @@ class PHPExcel_Calculation_Financial {
|
|||||||
} // function ISPMT()
|
} // function ISPMT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MIRR
|
||||||
|
*
|
||||||
|
* Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
|
||||||
|
* the cost of the investment and the interest received on reinvestment of cash.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* MIRR(values,finance_rate, reinvestment_rate)
|
||||||
|
*
|
||||||
|
* @param float[] $values An array or a reference to cells that contain a series of payments and
|
||||||
|
* income occurring at regular intervals.
|
||||||
|
* Payments are negative value, income is positive values.
|
||||||
|
* @param float $finance_rate The interest rate you pay on the money used in the cash flows
|
||||||
|
* @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
public static function MIRR($values, $finance_rate, $reinvestment_rate) {
|
public static function MIRR($values, $finance_rate, $reinvestment_rate) {
|
||||||
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
|
||||||
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
$values = PHPExcel_Calculation_Functions::flattenArray($values);
|
||||||
@ -1475,14 +1523,11 @@ class PHPExcel_Calculation_Financial {
|
|||||||
}
|
}
|
||||||
} // function NPER()
|
} // function NPER()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NPV
|
* NPV
|
||||||
*
|
*
|
||||||
* Returns the Net Present Value of a cash flow series given a discount rate.
|
* Returns the Net Present Value of a cash flow series given a discount rate.
|
||||||
*
|
*
|
||||||
* @param float Discount interest rate
|
|
||||||
* @param array Cash flow series
|
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function NPV() {
|
public static function NPV() {
|
||||||
@ -1505,7 +1550,6 @@ class PHPExcel_Calculation_Financial {
|
|||||||
return $returnValue;
|
return $returnValue;
|
||||||
} // function NPV()
|
} // function NPV()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PMT
|
* PMT
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ PARTLY BASED ON:
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_FormulaParser {
|
class PHPExcel_Calculation_FormulaParser {
|
||||||
/* Character constants */
|
/* Character constants */
|
||||||
@ -93,13 +93,13 @@ class PHPExcel_Calculation_FormulaParser {
|
|||||||
* Create a new PHPExcel_Calculation_FormulaParser
|
* Create a new PHPExcel_Calculation_FormulaParser
|
||||||
*
|
*
|
||||||
* @param string $pFormula Formula to parse
|
* @param string $pFormula Formula to parse
|
||||||
* @throws Exception
|
* @throws PHPExcel_Calculation_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pFormula = '')
|
public function __construct($pFormula = '')
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (is_null($pFormula)) {
|
if (is_null($pFormula)) {
|
||||||
throw new Exception("Invalid parameter passed: formula");
|
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise values
|
// Initialise values
|
||||||
@ -122,13 +122,13 @@ class PHPExcel_Calculation_FormulaParser {
|
|||||||
*
|
*
|
||||||
* @param int $pId Token id
|
* @param int $pId Token id
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws PHPExcel_Calculation_Exception
|
||||||
*/
|
*/
|
||||||
public function getToken($pId = 0) {
|
public function getToken($pId = 0) {
|
||||||
if (isset($this->_tokens[$pId])) {
|
if (isset($this->_tokens[$pId])) {
|
||||||
return $this->_tokens[$pId];
|
return $this->_tokens[$pId];
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Token with id $pId does not exist.");
|
throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ PARTLY BASED ON:
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_FormulaToken {
|
class PHPExcel_Calculation_FormulaToken {
|
||||||
/* Token types */
|
/* Token types */
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Function {
|
class PHPExcel_Calculation_Function {
|
||||||
/* Function categories */
|
/* Function categories */
|
||||||
@ -74,7 +74,7 @@ class PHPExcel_Calculation_Function {
|
|||||||
* @param string $pCategory Category (represented by CATEGORY_*)
|
* @param string $pCategory Category (represented by CATEGORY_*)
|
||||||
* @param string $pExcelName Excel function name
|
* @param string $pExcelName Excel function name
|
||||||
* @param string $pPHPExcelName PHPExcel function mapping
|
* @param string $pPHPExcelName PHPExcel function mapping
|
||||||
* @throws Exception
|
* @throws PHPExcel_Calculation_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ class PHPExcel_Calculation_Function {
|
|||||||
$this->_excelName = $pExcelName;
|
$this->_excelName = $pExcelName;
|
||||||
$this->_phpExcelName = $pPHPExcelName;
|
$this->_phpExcelName = $pPHPExcelName;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Invalid parameters passed.");
|
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,13 +101,13 @@ class PHPExcel_Calculation_Function {
|
|||||||
* Set Category (represented by CATEGORY_*)
|
* Set Category (represented by CATEGORY_*)
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @throws Exception
|
* @throws PHPExcel_Calculation_Exception
|
||||||
*/
|
*/
|
||||||
public function setCategory($value = null) {
|
public function setCategory($value = null) {
|
||||||
if (!is_null($value)) {
|
if (!is_null($value)) {
|
||||||
$this->_category = $value;
|
$this->_category = $value;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Invalid parameter passed.");
|
throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ define('PRECISION', 8.88E-016);
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Functions {
|
class PHPExcel_Calculation_Functions {
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ class PHPExcel_Calculation_Functions {
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Error Returns
|
* @category Error Returns
|
||||||
* @return string #REF!
|
* @return string #NULL!
|
||||||
*/
|
*/
|
||||||
public static function NULL() {
|
public static function NULL() {
|
||||||
return self::$_errorCodes['null'];
|
return self::$_errorCodes['null'];
|
||||||
@ -308,13 +308,20 @@ class PHPExcel_Calculation_Functions {
|
|||||||
|
|
||||||
public static function _ifCondition($condition) {
|
public static function _ifCondition($condition) {
|
||||||
$condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
$condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||||
|
if (!isset($condition{0}))
|
||||||
|
$condition = '=""';
|
||||||
if (!in_array($condition{0},array('>', '<', '='))) {
|
if (!in_array($condition{0},array('>', '<', '='))) {
|
||||||
if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); }
|
if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); }
|
||||||
return '='.$condition;
|
return '='.$condition;
|
||||||
} else {
|
} else {
|
||||||
preg_match('/([<>=]+)(.*)/',$condition,$matches);
|
preg_match('/([<>=]+)(.*)/',$condition,$matches);
|
||||||
list(,$operator,$operand) = $matches;
|
list(,$operator,$operand) = $matches;
|
||||||
if (!is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); }
|
|
||||||
|
if (!is_numeric($operand)) {
|
||||||
|
$operand = str_replace('"', '""', $operand);
|
||||||
|
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand));
|
||||||
|
}
|
||||||
|
|
||||||
return $operator.$operand;
|
return $operator.$operand;
|
||||||
}
|
}
|
||||||
} // function _ifCondition()
|
} // function _ifCondition()
|
||||||
@ -489,7 +496,7 @@ class PHPExcel_Calculation_Functions {
|
|||||||
* @return string Version information
|
* @return string Version information
|
||||||
*/
|
*/
|
||||||
public static function VERSION() {
|
public static function VERSION() {
|
||||||
return 'PHPExcel 1.7.8, 2012-10-12';
|
return 'PHPExcel 1.8.0, 2014-03-02';
|
||||||
} // function VERSION()
|
} // function VERSION()
|
||||||
|
|
||||||
|
|
||||||
@ -687,100 +694,6 @@ if (!function_exists('atanh')) {
|
|||||||
} // function atanh()
|
} // function atanh()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('money_format')) {
|
|
||||||
function money_format($format, $number) {
|
|
||||||
$regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?',
|
|
||||||
'(?:\.([0-9]+))?([in%])/'
|
|
||||||
);
|
|
||||||
$regex = implode('', $regex);
|
|
||||||
if (setlocale(LC_MONETARY, null) == '') {
|
|
||||||
setlocale(LC_MONETARY, '');
|
|
||||||
}
|
|
||||||
$locale = localeconv();
|
|
||||||
$number = floatval($number);
|
|
||||||
if (!preg_match($regex, $format, $fmatch)) {
|
|
||||||
trigger_error("No format specified or invalid format", E_USER_WARNING);
|
|
||||||
return $number;
|
|
||||||
}
|
|
||||||
$flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ',
|
|
||||||
'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
|
|
||||||
'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+',
|
|
||||||
'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
|
|
||||||
'isleft' => preg_match('/\-/', $fmatch[1]) > 0
|
|
||||||
);
|
|
||||||
$width = trim($fmatch[2]) ? (int)$fmatch[2] : 0;
|
|
||||||
$left = trim($fmatch[3]) ? (int)$fmatch[3] : 0;
|
|
||||||
$right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits'];
|
|
||||||
$conversion = $fmatch[5];
|
|
||||||
$positive = true;
|
|
||||||
if ($number < 0) {
|
|
||||||
$positive = false;
|
|
||||||
$number *= -1;
|
|
||||||
}
|
|
||||||
$letter = $positive ? 'p' : 'n';
|
|
||||||
$prefix = $suffix = $cprefix = $csuffix = $signal = '';
|
|
||||||
if (!$positive) {
|
|
||||||
$signal = $locale['negative_sign'];
|
|
||||||
switch (true) {
|
|
||||||
case $locale['n_sign_posn'] == 0 || $flags['usesignal'] == '(':
|
|
||||||
$prefix = '(';
|
|
||||||
$suffix = ')';
|
|
||||||
break;
|
|
||||||
case $locale['n_sign_posn'] == 1:
|
|
||||||
$prefix = $signal;
|
|
||||||
break;
|
|
||||||
case $locale['n_sign_posn'] == 2:
|
|
||||||
$suffix = $signal;
|
|
||||||
break;
|
|
||||||
case $locale['n_sign_posn'] == 3:
|
|
||||||
$cprefix = $signal;
|
|
||||||
break;
|
|
||||||
case $locale['n_sign_posn'] == 4:
|
|
||||||
$csuffix = $signal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$flags['nosimbol']) {
|
|
||||||
$currency = $cprefix;
|
|
||||||
$currency .= ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']);
|
|
||||||
$currency .= $csuffix;
|
|
||||||
$currency = iconv('ISO-8859-1','UTF-8',$currency);
|
|
||||||
} else {
|
|
||||||
$currency = '';
|
|
||||||
}
|
|
||||||
$space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
|
|
||||||
|
|
||||||
if (!isset($locale['mon_decimal_point']) || empty($locale['mon_decimal_point'])) {
|
|
||||||
$locale['mon_decimal_point'] = (!isset($locale['decimal_point']) || empty($locale['decimal_point'])) ?
|
|
||||||
$locale['decimal_point'] :
|
|
||||||
'.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep'] );
|
|
||||||
$number = explode($locale['mon_decimal_point'], $number);
|
|
||||||
|
|
||||||
$n = strlen($prefix) + strlen($currency);
|
|
||||||
if ($left > 0 && $left > $n) {
|
|
||||||
if ($flags['isleft']) {
|
|
||||||
$number[0] .= str_repeat($flags['fillchar'], $left - $n);
|
|
||||||
} else {
|
|
||||||
$number[0] = str_repeat($flags['fillchar'], $left - $n) . $number[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$number = implode($locale['mon_decimal_point'], $number);
|
|
||||||
if ($locale["{$letter}_cs_precedes"]) {
|
|
||||||
$number = $prefix . $currency . $space . $number . $suffix;
|
|
||||||
} else {
|
|
||||||
$number = $prefix . $number . $space . $currency . $suffix;
|
|
||||||
}
|
|
||||||
if ($width > 0) {
|
|
||||||
$number = str_pad($number, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT);
|
|
||||||
}
|
|
||||||
$format = str_replace($fmatch[0], $number, $format);
|
|
||||||
return $format;
|
|
||||||
} // function money_format()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Strangely, PHP doesn't have a mb_str_replace multibyte function
|
// Strangely, PHP doesn't have a mb_str_replace multibyte function
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Logical {
|
class PHPExcel_Calculation_Logical {
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_LookupRef {
|
class PHPExcel_Calculation_LookupRef {
|
||||||
|
|
||||||
@ -253,6 +253,7 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param string $linkURL Value to check, is also the value returned when no error
|
* @param string $linkURL Value to check, is also the value returned when no error
|
||||||
* @param string $displayName Value to return when testValue is an error condition
|
* @param string $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)
|
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||||
*/
|
*/
|
||||||
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) {
|
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) {
|
||||||
@ -287,13 +288,14 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
*
|
*
|
||||||
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
|
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
|
||||||
*
|
*
|
||||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
|
||||||
|
* @param PHPExcel_Cell $pCell The current cell (containing this formula)
|
||||||
* @return mixed The cells referenced by cellAddress
|
* @return mixed The cells referenced by cellAddress
|
||||||
*
|
*
|
||||||
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function INDIRECT($cellAddress=Null, PHPExcel_Cell $pCell = null) {
|
public static function INDIRECT($cellAddress = NULL, PHPExcel_Cell $pCell = NULL) {
|
||||||
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
||||||
if (is_null($cellAddress) || $cellAddress === '') {
|
if (is_null($cellAddress) || $cellAddress === '') {
|
||||||
return PHPExcel_Calculation_Functions::REF();
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
@ -307,29 +309,30 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
|
|
||||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
||||||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $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)) {
|
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
|
||||||
return PHPExcel_Calculation_Functions::REF();
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($cellAddress,'!') !== false) {
|
if (strpos($cellAddress,'!') !== FALSE) {
|
||||||
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
list($sheetName, $cellAddress) = explode('!',$cellAddress);
|
||||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
$sheetName = trim($sheetName, "'");
|
||||||
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
} else {
|
} else {
|
||||||
$pSheet = $pCell->getParent();
|
$pSheet = $pCell->getWorksheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False);
|
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($cellAddress,'!') !== false) {
|
if (strpos($cellAddress,'!') !== FALSE) {
|
||||||
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
||||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
$sheetName = trim($sheetName, "'");
|
||||||
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
} else {
|
} else {
|
||||||
$pSheet = $pCell->getParent();
|
$pSheet = $pCell->getWorksheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE);
|
||||||
} // function INDIRECT()
|
} // function INDIRECT()
|
||||||
|
|
||||||
|
|
||||||
@ -373,9 +376,10 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
return PHPExcel_Calculation_Functions::REF();
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sheetName = null;
|
$sheetName = NULL;
|
||||||
if (strpos($cellAddress,"!")) {
|
if (strpos($cellAddress,"!")) {
|
||||||
list($sheetName,$cellAddress) = explode("!",$cellAddress);
|
list($sheetName,$cellAddress) = explode("!",$cellAddress);
|
||||||
|
$sheetName = trim($sheetName, "'");
|
||||||
}
|
}
|
||||||
if (strpos($cellAddress,":")) {
|
if (strpos($cellAddress,":")) {
|
||||||
list($startCell,$endCell) = explode(":",$cellAddress);
|
list($startCell,$endCell) = explode(":",$cellAddress);
|
||||||
@ -416,10 +420,10 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sheetName !== null) {
|
if ($sheetName !== NULL) {
|
||||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
} else {
|
} else {
|
||||||
$pSheet = $pCell->getParent();
|
$pSheet = $pCell->getWorksheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||||
@ -458,7 +462,7 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
$chosenEntry = floor($chosenEntry);
|
$chosenEntry = floor($chosenEntry);
|
||||||
if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) {
|
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +721,8 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
|
|
||||||
$rowNumber = $rowValue = False;
|
$rowNumber = $rowValue = False;
|
||||||
foreach($lookup_array as $rowKey => $rowData) {
|
foreach($lookup_array as $rowKey => $rowData) {
|
||||||
if (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)) {
|
if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$rowNumber = $rowKey;
|
$rowNumber = $rowKey;
|
||||||
@ -730,7 +735,11 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
return PHPExcel_Calculation_Functions::NA();
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
} else {
|
} else {
|
||||||
// otherwise return the appropriate value
|
// otherwise return the appropriate value
|
||||||
return $lookup_array[$rowNumber][$returnColumn];
|
$result = $lookup_array[$rowNumber][$returnColumn];
|
||||||
|
if ((is_numeric($lookup_value) && is_numeric($result)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($result))) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,6 +747,70 @@ class PHPExcel_Calculation_LookupRef {
|
|||||||
} // function VLOOKUP()
|
} // function VLOOKUP()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HLOOKUP
|
||||||
|
* The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
|
||||||
|
* @param lookup_value The value that you want to match in lookup_array
|
||||||
|
* @param lookup_array The range of cells being searched
|
||||||
|
* @param index_number The row number in table_array from which the matching value must be returned. The first row is 1.
|
||||||
|
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||||
|
* @return mixed The value of the found cell
|
||||||
|
*/
|
||||||
|
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) {
|
||||||
|
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||||
|
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||||
|
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||||
|
|
||||||
|
// index_number must be greater than or equal to 1
|
||||||
|
if ($index_number < 1) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
// index_number must be less than or equal to the number of columns in lookup_array
|
||||||
|
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$f = array_keys($lookup_array);
|
||||||
|
$firstRow = array_pop($f);
|
||||||
|
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||||
|
$firstkey = $f[0] - 1;
|
||||||
|
$returnColumn = $firstkey + $index_number;
|
||||||
|
$firstColumn = array_shift($f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$not_exact_match) {
|
||||||
|
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNumber = $rowValue = False;
|
||||||
|
foreach($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
||||||
|
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$rowNumber = $rowKey;
|
||||||
|
$rowValue = $rowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowNumber !== false) {
|
||||||
|
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||||
|
// if an exact match is required, we have what we need to return an appropriate response
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} else {
|
||||||
|
// otherwise return the appropriate value
|
||||||
|
$result = $lookup_array[$returnColumn][$rowNumber];
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} // function HLOOKUP()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LOOKUP
|
* LOOKUP
|
||||||
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_MathTrig {
|
class PHPExcel_Calculation_MathTrig {
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
* ATAN2
|
* ATAN2
|
||||||
*
|
*
|
||||||
* This function calculates the arc tangent of the two variables x and y. It is similar to
|
* This function calculates the arc tangent of the two variables x and y. It is similar to
|
||||||
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
||||||
* to determine the quadrant of the result.
|
* 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
|
* 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
|
* point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
|
||||||
@ -495,7 +495,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Mathematical and Trigonometric Functions
|
* @category Mathematical and Trigonometric Functions
|
||||||
* @param float $value The positive real number for which you want the logarithm
|
* @param float $number The positive real number for which you want the logarithm
|
||||||
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
@ -547,7 +547,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
try {
|
try {
|
||||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||||
return $matrix->det();
|
return $matrix->det();
|
||||||
} catch (Exception $ex) {
|
} catch (PHPExcel_Exception $ex) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
} // function MDETERM()
|
} // function MDETERM()
|
||||||
@ -589,7 +589,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
try {
|
try {
|
||||||
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
|
||||||
return $matrix->inverse()->getArray();
|
return $matrix->inverse()->getArray();
|
||||||
} catch (Exception $ex) {
|
} catch (PHPExcel_Exception $ex) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
} // function MINVERSE()
|
} // function MINVERSE()
|
||||||
@ -642,7 +642,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $matrixA->times($matrixB)->getArray();
|
return $matrixA->times($matrixB)->getArray();
|
||||||
} catch (Exception $ex) {
|
} catch (PHPExcel_Exception $ex) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
} // function MMULT()
|
} // function MMULT()
|
||||||
@ -1164,7 +1164,11 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||||
// Loop through arguments
|
// Loop through arguments
|
||||||
foreach ($aArgs as $key => $arg) {
|
foreach ($aArgs as $key => $arg) {
|
||||||
if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); }
|
if (!is_numeric($arg)) {
|
||||||
|
$arg = str_replace('"', '""', $arg);
|
||||||
|
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg));
|
||||||
|
}
|
||||||
|
|
||||||
$testCondition = '='.$arg.$condition;
|
$testCondition = '='.$arg.$condition;
|
||||||
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
|
||||||
// Is it a value within our criteria
|
// Is it a value within our criteria
|
||||||
@ -1252,7 +1256,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
/**
|
/**
|
||||||
* SUMX2MY2
|
* SUMX2MY2
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed[] $matrixData1 Matrix #1
|
||||||
|
* @param mixed[] $matrixData2 Matrix #2
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function SUMX2MY2($matrixData1,$matrixData2) {
|
public static function SUMX2MY2($matrixData1,$matrixData2) {
|
||||||
@ -1281,7 +1286,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
/**
|
/**
|
||||||
* SUMX2PY2
|
* SUMX2PY2
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed[] $matrixData1 Matrix #1
|
||||||
|
* @param mixed[] $matrixData2 Matrix #2
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function SUMX2PY2($matrixData1,$matrixData2) {
|
public static function SUMX2PY2($matrixData1,$matrixData2) {
|
||||||
@ -1310,7 +1316,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
/**
|
/**
|
||||||
* SUMXMY2
|
* SUMXMY2
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed[] $matrixData1 Matrix #1
|
||||||
|
* @param mixed[] $matrixData2 Matrix #2
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function SUMXMY2($matrixData1,$matrixData2) {
|
public static function SUMXMY2($matrixData1,$matrixData2) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099);
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Statistical {
|
class PHPExcel_Calculation_Statistical {
|
||||||
|
|
||||||
@ -834,6 +834,7 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
* @category Mathematical and Trigonometric Functions
|
* @category Mathematical and Trigonometric Functions
|
||||||
* @param mixed $arg,... Data values
|
* @param mixed $arg,... Data values
|
||||||
* @param string $condition The criteria that defines which cells will be checked.
|
* @param string $condition The criteria that defines which cells will be checked.
|
||||||
|
* @param mixed[] $averageArgs Data values
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function AVERAGEIF($aArgs,$condition,$averageArgs = array()) {
|
public static function AVERAGEIF($aArgs,$condition,$averageArgs = array()) {
|
||||||
@ -912,6 +913,8 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
* @param float $probability Probability at which you want to evaluate the distribution
|
* @param float $probability Probability at which you want to evaluate the distribution
|
||||||
* @param float $alpha Parameter to the distribution
|
* @param float $alpha Parameter to the distribution
|
||||||
* @param float $beta Parameter to the distribution
|
* @param float $beta Parameter to the distribution
|
||||||
|
* @param float $rMin Minimum value
|
||||||
|
* @param float $rMax Maximum value
|
||||||
* @param boolean $cumulative
|
* @param boolean $cumulative
|
||||||
* @return float
|
* @return float
|
||||||
*
|
*
|
||||||
@ -1954,9 +1957,9 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
* @param boolean A logical value specifying whether to return additional regression statistics.
|
* @param boolean A logical value specifying whether to return additional regression statistics.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function LINEST($yValues,$xValues=null,$const=True,$stats=False) {
|
public static function LINEST($yValues, $xValues = NULL, $const = TRUE, $stats = FALSE) {
|
||||||
$const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
$const = (is_null($const)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
||||||
$stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
|
$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 (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
|
||||||
|
|
||||||
if (!self::_checkTrendArrays($yValues,$xValues)) {
|
if (!self::_checkTrendArrays($yValues,$xValues)) {
|
||||||
@ -2059,7 +2062,9 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
*
|
*
|
||||||
* Returns the inverse of the normal cumulative distribution
|
* Returns the inverse of the normal cumulative distribution
|
||||||
*
|
*
|
||||||
* @param float $value
|
* @param float $probability
|
||||||
|
* @param float $mean
|
||||||
|
* @param float $stdDev
|
||||||
* @return float
|
* @return float
|
||||||
*
|
*
|
||||||
* @todo Try implementing P J Acklam's refinement algorithm for greater
|
* @todo Try implementing P J Acklam's refinement algorithm for greater
|
||||||
@ -2088,6 +2093,8 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
* with parameters mean and standard_dev.
|
* with parameters mean and standard_dev.
|
||||||
*
|
*
|
||||||
* @param float $value
|
* @param float $value
|
||||||
|
* @param float $mean
|
||||||
|
* @param float $stdDev
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function LOGNORMDIST($value, $mean, $stdDev) {
|
public static function LOGNORMDIST($value, $mean, $stdDev) {
|
||||||
@ -3621,14 +3628,14 @@ class PHPExcel_Calculation_Statistical {
|
|||||||
* Returns the Weibull distribution. Use this distribution in reliability
|
* Returns the Weibull distribution. Use this distribution in reliability
|
||||||
* analysis, such as calculating a device's mean time to failure.
|
* analysis, such as calculating a device's mean time to failure.
|
||||||
*
|
*
|
||||||
* @param float $value
|
* @param float $dataSet
|
||||||
* @param float $alpha Alpha Parameter
|
* @param float $m0 Alpha Parameter
|
||||||
* @param float $beta Beta Parameter
|
* @param float $sigma Beta Parameter
|
||||||
* @param boolean $cumulative
|
* @param boolean $cumulative
|
||||||
* @return float
|
* @return float
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function ZTEST($dataSet, $m0, $sigma=null) {
|
public static function ZTEST($dataSet, $m0, $sigma = NULL) {
|
||||||
$dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet);
|
$dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet);
|
||||||
$m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0);
|
$m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0);
|
||||||
$sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma);
|
$sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_TextData {
|
class PHPExcel_Calculation_TextData {
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
/**
|
/**
|
||||||
* TRIMNONPRINTABLE
|
* TRIMNONPRINTABLE
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed $stringValue Value to check
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function TRIMNONPRINTABLE($stringValue = '') {
|
public static function TRIMNONPRINTABLE($stringValue = '') {
|
||||||
@ -113,7 +113,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
/**
|
/**
|
||||||
* TRIMSPACES
|
* TRIMSPACES
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed $stringValue Value to check
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function TRIMSPACES($stringValue = '') {
|
public static function TRIMSPACES($stringValue = '') {
|
||||||
@ -133,7 +133,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
/**
|
/**
|
||||||
* ASCIICODE
|
* ASCIICODE
|
||||||
*
|
*
|
||||||
* @param string $character Value
|
* @param string $characters Value
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function ASCIICODE($characters) {
|
public static function ASCIICODE($characters) {
|
||||||
@ -208,16 +208,17 @@ class PHPExcel_Calculation_TextData {
|
|||||||
}
|
}
|
||||||
$decimals = floor($decimals);
|
$decimals = floor($decimals);
|
||||||
|
|
||||||
|
$mask = '$#,##0';
|
||||||
if ($decimals > 0) {
|
if ($decimals > 0) {
|
||||||
return money_format('%.'.$decimals.'n',$value);
|
$mask .= '.' . str_repeat('0',$decimals);
|
||||||
} else {
|
} else {
|
||||||
$round = pow(10,abs($decimals));
|
$round = pow(10,abs($decimals));
|
||||||
if ($value < 0) { $round = 0-$round; }
|
if ($value < 0) { $round = 0-$round; }
|
||||||
$value = PHPExcel_Calculation_MathTrig::MROUND($value,$round);
|
$value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
|
||||||
// The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0,
|
|
||||||
// so we display to 1 dp and chop off that character and the decimal separator using substr
|
|
||||||
return substr(money_format('%.1n',$value),0,-2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
|
||||||
|
|
||||||
} // function DOLLAR()
|
} // function DOLLAR()
|
||||||
|
|
||||||
|
|
||||||
@ -297,6 +298,8 @@ class PHPExcel_Calculation_TextData {
|
|||||||
* FIXEDFORMAT
|
* FIXEDFORMAT
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed $value Value to check
|
||||||
|
* @param integer $decimals
|
||||||
|
* @param boolean $no_commas
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) {
|
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) {
|
||||||
@ -407,7 +410,6 @@ class PHPExcel_Calculation_TextData {
|
|||||||
* STRINGLENGTH
|
* STRINGLENGTH
|
||||||
*
|
*
|
||||||
* @param string $value Value
|
* @param string $value Value
|
||||||
* @param int $chars Number of characters
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function STRINGLENGTH($value = '') {
|
public static function STRINGLENGTH($value = '') {
|
||||||
@ -440,11 +442,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('mb_convert_case')) {
|
return PHPExcel_Shared_String::StrToLower($mixedCaseString);
|
||||||
return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8');
|
|
||||||
} else {
|
|
||||||
return strtoupper($mixedCaseString);
|
|
||||||
}
|
|
||||||
} // function LOWERCASE()
|
} // function LOWERCASE()
|
||||||
|
|
||||||
|
|
||||||
@ -463,11 +461,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('mb_convert_case')) {
|
return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
|
||||||
return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8');
|
|
||||||
} else {
|
|
||||||
return strtoupper($mixedCaseString);
|
|
||||||
}
|
|
||||||
} // function UPPERCASE()
|
} // function UPPERCASE()
|
||||||
|
|
||||||
|
|
||||||
@ -486,20 +480,17 @@ class PHPExcel_Calculation_TextData {
|
|||||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('mb_convert_case')) {
|
return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
|
||||||
return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8');
|
|
||||||
} else {
|
|
||||||
return ucwords($mixedCaseString);
|
|
||||||
}
|
|
||||||
} // function PROPERCASE()
|
} // function PROPERCASE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REPLACE
|
* REPLACE
|
||||||
*
|
*
|
||||||
* @param string $value Value
|
* @param string $oldText String to modify
|
||||||
* @param int $start Start character
|
* @param int $start Start character
|
||||||
* @param int $chars Number of characters
|
* @param int $chars Number of characters
|
||||||
|
* @param string $newText String to replace in defined position
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {
|
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {
|
||||||
@ -565,7 +556,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
/**
|
/**
|
||||||
* RETURNSTRING
|
* RETURNSTRING
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed $testValue Value to check
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function RETURNSTRING($testValue = '') {
|
public static function RETURNSTRING($testValue = '') {
|
||||||
@ -582,6 +573,7 @@ class PHPExcel_Calculation_TextData {
|
|||||||
* TEXTFORMAT
|
* TEXTFORMAT
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to check
|
* @param mixed $value Value to check
|
||||||
|
* @param string $format Format mask to use
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function TEXTFORMAT($value,$format) {
|
public static function TEXTFORMAT($value,$format) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,24 +20,53 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Token_Stack
|
||||||
|
*
|
||||||
|
* @category PHPExcel_Calculation_Token_Stack
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
class PHPExcel_Calculation_Token_Stack {
|
class PHPExcel_Calculation_Token_Stack {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The parser stack for formulae
|
||||||
|
*
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
private $_stack = array();
|
private $_stack = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of entries in the parser stack
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
private $_count = 0;
|
private $_count = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of entries on the stack
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
public function count() {
|
public function count() {
|
||||||
return $this->_count;
|
return $this->_count;
|
||||||
} // function count()
|
} // function count()
|
||||||
|
|
||||||
|
/**
|
||||||
public function push($type,$value,$reference=null) {
|
* Push a new entry onto the stack
|
||||||
|
*
|
||||||
|
* @param mixed $type
|
||||||
|
* @param mixed $value
|
||||||
|
* @param mixed $reference
|
||||||
|
*/
|
||||||
|
public function push($type, $value, $reference = NULL) {
|
||||||
$this->_stack[$this->_count++] = array('type' => $type,
|
$this->_stack[$this->_count++] = array('type' => $type,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'reference' => $reference
|
'reference' => $reference
|
||||||
@ -50,24 +79,37 @@ class PHPExcel_Calculation_Token_Stack {
|
|||||||
}
|
}
|
||||||
} // function push()
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop the last entry from the stack
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function pop() {
|
public function pop() {
|
||||||
if ($this->_count > 0) {
|
if ($this->_count > 0) {
|
||||||
return $this->_stack[--$this->_count];
|
return $this->_stack[--$this->_count];
|
||||||
}
|
}
|
||||||
return null;
|
return NULL;
|
||||||
} // function pop()
|
} // function pop()
|
||||||
|
|
||||||
|
/**
|
||||||
public function last($n=1) {
|
* Return an entry from the stack without removing it
|
||||||
if ($this->_count-$n < 0) {
|
*
|
||||||
return null;
|
* @param integer $n number indicating how far back in the stack we want to look
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function last($n = 1) {
|
||||||
|
if ($this->_count - $n < 0) {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
return $this->_stack[$this->_count-$n];
|
return $this->_stack[$this->_count - $n];
|
||||||
} // function last()
|
} // function last()
|
||||||
|
|
||||||
|
/**
|
||||||
function __construct() {
|
* Clear the stack
|
||||||
|
*/
|
||||||
|
function clear() {
|
||||||
|
$this->_stack = array();
|
||||||
|
$this->_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // class PHPExcel_Calculation_Token_Stack
|
} // class PHPExcel_Calculation_Token_Stack
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell
|
class PHPExcel_Cell
|
||||||
{
|
{
|
||||||
@ -50,20 +50,6 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
private static $_valueBinder = NULL;
|
private static $_valueBinder = NULL;
|
||||||
|
|
||||||
/**
|
|
||||||
* Column of the cell
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_column;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Row of the cell
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $_row;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value of the cell
|
* Value of the cell
|
||||||
*
|
*
|
||||||
@ -93,7 +79,7 @@ class PHPExcel_Cell
|
|||||||
/**
|
/**
|
||||||
* Parent worksheet
|
* Parent worksheet
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet
|
* @var PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
private $_parent;
|
private $_parent;
|
||||||
|
|
||||||
@ -117,7 +103,8 @@ class PHPExcel_Cell
|
|||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function notifyCacheController() {
|
public function notifyCacheController() {
|
||||||
$this->_parent->getCellCacheController()->updateCacheData($this);
|
$this->_parent->updateCacheData($this);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +112,9 @@ class PHPExcel_Cell
|
|||||||
$this->_parent = NULL;
|
$this->_parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attach($parent) {
|
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) {
|
||||||
|
|
||||||
|
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,24 +122,18 @@ class PHPExcel_Cell
|
|||||||
/**
|
/**
|
||||||
* Create a new Cell
|
* Create a new Cell
|
||||||
*
|
*
|
||||||
* @param string $pColumn
|
|
||||||
* @param int $pRow
|
|
||||||
* @param mixed $pValue
|
* @param mixed $pValue
|
||||||
* @param string $pDataType
|
* @param string $pDataType
|
||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pColumn = 'A', $pRow = 1, $pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL)
|
public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL)
|
||||||
{
|
{
|
||||||
// Initialise cell coordinate
|
|
||||||
$this->_column = strtoupper($pColumn);
|
|
||||||
$this->_row = $pRow;
|
|
||||||
|
|
||||||
// Initialise cell value
|
// Initialise cell value
|
||||||
$this->_value = $pValue;
|
$this->_value = $pValue;
|
||||||
|
|
||||||
// Set worksheet
|
// Set worksheet cache
|
||||||
$this->_parent = $pSheet;
|
$this->_parent = $pSheet->getCellCacheController();
|
||||||
|
|
||||||
// Set datatype?
|
// Set datatype?
|
||||||
if ($pDataType !== NULL) {
|
if ($pDataType !== NULL) {
|
||||||
@ -174,7 +157,7 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
public function getColumn()
|
public function getColumn()
|
||||||
{
|
{
|
||||||
return $this->_column;
|
return $this->_parent->getCurrentColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,7 +167,7 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
public function getRow()
|
public function getRow()
|
||||||
{
|
{
|
||||||
return $this->_row;
|
return $this->_parent->getCurrentRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +177,7 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
public function getCoordinate()
|
public function getCoordinate()
|
||||||
{
|
{
|
||||||
return $this->_column . $this->_row;
|
return $this->_parent->getCurrentAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,7 +199,7 @@ class PHPExcel_Cell
|
|||||||
{
|
{
|
||||||
return (string) PHPExcel_Style_NumberFormat::toFormattedString(
|
return (string) PHPExcel_Style_NumberFormat::toFormattedString(
|
||||||
$this->getCalculatedValue(),
|
$this->getCalculatedValue(),
|
||||||
$this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())
|
$this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex())
|
||||||
->getNumberFormat()->getFormatCode()
|
->getNumberFormat()->getFormatCode()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -250,10 +233,12 @@ class PHPExcel_Cell
|
|||||||
{
|
{
|
||||||
// set the value according to data type
|
// set the value according to data type
|
||||||
switch ($pDataType) {
|
switch ($pDataType) {
|
||||||
|
case PHPExcel_Cell_DataType::TYPE_NULL:
|
||||||
|
$this->_value = $pValue;
|
||||||
|
break;
|
||||||
case PHPExcel_Cell_DataType::TYPE_STRING2:
|
case PHPExcel_Cell_DataType::TYPE_STRING2:
|
||||||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
case PHPExcel_Cell_DataType::TYPE_STRING:
|
case PHPExcel_Cell_DataType::TYPE_STRING:
|
||||||
case PHPExcel_Cell_DataType::TYPE_NULL:
|
|
||||||
case PHPExcel_Cell_DataType::TYPE_INLINE:
|
case PHPExcel_Cell_DataType::TYPE_INLINE:
|
||||||
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
|
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
|
||||||
break;
|
break;
|
||||||
@ -285,43 +270,48 @@ class PHPExcel_Cell
|
|||||||
*
|
*
|
||||||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling
|
* @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
|
* @return mixed
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getCalculatedValue($resetLog = TRUE)
|
public function getCalculatedValue($resetLog = TRUE)
|
||||||
{
|
{
|
||||||
// echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'<br />';
|
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL;
|
||||||
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||||
try {
|
try {
|
||||||
// echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value<br />';
|
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
|
||||||
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
|
$result = PHPExcel_Calculation::getInstance(
|
||||||
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
|
$this->getWorksheet()->getParent()
|
||||||
} catch ( Exception $ex ) {
|
)->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)) {
|
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) {
|
||||||
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||||
return $this->_calculatedValue; // Fallback for calculations referencing external files.
|
return $this->_calculatedValue; // Fallback for calculations referencing external files.
|
||||||
}
|
}
|
||||||
// echo 'Calculation Exception: '.$ex->getMessage().'<br />';
|
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
|
||||||
$result = '#N/A';
|
$result = '#N/A';
|
||||||
throw(
|
throw new PHPExcel_Calculation_Exception(
|
||||||
new PHPExcel_Exception(
|
$this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()
|
||||||
$this->getParent()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result === '#Not Yet Implemented') {
|
if ($result === '#Not Yet Implemented') {
|
||||||
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||||
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
|
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
|
||||||
}
|
}
|
||||||
// echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().'<br />';
|
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
|
||||||
return $result;
|
return $result;
|
||||||
|
} elseif($this->_value instanceof PHPExcel_RichText) {
|
||||||
|
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />';
|
||||||
|
return $this->_value->getPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($this->_value === NULL) {
|
|
||||||
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
|
|
||||||
// return NULL;
|
|
||||||
// }
|
|
||||||
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
|
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
|
||||||
return $this->_value;
|
return $this->_value;
|
||||||
}
|
}
|
||||||
@ -382,6 +372,16 @@ class PHPExcel_Cell
|
|||||||
return $this->notifyCacheController();
|
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?
|
* Does this cell contain Data validation rules?
|
||||||
*
|
*
|
||||||
@ -394,7 +394,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_parent->dataValidationExists($this->getCoordinate());
|
return $this->getWorksheet()->dataValidationExists($this->getCoordinate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -409,7 +409,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_parent->getDataValidation($this->getCoordinate());
|
return $this->getWorksheet()->getDataValidation($this->getCoordinate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,7 +425,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_parent->setDataValidation($this->getCoordinate(), $pDataValidation);
|
$this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation);
|
||||||
|
|
||||||
return $this->notifyCacheController();
|
return $this->notifyCacheController();
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_parent->hyperlinkExists($this->getCoordinate());
|
return $this->getWorksheet()->hyperlinkExists($this->getCoordinate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -457,7 +457,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_parent->getHyperlink($this->getCoordinate());
|
return $this->getWorksheet()->getHyperlink($this->getCoordinate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -473,7 +473,7 @@ class PHPExcel_Cell
|
|||||||
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
|
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_parent->setHyperlink($this->getCoordinate(), $pHyperlink);
|
$this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink);
|
||||||
|
|
||||||
return $this->notifyCacheController();
|
return $this->notifyCacheController();
|
||||||
}
|
}
|
||||||
@ -481,12 +481,31 @@ class PHPExcel_Cell
|
|||||||
/**
|
/**
|
||||||
* Get parent worksheet
|
* Get parent worksheet
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_CachedObjectStorage_CacheBase
|
||||||
*/
|
*/
|
||||||
public function getParent() {
|
public function getParent() {
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parent worksheet
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function getWorksheet() {
|
||||||
|
return $this->_parent->getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell style
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Style
|
||||||
|
*/
|
||||||
|
public function getStyle()
|
||||||
|
{
|
||||||
|
return $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-bind parent
|
* Re-bind parent
|
||||||
*
|
*
|
||||||
@ -494,7 +513,7 @@ class PHPExcel_Cell
|
|||||||
* @return PHPExcel_Cell
|
* @return PHPExcel_Cell
|
||||||
*/
|
*/
|
||||||
public function rebindParent(PHPExcel_Worksheet $parent) {
|
public function rebindParent(PHPExcel_Worksheet $parent) {
|
||||||
$this->_parent = $parent;
|
$this->_parent = $parent->getCellCacheController();
|
||||||
|
|
||||||
return $this->notifyCacheController();
|
return $this->notifyCacheController();
|
||||||
}
|
}
|
||||||
@ -727,7 +746,6 @@ class PHPExcel_Cell
|
|||||||
*
|
*
|
||||||
* @param string $pString
|
* @param string $pString
|
||||||
* @return int Column index (base 1 !!!)
|
* @return int Column index (base 1 !!!)
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static function columnIndexFromString($pString = 'A')
|
public static function columnIndexFromString($pString = 'A')
|
||||||
{
|
{
|
||||||
@ -825,8 +843,8 @@ class PHPExcel_Cell
|
|||||||
|
|
||||||
// Range...
|
// Range...
|
||||||
list($rangeStart, $rangeEnd) = $range;
|
list($rangeStart, $rangeEnd) = $range;
|
||||||
list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d');
|
sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow);
|
||||||
list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d');
|
sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow);
|
||||||
$endCol++;
|
$endCol++;
|
||||||
|
|
||||||
// Current data
|
// Current data
|
||||||
@ -848,7 +866,7 @@ class PHPExcel_Cell
|
|||||||
// Sort the result by column and row
|
// Sort the result by column and row
|
||||||
$sortKeys = array();
|
$sortKeys = array();
|
||||||
foreach (array_unique($returnValue) as $coord) {
|
foreach (array_unique($returnValue) as $coord) {
|
||||||
list($column,$row) = sscanf($coord,'%[A-Z]%d');
|
sscanf($coord,'%[A-Z]%d', $column, $row);
|
||||||
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord;
|
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord;
|
||||||
}
|
}
|
||||||
ksort($sortKeys);
|
ksort($sortKeys);
|
||||||
@ -861,16 +879,16 @@ class PHPExcel_Cell
|
|||||||
* Compare 2 cells
|
* Compare 2 cells
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Cell $a Cell a
|
* @param PHPExcel_Cell $a Cell a
|
||||||
* @param PHPExcel_Cell $a Cell b
|
* @param PHPExcel_Cell $b Cell b
|
||||||
* @return int Result of comparison (always -1 or 1, never zero!)
|
* @return int Result of comparison (always -1 or 1, never zero!)
|
||||||
*/
|
*/
|
||||||
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
|
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
|
||||||
{
|
{
|
||||||
if ($a->_row < $b->_row) {
|
if ($a->getRow() < $b->getRow()) {
|
||||||
return -1;
|
return -1;
|
||||||
} elseif ($a->_row > $b->_row) {
|
} elseif ($a->getRow() > $b->getRow()) {
|
||||||
return 1;
|
return 1;
|
||||||
} elseif (self::columnIndexFromString($a->_column) < self::columnIndexFromString($b->_column)) {
|
} elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
@ -894,11 +912,11 @@ class PHPExcel_Cell
|
|||||||
* Set value binder to use
|
* Set value binder to use
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Cell_IValueBinder $binder
|
* @param PHPExcel_Cell_IValueBinder $binder
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
|
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
|
||||||
if ($binder === NULL) {
|
if ($binder === NULL) {
|
||||||
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_valueBinder = $binder;
|
self::$_valueBinder = $binder;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
@ -80,13 +80,13 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for fraction
|
// Check for fraction
|
||||||
if (preg_match('/^([+-]?) *([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
|
||||||
// Convert value to number
|
// Convert value to number
|
||||||
$value = $matches[2] / $matches[3];
|
$value = $matches[2] / $matches[3];
|
||||||
if ($matches[1] == '-') $value = 0 - $value;
|
if ($matches[1] == '-') $value = 0 - $value;
|
||||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( '??/??' );
|
->getNumberFormat()->setFormatCode( '??/??' );
|
||||||
return true;
|
return true;
|
||||||
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||||
@ -95,7 +95,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
if ($matches[1] == '-') $value = 0 - $value;
|
if ($matches[1] == '-') $value = 0 - $value;
|
||||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( '# ??/??' );
|
->getNumberFormat()->setFormatCode( '# ??/??' );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -106,19 +106,21 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
$value = (float) str_replace('%', '', $value) / 100;
|
$value = (float) str_replace('%', '', $value) / 100;
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 );
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for currency
|
// Check for currency
|
||||||
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
$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
|
// Convert value to number
|
||||||
$value = (float) trim(str_replace(array($currencyCode,','), '', $value));
|
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode(
|
->getNumberFormat()->setFormatCode(
|
||||||
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE )
|
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE )
|
||||||
);
|
);
|
||||||
@ -128,7 +130,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
$value = (float) trim(str_replace(array('$',','), '', $value));
|
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE );
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -140,7 +142,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
$days = $h / 24 + $m / 1440;
|
$days = $h / 24 + $m / 1440;
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -153,7 +155,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
// Convert value to number
|
// Convert value to number
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -168,7 +170,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
} else {
|
} else {
|
||||||
$formatCode = 'yyyy-mm-dd';
|
$formatCode = 'yyyy-mm-dd';
|
||||||
}
|
}
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode($formatCode);
|
->getNumberFormat()->setFormatCode($formatCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,7 +180,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getAlignment()->setWrapText(TRUE);
|
->getAlignment()->setWrapText(TRUE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DataType
|
class PHPExcel_Cell_DataType
|
||||||
{
|
{
|
||||||
@ -50,7 +50,15 @@ class PHPExcel_Cell_DataType
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $_errorCodes = array('#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6);
|
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
|
* Get list of error codes
|
||||||
@ -64,9 +72,9 @@ class PHPExcel_Cell_DataType
|
|||||||
/**
|
/**
|
||||||
* DataType for value
|
* DataType for value
|
||||||
*
|
*
|
||||||
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure
|
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
|
||||||
* @param mixed $pValue
|
* @param mixed $pValue
|
||||||
* @return int
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function dataTypeForValue($pValue = null) {
|
public static function dataTypeForValue($pValue = null) {
|
||||||
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||||
@ -102,7 +110,7 @@ class PHPExcel_Cell_DataType
|
|||||||
*/
|
*/
|
||||||
public static function checkErrorCode($pValue = null)
|
public static function checkErrorCode($pValue = null)
|
||||||
{
|
{
|
||||||
$pValue = (string)$pValue;
|
$pValue = (string) $pValue;
|
||||||
|
|
||||||
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
||||||
$pValue = '#NULL!';
|
$pValue = '#NULL!';
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DataValidation
|
class PHPExcel_Cell_DataValidation
|
||||||
{
|
{
|
||||||
@ -153,8 +153,6 @@ class PHPExcel_Cell_DataValidation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Cell_DataValidation
|
* Create a new PHPExcel_Cell_DataValidation
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -164,10 +162,10 @@ class PHPExcel_Cell_DataValidation
|
|||||||
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||||
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||||
$this->_operator = '';
|
$this->_operator = '';
|
||||||
$this->_allowBlank = false;
|
$this->_allowBlank = FALSE;
|
||||||
$this->_showDropDown = false;
|
$this->_showDropDown = FALSE;
|
||||||
$this->_showInputMessage = false;
|
$this->_showInputMessage = FALSE;
|
||||||
$this->_showErrorMessage = false;
|
$this->_showErrorMessage = FALSE;
|
||||||
$this->_errorTitle = '';
|
$this->_errorTitle = '';
|
||||||
$this->_error = '';
|
$this->_error = '';
|
||||||
$this->_promptTitle = '';
|
$this->_promptTitle = '';
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
@ -63,14 +63,14 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
|||||||
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
||||||
|
|
||||||
// Done!
|
// Done!
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataType for value
|
* DataType for value
|
||||||
*
|
*
|
||||||
* @param mixed $pValue
|
* @param mixed $pValue
|
||||||
* @return int
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function dataTypeForValue($pValue = null) {
|
public static function dataTypeForValue($pValue = null) {
|
||||||
// Match the value against a few data types
|
// Match the value against a few data types
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_Hyperlink
|
class PHPExcel_Cell_Hyperlink
|
||||||
{
|
{
|
||||||
@ -54,7 +54,6 @@ class PHPExcel_Cell_Hyperlink
|
|||||||
*
|
*
|
||||||
* @param string $pUrl Url to link the cell to
|
* @param string $pUrl Url to link the cell to
|
||||||
* @param string $pTooltip Tooltip to display on the hyperlink
|
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function __construct($pUrl = '', $pTooltip = '')
|
public function __construct($pUrl = '', $pTooltip = '')
|
||||||
{
|
{
|
||||||
@ -104,7 +103,7 @@ class PHPExcel_Cell_Hyperlink
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this hyperlink internal? (to another sheet)
|
* Is this hyperlink internal? (to another worksheet)
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Cell_IValueBinder
|
interface PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
@ -42,5 +42,5 @@ interface PHPExcel_Cell_IValueBinder
|
|||||||
* @param mixed $value Value to bind in cell
|
* @param mixed $value Value to bind in cell
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function bindValue(PHPExcel_Cell $cell, $value = null);
|
public function bindValue(PHPExcel_Cell $cell, $value = NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart
|
class PHPExcel_Chart
|
||||||
{
|
{
|
||||||
@ -184,7 +184,7 @@ class PHPExcel_Chart
|
|||||||
* Set Worksheet
|
* Set Worksheet
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pValue
|
* @param PHPExcel_Worksheet $pValue
|
||||||
* @throws Exception
|
* @throws PHPExcel_Chart_Exception
|
||||||
* @return PHPExcel_Chart
|
* @return PHPExcel_Chart
|
||||||
*/
|
*/
|
||||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null) {
|
public function setWorksheet(PHPExcel_Worksheet $pValue = null) {
|
||||||
@ -378,6 +378,13 @@ class PHPExcel_Chart
|
|||||||
return $this;
|
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) {
|
public function setTopLeftOffset($xOffset=null,$yOffset=null) {
|
||||||
if (!is_null($xOffset))
|
if (!is_null($xOffset))
|
||||||
$this->setTopLeftXOffset($xOffset);
|
$this->setTopLeftXOffset($xOffset);
|
||||||
@ -387,6 +394,11 @@ class PHPExcel_Chart
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the offset position within the Top Left cell for the chart
|
||||||
|
*
|
||||||
|
* @return integer[]
|
||||||
|
*/
|
||||||
public function getTopLeftOffset() {
|
public function getTopLeftOffset() {
|
||||||
return array( 'X' => $this->_topLeftXOffset,
|
return array( 'X' => $this->_topLeftXOffset,
|
||||||
'Y' => $this->_topLeftYOffset
|
'Y' => $this->_topLeftYOffset
|
||||||
@ -458,6 +470,13 @@ class PHPExcel_Chart
|
|||||||
return $this->_bottomRightCellRef;
|
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) {
|
public function setBottomRightOffset($xOffset=null,$yOffset=null) {
|
||||||
if (!is_null($xOffset))
|
if (!is_null($xOffset))
|
||||||
$this->setBottomRightXOffset($xOffset);
|
$this->setBottomRightXOffset($xOffset);
|
||||||
@ -467,6 +486,11 @@ class PHPExcel_Chart
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the offset position within the Bottom Right cell for the chart
|
||||||
|
*
|
||||||
|
* @return integer[]
|
||||||
|
*/
|
||||||
public function getBottomRightOffset() {
|
public function getBottomRightOffset() {
|
||||||
return array( 'X' => $this->_bottomRightXOffset,
|
return array( 'X' => $this->_bottomRightXOffset,
|
||||||
'Y' => $this->_bottomRightYOffset
|
'Y' => $this->_bottomRightYOffset
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_DataSeries
|
class PHPExcel_Chart_DataSeries
|
||||||
{
|
{
|
||||||
@ -52,6 +52,7 @@ class PHPExcel_Chart_DataSeries
|
|||||||
const TYPE_RADARCHART = 'radarChart';
|
const TYPE_RADARCHART = 'radarChart';
|
||||||
const TYPE_BUBBLECHART = 'bubbleChart';
|
const TYPE_BUBBLECHART = 'bubbleChart';
|
||||||
const TYPE_STOCKCHART = 'stockChart';
|
const TYPE_STOCKCHART = 'stockChart';
|
||||||
|
const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym
|
||||||
|
|
||||||
const GROUPING_CLUSTERED = 'clustered';
|
const GROUPING_CLUSTERED = 'clustered';
|
||||||
const GROUPING_STACKED = 'stacked';
|
const GROUPING_STACKED = 'stacked';
|
||||||
@ -169,9 +170,11 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* Set Plot Type
|
* Set Plot Type
|
||||||
*
|
*
|
||||||
* @param string $plotType
|
* @param string $plotType
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotType($plotType = '') {
|
public function setPlotType($plotType = '') {
|
||||||
$this->_plotType = $plotType;
|
$this->_plotType = $plotType;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,9 +190,11 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* Set Plot Grouping Type
|
* Set Plot Grouping Type
|
||||||
*
|
*
|
||||||
* @param string $groupingType
|
* @param string $groupingType
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotGrouping($groupingType = null) {
|
public function setPlotGrouping($groupingType = null) {
|
||||||
$this->_plotGrouping = $groupingType;
|
$this->_plotGrouping = $groupingType;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -205,9 +210,11 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* Set Plot Direction
|
* Set Plot Direction
|
||||||
*
|
*
|
||||||
* @param string $plotDirection
|
* @param string $plotDirection
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotDirection($plotDirection = null) {
|
public function setPlotDirection($plotDirection = null) {
|
||||||
$this->_plotDirection = $plotDirection;
|
$this->_plotDirection = $plotDirection;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,9 +287,11 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* Set Plot Style
|
* Set Plot Style
|
||||||
*
|
*
|
||||||
* @param string $plotStyle
|
* @param string $plotStyle
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setPlotStyle($plotStyle = null) {
|
public function setPlotStyle($plotStyle = null) {
|
||||||
$this->_plotStyle = $plotStyle;
|
$this->_plotStyle = $plotStyle;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -331,9 +340,11 @@ class PHPExcel_Chart_DataSeries
|
|||||||
* Set Smooth Line
|
* Set Smooth Line
|
||||||
*
|
*
|
||||||
* @param boolean $smoothLine
|
* @param boolean $smoothLine
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
*/
|
*/
|
||||||
public function setSmoothLine($smoothLine = TRUE) {
|
public function setSmoothLine($smoothLine = TRUE) {
|
||||||
$this->_smoothLine = $smoothLine;
|
$this->_smoothLine = $smoothLine;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_DataSeriesValues
|
class PHPExcel_Chart_DataSeriesValues
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ class PHPExcel_Chart_DataSeriesValues
|
|||||||
|
|
||||||
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) {
|
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) {
|
||||||
if ($this->_dataSource !== NULL) {
|
if ($this->_dataSource !== NULL) {
|
||||||
$calcEngine = PHPExcel_Calculation::getInstance();
|
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
|
||||||
$newDataValues = PHPExcel_Calculation::_unwrapResult(
|
$newDataValues = PHPExcel_Calculation::_unwrapResult(
|
||||||
$calcEngine->_calculateFormulaValue(
|
$calcEngine->_calculateFormulaValue(
|
||||||
'='.$this->_dataSource,
|
'='.$this->_dataSource,
|
||||||
@ -289,6 +289,12 @@ class PHPExcel_Chart_DataSeriesValues
|
|||||||
);
|
);
|
||||||
if ($flatten) {
|
if ($flatten) {
|
||||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||||
|
foreach($this->_dataValues as &$dataValue) {
|
||||||
|
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
|
||||||
|
$dataValue = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($dataValue);
|
||||||
} else {
|
} else {
|
||||||
$cellRange = explode('!',$this->_dataSource);
|
$cellRange = explode('!',$this->_dataSource);
|
||||||
if (count($cellRange) > 1) {
|
if (count($cellRange) > 1) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,9 +31,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_Exception extends Exception {
|
class PHPExcel_Chart_Exception extends PHPExcel_Exception {
|
||||||
/**
|
/**
|
||||||
* Error handler callback
|
* Error handler callback
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_Layout
|
class PHPExcel_Chart_Layout
|
||||||
{
|
{
|
||||||
@ -167,9 +167,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set Layout Target
|
* Set Layout Target
|
||||||
*
|
*
|
||||||
* @param Layout Target $value
|
* @param Layout Target $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setLayoutTarget($value) {
|
public function setLayoutTarget($value) {
|
||||||
$this->_layoutTarget = $value;
|
$this->_layoutTarget = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,9 +187,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set X-Mode
|
* Set X-Mode
|
||||||
*
|
*
|
||||||
* @param X-Mode $value
|
* @param X-Mode $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setXMode($value) {
|
public function setXMode($value) {
|
||||||
$this->_xMode = $value;
|
$this->_xMode = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,16 +200,18 @@ class PHPExcel_Chart_Layout
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getYMode() {
|
public function getYMode() {
|
||||||
return $this->_xMode;
|
return $this->_yMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Y-Mode
|
* Set Y-Mode
|
||||||
*
|
*
|
||||||
* @param Y-Mode $value
|
* @param Y-Mode $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setYMode($value) {
|
public function setYMode($value) {
|
||||||
$this->_xMode = $value;
|
$this->_yMode = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,9 +227,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set X-Position
|
* Set X-Position
|
||||||
*
|
*
|
||||||
* @param X-Position $value
|
* @param X-Position $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setXPosition($value) {
|
public function setXPosition($value) {
|
||||||
$this->_xPos = $value;
|
$this->_xPos = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,9 +247,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set Y-Position
|
* Set Y-Position
|
||||||
*
|
*
|
||||||
* @param Y-Position $value
|
* @param Y-Position $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setYPosition($value) {
|
public function setYPosition($value) {
|
||||||
$this->_yPos = $value;
|
$this->_yPos = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,9 +267,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set Width
|
* Set Width
|
||||||
*
|
*
|
||||||
* @param Width $value
|
* @param Width $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setWidth($value) {
|
public function setWidth($value) {
|
||||||
$this->_width = $value;
|
$this->_width = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,9 +287,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set Height
|
* Set Height
|
||||||
*
|
*
|
||||||
* @param Height $value
|
* @param Height $value
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setHeight($value) {
|
public function setHeight($value) {
|
||||||
$this->_height = $value;
|
$this->_height = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -295,9 +309,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that legend keys should be shown in data labels.
|
* Specifies that legend keys should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show legend key
|
* @param boolean $value Show legend key
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowLegendKey($value) {
|
public function setShowLegendKey($value) {
|
||||||
$this->_showLegendKey = $value;
|
$this->_showLegendKey = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -314,9 +330,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that the value should be shown in data labels.
|
* Specifies that the value should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show val
|
* @param boolean $value Show val
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowVal($value) {
|
public function setShowVal($value) {
|
||||||
$this->_showVal = $value;
|
$this->_showVal = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,9 +351,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that the category name should be shown in data labels.
|
* Specifies that the category name should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show cat name
|
* @param boolean $value Show cat name
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowCatName($value) {
|
public function setShowCatName($value) {
|
||||||
$this->_showCatName = $value;
|
$this->_showCatName = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,10 +371,12 @@ class PHPExcel_Chart_Layout
|
|||||||
* Set show ser name
|
* Set show ser name
|
||||||
* Specifies that the series name should be shown in data labels.
|
* Specifies that the series name should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show ser name
|
* @param boolean $value Show series name
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowSerName($value) {
|
public function setShowSerName($value) {
|
||||||
$this->_showSerName = $value;
|
$this->_showSerName = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,9 +393,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that the percentage should be shown in data labels.
|
* Specifies that the percentage should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show percentage
|
* @param boolean $value Show percentage
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowPercent($value) {
|
public function setShowPercent($value) {
|
||||||
$this->_showPercent = $value;
|
$this->_showPercent = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -390,9 +414,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that the bubble size should be shown in data labels.
|
* Specifies that the bubble size should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show bubble size
|
* @param boolean $value Show bubble size
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowBubbleSize($value) {
|
public function setShowBubbleSize($value) {
|
||||||
$this->_showBubbleSize = $value;
|
$this->_showBubbleSize = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -409,9 +435,11 @@ class PHPExcel_Chart_Layout
|
|||||||
* Specifies that leader lines should be shown in data labels.
|
* Specifies that leader lines should be shown in data labels.
|
||||||
*
|
*
|
||||||
* @param boolean $value Show leader lines
|
* @param boolean $value Show leader lines
|
||||||
|
* @return PHPExcel_Chart_Layout
|
||||||
*/
|
*/
|
||||||
public function setShowLeaderLines($value) {
|
public function setShowLeaderLines($value) {
|
||||||
$this->_showLeaderLines = $value;
|
$this->_showLeaderLines = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_Legend
|
class PHPExcel_Chart_Legend
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_PlotArea
|
class PHPExcel_Chart_PlotArea
|
||||||
{
|
{
|
||||||
@ -110,10 +110,13 @@ class PHPExcel_Chart_PlotArea
|
|||||||
/**
|
/**
|
||||||
* Set Plot Series
|
* Set Plot Series
|
||||||
*
|
*
|
||||||
* @param array of PHPExcel_Chart_DataSeries
|
* @param [PHPExcel_Chart_DataSeries]
|
||||||
|
* @return PHPExcel_Chart_PlotArea
|
||||||
*/
|
*/
|
||||||
public function setPlotSeries($plotSeries = array()) {
|
public function setPlotSeries($plotSeries = array()) {
|
||||||
$this->_plotSeries = $plotSeries;
|
$this->_plotSeries = $plotSeries;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,10 +20,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart_Renderer
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart_Renderer
|
* @package PHPExcel_Chart_Renderer
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_Renderer_jpgraph
|
class PHPExcel_Chart_Renderer_jpgraph
|
||||||
{
|
{
|
||||||
@ -107,13 +107,11 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||||||
|
|
||||||
$testCurrentIndex = 0;
|
$testCurrentIndex = 0;
|
||||||
foreach($datasetLabels as $i => $datasetLabel) {
|
foreach($datasetLabels as $i => $datasetLabel) {
|
||||||
array_reverse($datasetLabel);
|
|
||||||
|
|
||||||
if (is_array($datasetLabel)) {
|
if (is_array($datasetLabel)) {
|
||||||
if ($rotation == 'bar') {
|
if ($rotation == 'bar') {
|
||||||
$datasetLabel = array_reverse($datasetLabel);
|
|
||||||
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
||||||
} else {
|
} else {
|
||||||
|
$datasetLabel = array_reverse($datasetLabel);
|
||||||
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -519,19 +517,37 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||||||
private function _renderPlotStock($groupID) {
|
private function _renderPlotStock($groupID) {
|
||||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||||
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
|
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
|
||||||
$seriesPlots = array();
|
|
||||||
|
|
||||||
$dataValues = array();
|
$dataValues = array();
|
||||||
// Loop through each data series in turn
|
// Loop through each data series in turn and build the plot arrays
|
||||||
for($i = 0; $i < $seriesCount; ++$i) {
|
foreach($plotOrder as $i => $v) {
|
||||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
|
||||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
foreach($dataValuesX as $j => $dataValueX) {
|
||||||
|
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
|
||||||
foreach($dataValuesX as $j => $dataValueX)
|
}
|
||||||
$dataValues[$j][$plotOrder[$i]] = $dataValueX;
|
}
|
||||||
|
if(empty($dataValues)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$seriesPlot = new StockPlot($dataValues);
|
$dataValuesPlot = array();
|
||||||
|
// Flatten the plot arrays to a single dimensional array to work with jpgraph
|
||||||
|
for($j = 0; $j < count($dataValues[0]); $j++) {
|
||||||
|
for($i = 0; $i < $seriesCount; $i++) {
|
||||||
|
$dataValuesPlot[] = $dataValues[$i][$j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the x-axis labels
|
||||||
|
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||||
|
if ($labelCount > 0) {
|
||||||
|
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||||
|
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||||
|
$this->_graph->xaxis->SetTickLabels($datasetLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
$seriesPlot = new StockPlot($dataValuesPlot);
|
||||||
|
$seriesPlot->SetWidth(20);
|
||||||
|
|
||||||
$this->_graph->Add($seriesPlot);
|
$this->_graph->Add($seriesPlot);
|
||||||
} // function _renderPlotStock()
|
} // function _renderPlotStock()
|
||||||
@ -683,9 +699,9 @@ class PHPExcel_Chart_Renderer_jpgraph
|
|||||||
private function _renderStockChart($groupCount) {
|
private function _renderStockChart($groupCount) {
|
||||||
require_once('jpgraph_stock.php');
|
require_once('jpgraph_stock.php');
|
||||||
|
|
||||||
$this->_renderCartesianPlotArea();
|
$this->_renderCartesianPlotArea('intint');
|
||||||
|
|
||||||
for($groupID = 0; $groupID < $groupCount; ++$i) {
|
for($groupID = 0; $groupID < $groupCount; ++$groupID) {
|
||||||
$this->_renderPlotStock($groupID);
|
$this->_renderPlotStock($groupID);
|
||||||
}
|
}
|
||||||
} // function _renderStockChart()
|
} // function _renderStockChart()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Chart
|
* @package PHPExcel_Chart
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Chart_Title
|
class PHPExcel_Chart_Title
|
||||||
{
|
{
|
||||||
@ -72,9 +72,12 @@ class PHPExcel_Chart_Title
|
|||||||
* Set caption
|
* Set caption
|
||||||
*
|
*
|
||||||
* @param string $caption
|
* @param string $caption
|
||||||
|
* @return PHPExcel_Chart_Title
|
||||||
*/
|
*/
|
||||||
public function setCaption($caption = null) {
|
public function setCaption($caption = null) {
|
||||||
$this->_caption = $caption;
|
$this->_caption = $caption;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Comment implements PHPExcel_IComparable
|
class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Comment
|
* Create a new PHPExcel_Comment
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -314,4 +314,14 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert to string
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString() {
|
||||||
|
return $this->_text->getPlainText();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_DocumentProperties
|
class PHPExcel_DocumentProperties
|
||||||
{
|
{
|
||||||
@ -43,7 +43,6 @@ class PHPExcel_DocumentProperties
|
|||||||
const PROPERTY_TYPE_STRING = 's';
|
const PROPERTY_TYPE_STRING = 's';
|
||||||
const PROPERTY_TYPE_UNKNOWN = 'u';
|
const PROPERTY_TYPE_UNKNOWN = 'u';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creator
|
* Creator
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_DocumentSecurity
|
class PHPExcel_DocumentSecurity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Exception extends Exception {
|
class PHPExcel_Exception extends Exception {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_HashTable
|
class PHPExcel_HashTable
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ class PHPExcel_HashTable
|
|||||||
* Create a new PHPExcel_HashTable
|
* Create a new PHPExcel_HashTable
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pSource = null)
|
public function __construct($pSource = null)
|
||||||
{
|
{
|
||||||
@ -67,14 +67,14 @@ class PHPExcel_HashTable
|
|||||||
* Add HashTable items from source
|
* Add HashTable items from source
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addFromSource($pSource = null) {
|
public function addFromSource($pSource = null) {
|
||||||
// Check if an array was passed
|
// Check if an array was passed
|
||||||
if ($pSource == null) {
|
if ($pSource == null) {
|
||||||
return;
|
return;
|
||||||
} else if (!is_array($pSource)) {
|
} else if (!is_array($pSource)) {
|
||||||
throw new Exception('Invalid array parameter passed.');
|
throw new PHPExcel_Exception('Invalid array parameter passed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pSource as $item) {
|
foreach ($pSource as $item) {
|
||||||
@ -86,7 +86,7 @@ class PHPExcel_HashTable
|
|||||||
* Add HashTable item
|
* Add HashTable item
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable $pSource Item to add
|
* @param PHPExcel_IComparable $pSource Item to add
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function add(PHPExcel_IComparable $pSource = null) {
|
public function add(PHPExcel_IComparable $pSource = null) {
|
||||||
$hash = $pSource->getHashCode();
|
$hash = $pSource->getHashCode();
|
||||||
@ -100,7 +100,7 @@ class PHPExcel_HashTable
|
|||||||
* Remove HashTable item
|
* Remove HashTable item
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable $pSource Item to remove
|
* @param PHPExcel_IComparable $pSource Item to remove
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function remove(PHPExcel_IComparable $pSource = null) {
|
public function remove(PHPExcel_IComparable $pSource = null) {
|
||||||
$hash = $pSource->getHashCode();
|
$hash = $pSource->getHashCode();
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_IComparable
|
interface PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_IOFactory
|
class PHPExcel_IOFactory
|
||||||
{
|
{
|
||||||
@ -96,13 +96,13 @@ class PHPExcel_IOFactory
|
|||||||
* @static
|
* @static
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $value
|
* @param array $value
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function setSearchLocations($value) {
|
public static function setSearchLocations($value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
self::$_searchLocations = $value;
|
self::$_searchLocations = $value;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Invalid parameter passed.');
|
throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
|
||||||
}
|
}
|
||||||
} // function setSearchLocations()
|
} // function setSearchLocations()
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ class PHPExcel_IOFactory
|
|||||||
* @param PHPExcel $phpExcel
|
* @param PHPExcel $phpExcel
|
||||||
* @param string $writerType Example: Excel2007
|
* @param string $writerType Example: Excel2007
|
||||||
* @return PHPExcel_Writer_IWriter
|
* @return PHPExcel_Writer_IWriter
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function createWriter(PHPExcel $phpExcel, $writerType = '') {
|
public static function createWriter(PHPExcel $phpExcel, $writerType = '') {
|
||||||
// Search type
|
// Search type
|
||||||
@ -146,7 +146,7 @@ class PHPExcel_IOFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Nothing found...
|
// Nothing found...
|
||||||
throw new Exception("No $searchType found for type $writerType");
|
throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
|
||||||
} // function createWriter()
|
} // function createWriter()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +156,7 @@ class PHPExcel_IOFactory
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $readerType Example: Excel2007
|
* @param string $readerType Example: Excel2007
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function createReader($readerType = '') {
|
public static function createReader($readerType = '') {
|
||||||
// Search type
|
// Search type
|
||||||
@ -175,7 +175,7 @@ class PHPExcel_IOFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Nothing found...
|
// Nothing found...
|
||||||
throw new Exception("No $searchType found for type $readerType");
|
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
|
||||||
} // function createReader()
|
} // function createReader()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,9 +183,9 @@ class PHPExcel_IOFactory
|
|||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pFileName The name of the spreadsheet file
|
* @param string $pFilename The name of the spreadsheet file
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function load($pFilename) {
|
public static function load($pFilename) {
|
||||||
$reader = self::createReaderForFile($pFilename);
|
$reader = self::createReaderForFile($pFilename);
|
||||||
@ -197,9 +197,9 @@ class PHPExcel_IOFactory
|
|||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pFileName The name of the spreadsheet file to identify
|
* @param string $pFilename The name of the spreadsheet file to identify
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function identify($pFilename) {
|
public static function identify($pFilename) {
|
||||||
$reader = self::createReaderForFile($pFilename);
|
$reader = self::createReaderForFile($pFilename);
|
||||||
@ -214,9 +214,9 @@ class PHPExcel_IOFactory
|
|||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pFileName The name of the spreadsheet file
|
* @param string $pFilename The name of the spreadsheet file
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public static function createReaderForFile($pFilename) {
|
public static function createReaderForFile($pFilename) {
|
||||||
|
|
||||||
@ -283,6 +283,6 @@ class PHPExcel_IOFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Unable to identify a reader for this file');
|
throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
|
||||||
} // function createReaderForFile()
|
} // function createReaderForFile()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_NamedRange
|
class PHPExcel_NamedRange
|
||||||
{
|
{
|
||||||
@ -78,12 +78,13 @@ class PHPExcel_NamedRange
|
|||||||
* @param string $pRange
|
* @param string $pRange
|
||||||
* @param bool $pLocalOnly
|
* @param bool $pLocalOnly
|
||||||
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
* @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)
|
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||||
{
|
{
|
||||||
// Validate data
|
// Validate data
|
||||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
||||||
throw new Exception('Parameters can not be null.');
|
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set local members
|
// Set local members
|
||||||
|
|||||||
227
htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php
Normal file
227
htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Abstract
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||||
|
* or whether it should read both data and formatting
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_readDataOnly = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read charts that are defined in the workbook?
|
||||||
|
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_includeCharts = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restrict which sheets should be loaded?
|
||||||
|
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||||
|
*
|
||||||
|
* @var array of string
|
||||||
|
*/
|
||||||
|
protected $_loadSheetsOnly = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_IReadFilter instance
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
protected $_readFilter = NULL;
|
||||||
|
|
||||||
|
protected $_fileHandle = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
|
* If false (the default) it will read data and formatting.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getReadDataOnly() {
|
||||||
|
return $this->_readDataOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read data only
|
||||||
|
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||||
|
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReader
|
||||||
|
*/
|
||||||
|
public function setReadDataOnly($pValue = FALSE) {
|
||||||
|
$this->_readDataOnly = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read charts in workbook?
|
||||||
|
* If this is true, then the Reader will include any charts that exist in the workbook.
|
||||||
|
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||||
|
* If false (the default) it will ignore any charts defined in the workbook file.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getIncludeCharts() {
|
||||||
|
return $this->_includeCharts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read charts in workbook
|
||||||
|
* Set to true, to advise the Reader to include any charts that exist in the workbook.
|
||||||
|
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||||
|
* Set to false (the default) to discard charts.
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReader
|
||||||
|
*/
|
||||||
|
public function setIncludeCharts($pValue = FALSE) {
|
||||||
|
$this->_includeCharts = (boolean) $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get which sheets to load
|
||||||
|
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||||
|
* indicating that all worksheets in the workbook should be loaded.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLoadSheetsOnly()
|
||||||
|
{
|
||||||
|
return $this->_loadSheetsOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set which sheets to load
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||||
|
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReader
|
||||||
|
*/
|
||||||
|
public function setLoadSheetsOnly($value = NULL)
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = is_array($value) ?
|
||||||
|
$value : array($value);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all sheets to load
|
||||||
|
* Tells the Reader to load all worksheets from the workbook.
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReader
|
||||||
|
*/
|
||||||
|
public function setLoadAllSheets()
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = NULL;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
* @return PHPExcel_Reader_IReader
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open file for reading
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws PHPExcel_Reader_Exception
|
||||||
|
* @return resource
|
||||||
|
*/
|
||||||
|
protected function _openFile($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename) || !is_readable($pFilename)) {
|
||||||
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
$this->_fileHandle = fopen($pFilename, 'r');
|
||||||
|
if ($this->_fileHandle === FALSE) {
|
||||||
|
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @return boolean
|
||||||
|
* @throws PHPExcel_Reader_Exception
|
||||||
|
*/
|
||||||
|
public function canRead($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
try {
|
||||||
|
$this->_openFile($pFilename);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$readable = $this->_isValidFormat();
|
||||||
|
fclose ($this->_fileHandle);
|
||||||
|
return $readable;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Input encoding
|
* Input encoding
|
||||||
@ -92,144 +92,104 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_contiguous = false;
|
private $_contiguous = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Row counter for loading rows contiguously
|
* Row counter for loading rows contiguously
|
||||||
*
|
*
|
||||||
* @access private
|
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_contiguousRow = -1;
|
private $_contiguousRow = -1;
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_CSV
|
* Create a new PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
} // function __construct()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param string $pFileName
|
|
||||||
* @return boolean
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function canRead($pFilename)
|
|
||||||
{
|
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
} // function canRead()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Validate that the current file is a CSV file
|
||||||
*
|
*
|
||||||
* @access public
|
* @return boolean
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
*/
|
||||||
public function getReadFilter() {
|
protected function _isValidFormat()
|
||||||
return $this->_readFilter;
|
{
|
||||||
} // function getReadFilter()
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
} // function setReadFilter()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set input encoding
|
* Set input encoding
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pValue Input encoding
|
* @param string $pValue Input encoding
|
||||||
*/
|
*/
|
||||||
public function setInputEncoding($pValue = 'UTF-8')
|
public function setInputEncoding($pValue = 'UTF-8')
|
||||||
{
|
{
|
||||||
$this->_inputEncoding = $pValue;
|
$this->_inputEncoding = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
} // function setInputEncoding()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get input encoding
|
* Get input encoding
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getInputEncoding()
|
public function getInputEncoding()
|
||||||
{
|
{
|
||||||
return $this->_inputEncoding;
|
return $this->_inputEncoding;
|
||||||
} // function getInputEncoding()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Move filepointer past any BOM marker
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pFilename
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
protected function _skipBOM()
|
||||||
{
|
{
|
||||||
// Check if file exists
|
rewind($this->_fileHandle);
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open file
|
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
|
||||||
if ($fileHandle === false) {
|
|
||||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip BOM, if any
|
|
||||||
switch ($this->_inputEncoding) {
|
switch ($this->_inputEncoding) {
|
||||||
case 'UTF-8':
|
case 'UTF-8':
|
||||||
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||||
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
|
||||||
break;
|
break;
|
||||||
case 'UTF-16LE':
|
case 'UTF-16LE':
|
||||||
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
fgets($this->_fileHandle, 3) == "\xFF\xFE" ?
|
||||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||||
break;
|
break;
|
||||||
case 'UTF-16BE':
|
case 'UTF-16BE':
|
||||||
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
fgets($this->_fileHandle, 3) == "\xFE\xFF" ?
|
||||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||||
break;
|
break;
|
||||||
case 'UTF-32LE':
|
case 'UTF-32LE':
|
||||||
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||||
break;
|
break;
|
||||||
case 'UTF-32BE':
|
case 'UTF-32BE':
|
||||||
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws PHPExcel_Reader_Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Open file
|
||||||
|
$this->_openFile($pFilename);
|
||||||
|
if (!$this->_isValidFormat()) {
|
||||||
|
fclose ($this->_fileHandle);
|
||||||
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
|
}
|
||||||
|
$fileHandle = $this->_fileHandle;
|
||||||
|
|
||||||
|
// Skip BOM, if any
|
||||||
|
$this->_skipBOM();
|
||||||
|
|
||||||
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
|
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
|
||||||
|
|
||||||
@ -255,14 +215,12 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $worksheetInfo;
|
return $worksheetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -271,65 +229,37 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Load into this instance
|
// Load into this instance
|
||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
} // function load()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new PHPExcel
|
|
||||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
|
||||||
$objPHPExcel->createSheet();
|
|
||||||
}
|
|
||||||
$sheet = $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex );
|
|
||||||
|
|
||||||
$lineEnding = ini_get('auto_detect_line_endings');
|
$lineEnding = ini_get('auto_detect_line_endings');
|
||||||
ini_set('auto_detect_line_endings', true);
|
ini_set('auto_detect_line_endings', true);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$this->_openFile($pFilename);
|
||||||
if ($fileHandle === false) {
|
if (!$this->_isValidFormat()) {
|
||||||
throw new Exception("Could not open file $pFilename for reading.");
|
fclose ($this->_fileHandle);
|
||||||
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
$fileHandle = $this->_fileHandle;
|
||||||
|
|
||||||
// Skip BOM, if any
|
// Skip BOM, if any
|
||||||
switch ($this->_inputEncoding) {
|
$this->_skipBOM();
|
||||||
case 'UTF-8':
|
|
||||||
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
// Create new PHPExcel object
|
||||||
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||||
break;
|
$objPHPExcel->createSheet();
|
||||||
case 'UTF-16LE':
|
|
||||||
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
|
||||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
|
||||||
break;
|
|
||||||
case 'UTF-16BE':
|
|
||||||
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
|
||||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
|
||||||
break;
|
|
||||||
case 'UTF-32LE':
|
|
||||||
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
|
||||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
|
||||||
break;
|
|
||||||
case 'UTF-32BE':
|
|
||||||
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
|
||||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex);
|
||||||
|
|
||||||
$escapeEnclosures = array( "\\" . $this->_enclosure,
|
$escapeEnclosures = array( "\\" . $this->_enclosure,
|
||||||
$this->_enclosure . $this->_enclosure
|
$this->_enclosure . $this->_enclosure
|
||||||
@ -373,48 +303,40 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
} // function loadIntoExisting()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get delimiter
|
* Get delimiter
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDelimiter() {
|
public function getDelimiter() {
|
||||||
return $this->_delimiter;
|
return $this->_delimiter;
|
||||||
} // function getDelimiter()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set delimiter
|
* Set delimiter
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pValue Delimiter, defaults to ,
|
* @param string $pValue Delimiter, defaults to ,
|
||||||
* @return PHPExcel_Reader_CSV
|
* @return PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
public function setDelimiter($pValue = ',') {
|
public function setDelimiter($pValue = ',') {
|
||||||
$this->_delimiter = $pValue;
|
$this->_delimiter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
} // function setDelimiter()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get enclosure
|
* Get enclosure
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEnclosure() {
|
public function getEnclosure() {
|
||||||
return $this->_enclosure;
|
return $this->_enclosure;
|
||||||
} // function getEnclosure()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set enclosure
|
* Set enclosure
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pValue Enclosure, defaults to "
|
* @param string $pValue Enclosure, defaults to "
|
||||||
* @return PHPExcel_Reader_CSV
|
* @return PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
@ -424,82 +346,70 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
$this->_enclosure = $pValue;
|
$this->_enclosure = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
} // function setEnclosure()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get line ending
|
* Get line ending
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLineEnding() {
|
public function getLineEnding() {
|
||||||
return $this->_lineEnding;
|
return $this->_lineEnding;
|
||||||
} // function getLineEnding()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set line ending
|
* Set line ending
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||||
* @return PHPExcel_Reader_CSV
|
* @return PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
public function setLineEnding($pValue = PHP_EOL) {
|
public function setLineEnding($pValue = PHP_EOL) {
|
||||||
$this->_lineEnding = $pValue;
|
$this->_lineEnding = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
} // function setLineEnding()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sheet index
|
* Get sheet index
|
||||||
*
|
*
|
||||||
* @access public
|
* @return integer
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getSheetIndex() {
|
public function getSheetIndex() {
|
||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
} // function getSheetIndex()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
* @access public
|
* @param integer $pValue Sheet index
|
||||||
* @param int $pValue Sheet index
|
|
||||||
* @return PHPExcel_Reader_CSV
|
* @return PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue = 0) {
|
public function setSheetIndex($pValue = 0) {
|
||||||
$this->_sheetIndex = $pValue;
|
$this->_sheetIndex = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
} // function setSheetIndex()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Contiguous
|
* Set Contiguous
|
||||||
*
|
*
|
||||||
* @access public
|
* @param boolean $contiguous
|
||||||
* @param string $pValue Input encoding
|
|
||||||
*/
|
*/
|
||||||
public function setContiguous($contiguous = false)
|
public function setContiguous($contiguous = FALSE)
|
||||||
{
|
{
|
||||||
$this->_contiguous = (bool)$contiguous;
|
$this->_contiguous = (bool) $contiguous;
|
||||||
if (!$contiguous) {
|
if (!$contiguous) {
|
||||||
$this->_contiguousRow = -1;
|
$this->_contiguousRow = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // function setInputEncoding()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Contiguous
|
* Get Contiguous
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getContiguous() {
|
public function getContiguous() {
|
||||||
return $this->_contiguous;
|
return $this->_contiguous;
|
||||||
} // function getSheetIndex()
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,24 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
private $_readDataOnly = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restict which sheets should be loaded?
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $_loadSheetsOnly = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats
|
* Formats
|
||||||
*
|
*
|
||||||
@ -65,13 +51,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_styles = array();
|
private $_styles = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character set used in the file
|
* Character set used in the file
|
||||||
*
|
*
|
||||||
@ -88,93 +67,12 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getReadDataOnly() {
|
|
||||||
return $this->_readDataOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read data only
|
|
||||||
*
|
|
||||||
* @param boolean $pValue
|
|
||||||
* @return PHPExcel_Reader_Excel2003XML
|
|
||||||
*/
|
|
||||||
public function setReadDataOnly($pValue = false) {
|
|
||||||
$this->_readDataOnly = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get which sheets to load
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getLoadSheetsOnly()
|
|
||||||
{
|
|
||||||
return $this->_loadSheetsOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set which sheets to load
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* @return PHPExcel_Reader_Excel2003XML
|
|
||||||
*/
|
|
||||||
public function setLoadSheetsOnly($value = null)
|
|
||||||
{
|
|
||||||
$this->_loadSheetsOnly = is_array($value) ?
|
|
||||||
$value : array($value);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all sheets to load
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_Excel2003XML
|
|
||||||
*/
|
|
||||||
public function setLoadAllSheets()
|
|
||||||
{
|
|
||||||
$this->_loadSheetsOnly = null;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
* @return PHPExcel_Reader_Excel2003XML
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFilename
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
@ -194,15 +92,13 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
'<?mso-application progid="Excel.Sheet"?>'
|
'<?mso-application progid="Excel.Sheet"?>'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check if file exists
|
// Open file
|
||||||
if (!file_exists($pFilename)) {
|
$this->_openFile($pFilename);
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
$fileHandle = $this->_fileHandle;
|
||||||
}
|
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
// Read sample data (first 2 KB will do)
|
||||||
$fh = fopen($pFilename, 'r');
|
$data = fread($fileHandle, 2048);
|
||||||
$data = fread($fh, 2048);
|
fclose($fileHandle);
|
||||||
fclose($fh);
|
|
||||||
|
|
||||||
$valid = true;
|
$valid = true;
|
||||||
foreach($signature as $match) {
|
foreach($signature as $match) {
|
||||||
@ -227,21 +123,21 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
if (!$this->canRead($pFilename)) {
|
if (!$this->canRead($pFilename)) {
|
||||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
|
|
||||||
$xml = simplexml_load_file($pFilename);
|
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespaces = $xml->getNamespaces(true);
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
$xml_ss = $xml->children($namespaces['ss']);
|
$xml_ss = $xml->children($namespaces['ss']);
|
||||||
@ -258,18 +154,18 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
|
|
||||||
$xml = simplexml_load_file($pFilename);
|
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespaces = $xml->getNamespaces(true);
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
$worksheetID = 1;
|
$worksheetID = 1;
|
||||||
@ -330,7 +226,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -392,7 +288,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
@ -427,14 +323,14 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->canRead($pFilename)) {
|
if (!$this->canRead($pFilename)) {
|
||||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = simplexml_load_file($pFilename);
|
$xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespaces = $xml->getNamespaces(true);
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
$docProps = $objPHPExcel->getProperties();
|
$docProps = $objPHPExcel->getProperties();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -19,10 +19,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2007_Chart
|
class PHPExcel_Reader_Excel2007_Chart
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||||||
} elseif ($format == 'integer') {
|
} elseif ($format == 'integer') {
|
||||||
return (integer) $attributes[$name];
|
return (integer) $attributes[$name];
|
||||||
} elseif ($format == 'boolean') {
|
} elseif ($format == 'boolean') {
|
||||||
return (boolean) ($attributes[$name] == '0') ? false : true;
|
return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
|
||||||
} else {
|
} else {
|
||||||
return (float) $attributes[$name];
|
return (float) $attributes[$name];
|
||||||
}
|
}
|
||||||
@ -347,6 +347,10 @@ class PHPExcel_Reader_Excel2007_Chart
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($seriesVal)) {
|
||||||
|
$seriesVal = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return array( 'formatCode' => $formatCode,
|
return array( 'formatCode' => $formatCode,
|
||||||
'pointCount' => $pointCount,
|
'pointCount' => $pointCount,
|
||||||
'dataValues' => $seriesVal
|
'dataValues' => $seriesVal
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel2007
|
* @package PHPExcel_Reader_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2007_Theme
|
class PHPExcel_Reader_Excel2007_Theme
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel5_Escher
|
class PHPExcel_Reader_Excel5_Escher
|
||||||
{
|
{
|
||||||
|
|||||||
221
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php
Normal file
221
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader_Excel5
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Excel5_MD5
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader_Excel5
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_Excel5_MD5
|
||||||
|
{
|
||||||
|
// Context
|
||||||
|
private $a;
|
||||||
|
private $b;
|
||||||
|
private $c;
|
||||||
|
private $d;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MD5 stream constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the MD5 stream context
|
||||||
|
*/
|
||||||
|
public function reset()
|
||||||
|
{
|
||||||
|
$this->a = 0x67452301;
|
||||||
|
$this->b = 0xEFCDAB89;
|
||||||
|
$this->c = 0x98BADCFE;
|
||||||
|
$this->d = 0x10325476;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get MD5 stream context
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getContext()
|
||||||
|
{
|
||||||
|
$s = '';
|
||||||
|
foreach (array('a', 'b', 'c', 'd') as $i) {
|
||||||
|
$v = $this->{$i};
|
||||||
|
$s .= chr($v & 0xff);
|
||||||
|
$s .= chr(($v >> 8) & 0xff);
|
||||||
|
$s .= chr(($v >> 16) & 0xff);
|
||||||
|
$s .= chr(($v >> 24) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add data to context
|
||||||
|
*
|
||||||
|
* @param string $data Data to add
|
||||||
|
*/
|
||||||
|
public function add($data)
|
||||||
|
{
|
||||||
|
$words = array_values(unpack('V16', $data));
|
||||||
|
|
||||||
|
$A = $this->a;
|
||||||
|
$B = $this->b;
|
||||||
|
$C = $this->c;
|
||||||
|
$D = $this->d;
|
||||||
|
|
||||||
|
$F = array('PHPExcel_Reader_Excel5_MD5','F');
|
||||||
|
$G = array('PHPExcel_Reader_Excel5_MD5','G');
|
||||||
|
$H = array('PHPExcel_Reader_Excel5_MD5','H');
|
||||||
|
$I = array('PHPExcel_Reader_Excel5_MD5','I');
|
||||||
|
|
||||||
|
/* ROUND 1 */
|
||||||
|
self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478);
|
||||||
|
self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756);
|
||||||
|
self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db);
|
||||||
|
self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee);
|
||||||
|
self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf);
|
||||||
|
self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a);
|
||||||
|
self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613);
|
||||||
|
self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501);
|
||||||
|
self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8);
|
||||||
|
self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af);
|
||||||
|
self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1);
|
||||||
|
self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be);
|
||||||
|
self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122);
|
||||||
|
self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193);
|
||||||
|
self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e);
|
||||||
|
self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821);
|
||||||
|
|
||||||
|
/* ROUND 2 */
|
||||||
|
self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562);
|
||||||
|
self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340);
|
||||||
|
self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51);
|
||||||
|
self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa);
|
||||||
|
self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d);
|
||||||
|
self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453);
|
||||||
|
self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681);
|
||||||
|
self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8);
|
||||||
|
self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6);
|
||||||
|
self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6);
|
||||||
|
self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87);
|
||||||
|
self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed);
|
||||||
|
self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905);
|
||||||
|
self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8);
|
||||||
|
self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9);
|
||||||
|
self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a);
|
||||||
|
|
||||||
|
/* ROUND 3 */
|
||||||
|
self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942);
|
||||||
|
self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681);
|
||||||
|
self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122);
|
||||||
|
self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c);
|
||||||
|
self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44);
|
||||||
|
self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9);
|
||||||
|
self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60);
|
||||||
|
self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70);
|
||||||
|
self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6);
|
||||||
|
self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa);
|
||||||
|
self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085);
|
||||||
|
self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05);
|
||||||
|
self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039);
|
||||||
|
self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5);
|
||||||
|
self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8);
|
||||||
|
self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665);
|
||||||
|
|
||||||
|
/* ROUND 4 */
|
||||||
|
self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244);
|
||||||
|
self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97);
|
||||||
|
self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7);
|
||||||
|
self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039);
|
||||||
|
self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3);
|
||||||
|
self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92);
|
||||||
|
self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d);
|
||||||
|
self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1);
|
||||||
|
self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f);
|
||||||
|
self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0);
|
||||||
|
self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314);
|
||||||
|
self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1);
|
||||||
|
self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82);
|
||||||
|
self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235);
|
||||||
|
self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb);
|
||||||
|
self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391);
|
||||||
|
|
||||||
|
$this->a = ($this->a + $A) & 0xffffffff;
|
||||||
|
$this->b = ($this->b + $B) & 0xffffffff;
|
||||||
|
$this->c = ($this->c + $C) & 0xffffffff;
|
||||||
|
$this->d = ($this->d + $D) & 0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function F($X, $Y, $Z)
|
||||||
|
{
|
||||||
|
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function G($X, $Y, $Z)
|
||||||
|
{
|
||||||
|
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function H($X, $Y, $Z)
|
||||||
|
{
|
||||||
|
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function I($X, $Y, $Z)
|
||||||
|
{
|
||||||
|
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||||
|
{
|
||||||
|
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
||||||
|
$A = self::rotate($A, $s);
|
||||||
|
$A = ($B + $A) & 0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function rotate($decimal, $bits)
|
||||||
|
{
|
||||||
|
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
||||||
|
return bindec(substr($binary, $bits).substr($binary, 0, $bits));
|
||||||
|
}
|
||||||
|
}
|
||||||
88
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php
Normal file
88
htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader_Excel5
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Excel5_RC4
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader_Excel5
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_Excel5_RC4
|
||||||
|
{
|
||||||
|
// Context
|
||||||
|
var $s = array();
|
||||||
|
var $i = 0;
|
||||||
|
var $j = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RC4 stream decryption/encryption constrcutor
|
||||||
|
*
|
||||||
|
* @param string $key Encryption key/passphrase
|
||||||
|
*/
|
||||||
|
public function __construct($key)
|
||||||
|
{
|
||||||
|
$len = strlen($key);
|
||||||
|
|
||||||
|
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||||
|
$this->s[$this->i] = $this->i;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->j = 0;
|
||||||
|
for ($this->i = 0; $this->i < 256; $this->i++) {
|
||||||
|
$this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
|
||||||
|
$t = $this->s[$this->i];
|
||||||
|
$this->s[$this->i] = $this->s[$this->j];
|
||||||
|
$this->s[$this->j] = $t;
|
||||||
|
}
|
||||||
|
$this->i = $this->j = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Symmetric decryption/encryption function
|
||||||
|
*
|
||||||
|
* @param string $data Data to encrypt/decrypt
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function RC4($data)
|
||||||
|
{
|
||||||
|
$len = strlen($data);
|
||||||
|
for ($c = 0; $c < $len; $c++) {
|
||||||
|
$this->i = ($this->i + 1) % 256;
|
||||||
|
$this->j = ($this->j + $this->s[$this->i]) % 256;
|
||||||
|
$t = $this->s[$this->i];
|
||||||
|
$this->s[$this->i] = $this->s[$this->j];
|
||||||
|
$this->s[$this->j] = $t;
|
||||||
|
|
||||||
|
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
|
||||||
|
|
||||||
|
$data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
52
htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php
Normal file
52
htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.8.0, 2014-03-02
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Exception
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_Exception extends PHPExcel_Exception {
|
||||||
|
/**
|
||||||
|
* Error handler callback
|
||||||
|
*
|
||||||
|
* @param mixed $code
|
||||||
|
* @param mixed $string
|
||||||
|
* @param mixed $file
|
||||||
|
* @param mixed $line
|
||||||
|
* @param mixed $context
|
||||||
|
*/
|
||||||
|
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||||
|
$e = new self($string, $code);
|
||||||
|
$e->line = $line;
|
||||||
|
$e->file = $file;
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,27 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
|
||||||
* or whether it should read both data and formatting
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
private $_readDataOnly = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restrict which sheets should be loaded?
|
|
||||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
|
||||||
*
|
|
||||||
* @var array of string
|
|
||||||
*/
|
|
||||||
private $_loadSheetsOnly = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats
|
* Formats
|
||||||
*
|
*
|
||||||
@ -77,13 +60,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
private $_referenceHelper = null;
|
private $_referenceHelper = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_Gnumeric
|
* Create a new PHPExcel_Reader_Gnumeric
|
||||||
@ -94,115 +70,23 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
|
||||||
* If false (the default) it will read data and formatting.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getReadDataOnly() {
|
|
||||||
return $this->_readDataOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read data only
|
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
|
||||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
|
||||||
*
|
|
||||||
* @param boolean $pValue
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_Gnumeric
|
|
||||||
*/
|
|
||||||
public function setReadDataOnly($pValue = false) {
|
|
||||||
$this->_readDataOnly = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get which sheets to load
|
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
|
||||||
* indicating that all worksheets in the workbook should be loaded.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getLoadSheetsOnly()
|
|
||||||
{
|
|
||||||
return $this->_loadSheetsOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set which sheets to load
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
|
||||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_Gnumeric
|
|
||||||
*/
|
|
||||||
public function setLoadSheetsOnly($value = null)
|
|
||||||
{
|
|
||||||
$this->_loadSheetsOnly = is_array($value) ?
|
|
||||||
$value : array($value);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all sheets to load
|
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_Gnumeric
|
|
||||||
*/
|
|
||||||
public function setLoadAllSheets()
|
|
||||||
{
|
|
||||||
$this->_loadSheetsOnly = null;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
* @return PHPExcel_Reader_Gnumeric
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFilename
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if gzlib functions are available
|
// Check if gzlib functions are available
|
||||||
if (!function_exists('gzread')) {
|
if (!function_exists('gzread')) {
|
||||||
throw new Exception("gzlib library is not enabled");
|
throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read signature data (first 3 bytes)
|
// Read signature data (first 3 bytes)
|
||||||
@ -218,51 +102,88 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws PHPExcel_Reader_Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetNames($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = new XMLReader();
|
||||||
|
$xml->open(
|
||||||
|
'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
|
$xml->setParserProperty(2,true);
|
||||||
|
|
||||||
|
$worksheetNames = array();
|
||||||
|
while ($xml->read()) {
|
||||||
|
if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||||
|
$xml->read(); // Move onto the value node
|
||||||
|
$worksheetNames[] = (string) $xml->value;
|
||||||
|
} elseif ($xml->name == 'gnm:Sheets') {
|
||||||
|
// break out of the loop once we've got our sheet names rather than parse the entire file
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
$xml = new XMLReader();
|
||||||
|
$xml->open(
|
||||||
$xml = simplexml_load_string($gFileData);
|
'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
|
||||||
$namespacesMeta = $xml->getNamespaces(true);
|
);
|
||||||
|
$xml->setParserProperty(2,true);
|
||||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
|
while ($xml->read()) {
|
||||||
|
if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||||
|
$tmpInfo = array(
|
||||||
|
'worksheetName' => '',
|
||||||
|
'lastColumnLetter' => 'A',
|
||||||
|
'lastColumnIndex' => 0,
|
||||||
|
'totalRows' => 0,
|
||||||
|
'totalColumns' => 0,
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($gnmXML->Sheets->Sheet as $sheet) {
|
while ($xml->read()) {
|
||||||
$tmpInfo = array();
|
if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||||
$tmpInfo['worksheetName'] = (string) $sheet->Name;
|
$xml->read(); // Move onto the value node
|
||||||
$tmpInfo['lastColumnLetter'] = 'A';
|
$tmpInfo['worksheetName'] = (string) $xml->value;
|
||||||
$tmpInfo['lastColumnIndex'] = 0;
|
} elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||||
$tmpInfo['totalRows'] = 0;
|
$xml->read(); // Move onto the value node
|
||||||
$tmpInfo['totalColumns'] = 0;
|
$tmpInfo['lastColumnIndex'] = (int) $xml->value;
|
||||||
|
$tmpInfo['totalColumns'] = (int) $xml->value + 1;
|
||||||
foreach ($sheet->Cells->Cell as $cell) {
|
} elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||||
$cellAttributes = $cell->attributes();
|
$xml->read(); // Move onto the value node
|
||||||
|
$tmpInfo['totalRows'] = (int) $xml->value + 1;
|
||||||
$rowIndex = (int) $cellAttributes->Row + 1;
|
break;
|
||||||
$columnIndex = (int) $cellAttributes->Col;
|
}
|
||||||
|
|
||||||
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
|
||||||
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
|
||||||
|
|
||||||
$worksheetInfo[] = $tmpInfo;
|
$worksheetInfo[] = $tmpInfo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $worksheetInfo;
|
return $worksheetInfo;
|
||||||
}
|
}
|
||||||
@ -286,7 +207,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -298,49 +219,19 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
|
||||||
*
|
|
||||||
* @param string $pFilename
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function listWorksheetNames($pFilename)
|
|
||||||
{
|
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
|
||||||
|
|
||||||
$xml = simplexml_load_string($gFileData);
|
|
||||||
$namespacesMeta = $xml->getNamespaces(true);
|
|
||||||
|
|
||||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
|
||||||
|
|
||||||
$worksheetNames = array();
|
|
||||||
|
|
||||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
|
||||||
$worksheetNames[] = (string) $sheet->Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $worksheetNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
@ -352,7 +243,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
|
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
|
||||||
// echo '</pre><hr />';
|
// echo '</pre><hr />';
|
||||||
//
|
//
|
||||||
$xml = simplexml_load_string($gFileData);
|
$xml = simplexml_load_string($gFileData, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespacesMeta = $xml->getNamespaces(true);
|
$namespacesMeta = $xml->getNamespaces(true);
|
||||||
|
|
||||||
// var_dump($namespacesMeta);
|
// var_dump($namespacesMeta);
|
||||||
@ -620,7 +511,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// We still set the number format mask for date/time values, even if _readDataOnly is true
|
// We still set the number format mask for date/time values, even if _readDataOnly is true
|
||||||
if ((!$this->_readDataOnly) ||
|
if ((!$this->_readDataOnly) ||
|
||||||
(PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) {
|
(PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
|
||||||
$styleArray = array();
|
$styleArray = array();
|
||||||
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
||||||
// If _readDataOnly is false, we set all formatting information
|
// If _readDataOnly is false, we set all formatting information
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Input encoding
|
* Input encoding
|
||||||
@ -100,13 +100,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
), // Bottom border
|
), // Bottom border
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_HTML
|
* Create a new PHPExcel_Reader_HTML
|
||||||
@ -116,25 +109,20 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Validate that the current file is an HTML file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
protected function _isValidFormat()
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Reading 2048 bytes should be enough to validate that the format is HTML
|
||||||
if (!file_exists($pFilename)) {
|
$data = fread($this->_fileHandle, 2048);
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
if ((strpos($data, '<') !== FALSE) &&
|
||||||
|
(strlen($data) !== strlen(strip_tags($data)))) {
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
return FALSE;
|
||||||
$fh = fopen($pFilename, 'r');
|
|
||||||
$data = fread($fh, 2048);
|
|
||||||
fclose($fh);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +130,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -153,25 +141,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set input encoding
|
* Set input encoding
|
||||||
*
|
*
|
||||||
@ -222,7 +191,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
// Simple String content
|
// Simple String content
|
||||||
if (trim($cellContent) > '') {
|
if (trim($cellContent) > '') {
|
||||||
// Only actually write it if there's content in the string
|
// Only actually write it if there's content in the string
|
||||||
echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
|
// echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
|
||||||
// Write to worksheet to be done here...
|
// Write to worksheet to be done here...
|
||||||
// ... we return the cell so we can mess about with styles more easily
|
// ... we return the cell so we can mess about with styles more easily
|
||||||
$cell = $sheet->setCellValue($column.$row,$cellContent,true);
|
$cell = $sheet->setCellValue($column.$row,$cellContent,true);
|
||||||
@ -238,7 +207,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){
|
private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){
|
||||||
foreach($element->childNodes as $child){
|
foreach($element->childNodes as $child){
|
||||||
if ($child instanceOf DOMText) {
|
if ($child instanceof DOMText) {
|
||||||
$domText = preg_replace('/\s+/',' ',trim($child->nodeValue));
|
$domText = preg_replace('/\s+/',' ',trim($child->nodeValue));
|
||||||
if (is_string($cellContent)) {
|
if (is_string($cellContent)) {
|
||||||
// simply append the text if the cell content is a plain text string
|
// simply append the text if the cell content is a plain text string
|
||||||
@ -247,12 +216,12 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
// but if we have a rich text run instead, we need to append it correctly
|
// but if we have a rich text run instead, we need to append it correctly
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
} elseif($child instanceOf DOMElement) {
|
} elseif($child instanceof DOMElement) {
|
||||||
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
// echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
||||||
|
|
||||||
$attributeArray = array();
|
$attributeArray = array();
|
||||||
foreach($child->attributes as $attribute) {
|
foreach($child->attributes as $attribute) {
|
||||||
echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
|
// echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
|
||||||
$attributeArray[$attribute->name] = $attribute->value;
|
$attributeArray[$attribute->name] = $attribute->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,13 +249,13 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
case 'em' :
|
case 'em' :
|
||||||
case 'strong':
|
case 'strong':
|
||||||
case 'b' :
|
case 'b' :
|
||||||
echo 'STYLING, SPAN OR DIV<br />';
|
// echo 'STYLING, SPAN OR DIV<br />';
|
||||||
if ($cellContent > '')
|
if ($cellContent > '')
|
||||||
$cellContent .= ' ';
|
$cellContent .= ' ';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
if ($cellContent > '')
|
if ($cellContent > '')
|
||||||
$cellContent .= ' ';
|
$cellContent .= ' ';
|
||||||
echo 'END OF STYLING, SPAN OR DIV<br />';
|
// echo 'END OF STYLING, SPAN OR DIV<br />';
|
||||||
break;
|
break;
|
||||||
case 'hr' :
|
case 'hr' :
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
@ -307,14 +276,14 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
++$row;
|
++$row;
|
||||||
}
|
}
|
||||||
echo 'HARD LINE BREAK: ' , '<br />';
|
// echo 'HARD LINE BREAK: ' , '<br />';
|
||||||
break;
|
break;
|
||||||
case 'a' :
|
case 'a' :
|
||||||
echo 'START OF HYPERLINK: ' , '<br />';
|
// echo 'START OF HYPERLINK: ' , '<br />';
|
||||||
foreach($attributeArray as $attributeName => $attributeValue) {
|
foreach($attributeArray as $attributeName => $attributeValue) {
|
||||||
switch($attributeName) {
|
switch($attributeName) {
|
||||||
case 'href':
|
case 'href':
|
||||||
echo 'Link to ' , $attributeValue , '<br />';
|
// echo 'Link to ' , $attributeValue , '<br />';
|
||||||
$sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue);
|
$sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue);
|
||||||
if (isset($this->_formats[$child->nodeName])) {
|
if (isset($this->_formats[$child->nodeName])) {
|
||||||
$sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]);
|
$sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]);
|
||||||
@ -324,7 +293,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
$cellContent .= ' ';
|
$cellContent .= ' ';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF HYPERLINK:' , '<br />';
|
// echo 'END OF HYPERLINK:' , '<br />';
|
||||||
break;
|
break;
|
||||||
case 'h1' :
|
case 'h1' :
|
||||||
case 'h2' :
|
case 'h2' :
|
||||||
@ -338,17 +307,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
if ($this->_tableLevel > 0) {
|
if ($this->_tableLevel > 0) {
|
||||||
// If we're inside a table, replace with a \n
|
// If we're inside a table, replace with a \n
|
||||||
$cellContent .= "\n";
|
$cellContent .= "\n";
|
||||||
echo 'LIST ENTRY: ' , '<br />';
|
// echo 'LIST ENTRY: ' , '<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF LIST ENTRY:' , '<br />';
|
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||||
} else {
|
} else {
|
||||||
if ($cellContent > '') {
|
if ($cellContent > '') {
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
$row += 2;
|
$row += 2;
|
||||||
}
|
}
|
||||||
echo 'START OF PARAGRAPH: ' , '<br />';
|
// echo 'START OF PARAGRAPH: ' , '<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF PARAGRAPH:' , '<br />';
|
// echo 'END OF PARAGRAPH:' , '<br />';
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
|
|
||||||
if (isset($this->_formats[$child->nodeName])) {
|
if (isset($this->_formats[$child->nodeName])) {
|
||||||
@ -363,17 +332,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
if ($this->_tableLevel > 0) {
|
if ($this->_tableLevel > 0) {
|
||||||
// If we're inside a table, replace with a \n
|
// If we're inside a table, replace with a \n
|
||||||
$cellContent .= "\n";
|
$cellContent .= "\n";
|
||||||
echo 'LIST ENTRY: ' , '<br />';
|
// echo 'LIST ENTRY: ' , '<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF LIST ENTRY:' , '<br />';
|
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||||
} else {
|
} else {
|
||||||
if ($cellContent > '') {
|
if ($cellContent > '') {
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
}
|
}
|
||||||
++$row;
|
++$row;
|
||||||
echo 'LIST ENTRY: ' , '<br />';
|
// echo 'LIST ENTRY: ' , '<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF LIST ENTRY:' , '<br />';
|
// echo 'END OF LIST ENTRY:' , '<br />';
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
$column = 'A';
|
$column = 'A';
|
||||||
}
|
}
|
||||||
@ -381,11 +350,11 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
case 'table' :
|
case 'table' :
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
$column = $this->_setTableStartColumn($column);
|
$column = $this->_setTableStartColumn($column);
|
||||||
echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
// echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||||
if ($this->_tableLevel > 1)
|
if ($this->_tableLevel > 1)
|
||||||
--$row;
|
--$row;
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
// echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
|
||||||
$column = $this->_releaseTableStartColumn();
|
$column = $this->_releaseTableStartColumn();
|
||||||
if ($this->_tableLevel > 1) {
|
if ($this->_tableLevel > 1) {
|
||||||
++$column;
|
++$column;
|
||||||
@ -401,15 +370,15 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
++$row;
|
++$row;
|
||||||
$column = $this->_getTableStartColumn();
|
$column = $this->_getTableStartColumn();
|
||||||
$cellContent = '';
|
$cellContent = '';
|
||||||
echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
// echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
// echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
|
||||||
break;
|
break;
|
||||||
case 'th' :
|
case 'th' :
|
||||||
case 'td' :
|
case 'td' :
|
||||||
echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
// echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||||
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
|
||||||
echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
// echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
|
||||||
$this->_flushCell($sheet,$column,$row,$cellContent);
|
$this->_flushCell($sheet,$column,$row,$cellContent);
|
||||||
++$column;
|
++$column;
|
||||||
break;
|
break;
|
||||||
@ -433,18 +402,18 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Open file to validate
|
||||||
if (!file_exists($pFilename)) {
|
$this->_openFile($pFilename);
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
if (!$this->_isValidFormat()) {
|
||||||
}
|
fclose ($this->_fileHandle);
|
||||||
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file.");
|
||||||
if (!is_file($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! The given file is not a regular file.");
|
|
||||||
}
|
}
|
||||||
|
// Close after validating
|
||||||
|
fclose ($this->_fileHandle);
|
||||||
|
|
||||||
// Create new PHPExcel
|
// Create new PHPExcel
|
||||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||||
@ -454,10 +423,10 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Create a new DOM object
|
// Create a new DOM object
|
||||||
$dom = new domDocument;
|
$dom = new domDocument;
|
||||||
// Load the HTML file into the DOM object
|
// Reload the HTML file into the DOM object
|
||||||
$loaded = $dom->loadHTMLFile($pFilename);
|
$loaded = $dom->loadHTMLFile($pFilename, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
if ($loaded === false) {
|
if ($loaded === FALSE) {
|
||||||
throw new Exception('Failed to load ',$pFilename,' as a DOM Document');
|
throw new PHPExcel_Reader_Exception('Failed to load ',$pFilename,' as a DOM Document');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard white space
|
// Discard white space
|
||||||
@ -469,8 +438,8 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
$content = '';
|
$content = '';
|
||||||
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);
|
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);
|
||||||
|
|
||||||
echo '<hr />';
|
// echo '<hr />';
|
||||||
var_dump($this->_dataArray);
|
// var_dump($this->_dataArray);
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Reader_IReadFilter
|
interface PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,14 +31,14 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Reader_IReader
|
interface PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFilename
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename);
|
public function canRead($pFilename);
|
||||||
@ -46,8 +46,8 @@ interface PHPExcel_Reader_IReader
|
|||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename);
|
public function load($pFilename);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,27 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
|
||||||
* or whether it should read both data and formatting
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
private $_readDataOnly = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restrict which sheets should be loaded?
|
|
||||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
|
||||||
*
|
|
||||||
* @var array of string
|
|
||||||
*/
|
|
||||||
private $_loadSheetsOnly = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats
|
* Formats
|
||||||
*
|
*
|
||||||
@ -68,13 +51,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_styles = array();
|
private $_styles = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_OOCalc
|
* Create a new PHPExcel_Reader_OOCalc
|
||||||
@ -84,126 +60,48 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read data only?
|
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
|
||||||
* If false (the default) it will read data and formatting.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getReadDataOnly() {
|
|
||||||
return $this->_readDataOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read data only
|
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
|
||||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
|
||||||
*
|
|
||||||
* @param boolean $pValue
|
|
||||||
* @return PHPExcel_Reader_OOCalc
|
|
||||||
*/
|
|
||||||
public function setReadDataOnly($pValue = false) {
|
|
||||||
$this->_readDataOnly = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get which sheets to load
|
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
|
||||||
* indicating that all worksheets in the workbook should be loaded.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getLoadSheetsOnly()
|
|
||||||
{
|
|
||||||
return $this->_loadSheetsOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set which sheets to load
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
|
||||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_OOCalc
|
|
||||||
*/
|
|
||||||
public function setLoadSheetsOnly($value = null)
|
|
||||||
{
|
|
||||||
$this->_loadSheetsOnly = is_array($value) ?
|
|
||||||
$value : array($value);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all sheets to load
|
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_OOCalc
|
|
||||||
*/
|
|
||||||
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_OOCalc
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFilename
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$zipClass = PHPExcel_Settings::getZipClass();
|
||||||
|
|
||||||
// Check if zip class exists
|
// Check if zip class exists
|
||||||
if (!class_exists('ZipArchive',FALSE)) {
|
// if (!class_exists($zipClass, FALSE)) {
|
||||||
throw new Exception("ZipArchive library is not enabled");
|
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$mimeType = 'UNKNOWN';
|
||||||
// Load file
|
// Load file
|
||||||
$zip = new ZipArchive;
|
$zip = new $zipClass;
|
||||||
if ($zip->open($pFilename) === true) {
|
if ($zip->open($pFilename) === true) {
|
||||||
// check if it is an OOXML archive
|
// check if it is an OOXML archive
|
||||||
$stat = $zip->statName('mimetype');
|
$stat = $zip->statName('mimetype');
|
||||||
if ($stat && ($stat['size'] <= 255)) {
|
if ($stat && ($stat['size'] <= 255)) {
|
||||||
$mimeType = $zip->getFromName($stat['name']);
|
$mimeType = $zip->getFromName($stat['name']);
|
||||||
} else {
|
} elseif($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||||
$zip->close();
|
$xml = simplexml_load_string($zip->getFromName('META-INF/manifest.xml'), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
return FALSE;
|
$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();
|
$zip->close();
|
||||||
@ -219,30 +117,46 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$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();
|
$worksheetNames = array();
|
||||||
|
|
||||||
$zip = new ZipArchive;
|
$xml = new XMLReader();
|
||||||
if ($zip->open($pFilename) === true) {
|
$res = $xml->open('zip://'.realpath($pFilename).'#content.xml', null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
|
$xml->setParserProperty(2,true);
|
||||||
|
|
||||||
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
// Step into the first level of content of the XML
|
||||||
$namespacesContent = $xml->getNamespaces(true);
|
$xml->read();
|
||||||
|
while ($xml->read()) {
|
||||||
$workbook = $xml->children($namespacesContent['office']);
|
// Quickly jump through to the office:body node
|
||||||
foreach($workbook->body->spreadsheet as $workbookData) {
|
while ($xml->name !== 'office:body') {
|
||||||
$workbookData = $workbookData->children($namespacesContent['table']);
|
if ($xml->isEmptyElement)
|
||||||
foreach($workbookData->table as $worksheetDataSet) {
|
$xml->read();
|
||||||
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
else
|
||||||
|
$xml->next();
|
||||||
$worksheetNames[] = $worksheetDataAttributes['name'];
|
}
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,12 +165,137 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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->open('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
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -280,100 +319,33 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
|
||||||
*
|
|
||||||
* @param string $pFilename
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function listWorksheetInfo($pFilename)
|
|
||||||
{
|
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$worksheetInfo = array();
|
|
||||||
|
|
||||||
$zip = new ZipArchive;
|
|
||||||
if ($zip->open($pFilename) === true) {
|
|
||||||
|
|
||||||
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
|
||||||
$namespacesContent = $xml->getNamespaces(true);
|
|
||||||
|
|
||||||
$workbook = $xml->children($namespacesContent['office']);
|
|
||||||
foreach($workbook->body->spreadsheet as $workbookData) {
|
|
||||||
$workbookData = $workbookData->children($namespacesContent['table']);
|
|
||||||
foreach($workbookData->table as $worksheetDataSet) {
|
|
||||||
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
|
||||||
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
|
||||||
|
|
||||||
$tmpInfo = array();
|
|
||||||
$tmpInfo['worksheetName'] = (string) $worksheetDataAttributes['name'];
|
|
||||||
$tmpInfo['lastColumnLetter'] = 'A';
|
|
||||||
$tmpInfo['lastColumnIndex'] = 0;
|
|
||||||
$tmpInfo['totalRows'] = 0;
|
|
||||||
$tmpInfo['totalColumns'] = 0;
|
|
||||||
|
|
||||||
$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;
|
|
||||||
|
|
||||||
$worksheetInfo[] = $tmpInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $worksheetInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
$GMT = new DateTimeZone('UTC');
|
$GMT = new DateTimeZone('UTC');
|
||||||
|
|
||||||
$zip = new ZipArchive;
|
$zipClass = PHPExcel_Settings::getZipClass();
|
||||||
if ($zip->open($pFilename) === true) {
|
|
||||||
|
$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>';
|
// echo '<h1>Meta Information</h1>';
|
||||||
$xml = simplexml_load_string($zip->getFromName("meta.xml"));
|
$xml = simplexml_load_string($zip->getFromName("meta.xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespacesMeta = $xml->getNamespaces(true);
|
$namespacesMeta = $xml->getNamespaces(true);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($namespacesMeta);
|
// print_r($namespacesMeta);
|
||||||
@ -387,6 +359,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||||
}
|
}
|
||||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||||
|
$propertyValue = (string) $propertyValue;
|
||||||
switch ($propertyName) {
|
switch ($propertyName) {
|
||||||
case 'title' :
|
case 'title' :
|
||||||
$docProps->setTitle($propertyValue);
|
$docProps->setTitle($propertyValue);
|
||||||
@ -414,6 +387,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||||
|
$propertyValue = (string) $propertyValue;
|
||||||
switch ($propertyName) {
|
switch ($propertyName) {
|
||||||
case 'initial-creator' :
|
case 'initial-creator' :
|
||||||
$docProps->setCreator($propertyValue);
|
$docProps->setCreator($propertyValue);
|
||||||
@ -457,7 +431,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
|
|
||||||
// echo '<h1>Workbook Content</h1>';
|
// echo '<h1>Workbook Content</h1>';
|
||||||
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
$xml = simplexml_load_string($zip->getFromName("content.xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$namespacesContent = $xml->getNamespaces(true);
|
$namespacesContent = $xml->getNamespaces(true);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($namespacesContent);
|
// print_r($namespacesContent);
|
||||||
@ -608,7 +582,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||||
if (floor($dataValue) == $dataValue) {
|
if (floor($dataValue) == $dataValue) {
|
||||||
if ($dataValue = (integer) $dataValue)
|
if ($dataValue == (integer) $dataValue)
|
||||||
$dataValue = (integer) $dataValue;
|
$dataValue = (integer) $dataValue;
|
||||||
else
|
else
|
||||||
$dataValue = (float) $dataValue;
|
$dataValue = (float) $dataValue;
|
||||||
@ -643,22 +617,24 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
if ($hasCalculatedValue) {
|
if ($hasCalculatedValue) {
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
// echo 'Formula: '.$cellDataFormula.'<br />';
|
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
||||||
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
||||||
$temp = explode('"',$cellDataFormula);
|
$temp = explode('"',$cellDataFormula);
|
||||||
$tKey = false;
|
$tKey = false;
|
||||||
foreach($temp as &$value) {
|
foreach($temp as &$value) {
|
||||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||||
if ($tKey = !$tKey) {
|
if ($tKey = !$tKey) {
|
||||||
$value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value);
|
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3',$value); // Cell range reference in another sheet
|
||||||
$value = preg_replace('/\[\.(.*)\]/Ui','$1',$value);
|
$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);
|
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
// Then rebuild the formula string
|
// Then rebuild the formula string
|
||||||
$cellDataFormula = implode('"',$temp);
|
$cellDataFormula = implode('"',$temp);
|
||||||
// echo 'Adjusted Formula: '.$cellDataFormula.'<br />';
|
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
|
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ?
|
||||||
@ -715,8 +691,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Input encoding
|
* Input encoding
|
||||||
@ -72,14 +72,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_format = 0;
|
private $_format = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
|
||||||
*
|
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
private $_readFilter = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_SYLK
|
* Create a new PHPExcel_Reader_SYLK
|
||||||
*/
|
*/
|
||||||
@ -87,63 +79,31 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Validate that the current file is a SYLK file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
protected function _isValidFormat()
|
||||||
{
|
{
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
// Read sample data (first 2 KB will do)
|
||||||
$fh = fopen($pFilename, 'r');
|
$data = fread($this->_fileHandle, 2048);
|
||||||
$data = fread($fh, 2048);
|
|
||||||
fclose($fh);
|
|
||||||
|
|
||||||
// Count delimiters in file
|
// Count delimiters in file
|
||||||
$delimiterCount = substr_count($data, ';');
|
$delimiterCount = substr_count($data, ';');
|
||||||
if ($delimiterCount < 1) {
|
if ($delimiterCount < 1) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Analyze first line looking for ID; signature
|
// Analyze first line looking for ID; signature
|
||||||
$lines = explode("\n", $data);
|
$lines = explode("\n", $data);
|
||||||
if (substr($lines[0],0,4) != 'ID;P') {
|
if (substr($lines[0],0,4) != 'ID;P') {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set input encoding
|
* Set input encoding
|
||||||
*
|
*
|
||||||
@ -155,7 +115,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get input encoding
|
* Get input encoding
|
||||||
*
|
*
|
||||||
@ -166,25 +125,22 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this->_inputEncoding;
|
return $this->_inputEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
|
||||||
if (!file_exists($pFilename)) {
|
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$this->_openFile($pFilename);
|
||||||
if ($fileHandle === false) {
|
if (!$this->_isValidFormat()) {
|
||||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
fclose ($this->_fileHandle);
|
||||||
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
$fileHandle = $this->_fileHandle;
|
||||||
|
rewind($fileHandle);
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
||||||
@ -206,7 +162,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// explode each row at semicolons while taking into account that literal semicolon (;)
|
// explode each row at semicolons while taking into account that literal semicolon (;)
|
||||||
// is escaped like this (;;)
|
// is escaped like this (;;)
|
||||||
$rowData = explode("\t",str_replace('?',';',str_replace(';',"\t",str_replace(';;','?',rtrim($rowData)))));
|
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData)))));
|
||||||
|
|
||||||
$dataType = array_shift($rowData);
|
$dataType = array_shift($rowData);
|
||||||
if ($dataType == 'C') {
|
if ($dataType == 'C') {
|
||||||
@ -238,13 +194,12 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $worksheetInfo;
|
return $worksheetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -255,21 +210,24 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Open file
|
||||||
if (!file_exists($pFilename)) {
|
$this->_openFile($pFilename);
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
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
|
// Create new PHPExcel
|
||||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||||
@ -280,12 +238,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
$fromFormats = array('\-', '\ ');
|
$fromFormats = array('\-', '\ ');
|
||||||
$toFormats = array('-', ' ');
|
$toFormats = array('-', ' ');
|
||||||
|
|
||||||
// Open file
|
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
|
||||||
if ($fileHandle === false) {
|
|
||||||
throw new Exception("Could not open file $pFilename for reading.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through file
|
// Loop through file
|
||||||
$rowData = array();
|
$rowData = array();
|
||||||
$column = $row = '';
|
$column = $row = '';
|
||||||
@ -433,8 +385,10 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
if (isset($this->_formats[$formatStyle])) {
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
||||||
@ -473,7 +427,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sheet index
|
* Get sheet index
|
||||||
*
|
*
|
||||||
@ -483,7 +436,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_ReferenceHelper
|
class PHPExcel_ReferenceHelper
|
||||||
{
|
{
|
||||||
@ -69,30 +69,336 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new column, updating all possible related data
|
* Compare two column addresses
|
||||||
|
* Intended for use as a Callback function for sorting column addresses by column
|
||||||
*
|
*
|
||||||
* @param int $pBefore Insert before this one
|
* @param string $a First column to test (e.g. 'AA')
|
||||||
* @param int $pNumCols Number of columns to insert
|
* @param string $b Second column to test (e.g. 'Z')
|
||||||
* @param int $pNumRows Number of rows to insert
|
* @return integer
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null) {
|
public static function columnSort($a, $b) {
|
||||||
|
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two column addresses
|
||||||
|
* Intended for use as a Callback function for reverse sorting column addresses by column
|
||||||
|
*
|
||||||
|
* @param string $a First column to test (e.g. 'AA')
|
||||||
|
* @param string $b Second column to test (e.g. 'Z')
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public static function columnReverseSort($a, $b) {
|
||||||
|
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two cell addresses
|
||||||
|
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||||
|
*
|
||||||
|
* @param string $a First cell to test (e.g. 'AA1')
|
||||||
|
* @param string $b Second cell to test (e.g. 'Z1')
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public static function cellSort($a, $b) {
|
||||||
|
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||||
|
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||||
|
|
||||||
|
if ($ar == $br) {
|
||||||
|
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||||
|
}
|
||||||
|
return ($ar < $br) ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two cell addresses
|
||||||
|
* Intended for use as a Callback function for sorting cell addresses by column and row
|
||||||
|
*
|
||||||
|
* @param string $a First cell to test (e.g. 'AA1')
|
||||||
|
* @param string $b Second cell to test (e.g. 'Z1')
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public static function cellReverseSort($a, $b) {
|
||||||
|
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||||
|
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||||
|
|
||||||
|
if ($ar == $br) {
|
||||||
|
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||||
|
}
|
||||||
|
return ($ar < $br) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether a cell address falls within a defined range of cells
|
||||||
|
*
|
||||||
|
* @param string $cellAddress Address of the cell we're testing
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
|
||||||
|
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
|
||||||
|
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
|
||||||
|
// Is cell within the range of rows/columns if we're deleting
|
||||||
|
if ($pNumRows < 0 &&
|
||||||
|
($cellRow >= ($beforeRow + $pNumRows)) &&
|
||||||
|
($cellRow < $beforeRow)) {
|
||||||
|
return TRUE;
|
||||||
|
} elseif ($pNumCols < 0 &&
|
||||||
|
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
|
||||||
|
($cellColumnIndex < $beforeColumnIndex)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update page breaks when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aBreaks = $pSheet->getBreaks();
|
||||||
|
($pNumCols > 0 || $pNumRows > 0) ?
|
||||||
|
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||||
|
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
|
|
||||||
|
foreach ($aBreaks as $key => $value) {
|
||||||
|
if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
|
||||||
|
// If we're deleting, then clear any defined breaks that are within the range
|
||||||
|
// of rows/columns that we're deleting
|
||||||
|
$pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||||
|
} else {
|
||||||
|
// Otherwise update any affected breaks by inserting a new break at the appropriate point
|
||||||
|
// and removing the old affected break
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
if ($key != $newReference) {
|
||||||
|
$pSheet->setBreak($newReference, $value)
|
||||||
|
->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update cell comments when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aComments = $pSheet->getComments();
|
||||||
|
$aNewComments = array(); // the new array of all comments
|
||||||
|
|
||||||
|
foreach ($aComments as $key => &$value) {
|
||||||
|
// Any comments inside a deleted range will be ignored
|
||||||
|
if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
|
||||||
|
// Otherwise build a new array of comments indexed by the adjusted cell reference
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
$aNewComments[$newReference] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Replace the comments array with the new set of comments
|
||||||
|
$pSheet->setComments($aNewComments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update hyperlinks when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
||||||
|
($pNumCols > 0 || $pNumRows > 0) ?
|
||||||
|
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||||
|
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
|
|
||||||
|
foreach ($aHyperlinkCollection as $key => $value) {
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
if ($key != $newReference) {
|
||||||
|
$pSheet->setHyperlink( $newReference, $value );
|
||||||
|
$pSheet->setHyperlink( $key, null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update data validations when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
||||||
|
($pNumCols > 0 || $pNumRows > 0) ?
|
||||||
|
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||||
|
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
|
foreach ($aDataValidationCollection as $key => $value) {
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
if ($key != $newReference) {
|
||||||
|
$pSheet->setDataValidation( $newReference, $value );
|
||||||
|
$pSheet->setDataValidation( $key, null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update merged cells when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aMergeCells = $pSheet->getMergeCells();
|
||||||
|
$aNewMergeCells = array(); // the new array of all merge cells
|
||||||
|
foreach ($aMergeCells as $key => &$value) {
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
$aNewMergeCells[$newReference] = $newReference;
|
||||||
|
}
|
||||||
|
$pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update protected cells when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aProtectedCells = $pSheet->getProtectedCells();
|
||||||
|
($pNumCols > 0 || $pNumRows > 0) ?
|
||||||
|
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||||
|
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
|
foreach ($aProtectedCells as $key => $value) {
|
||||||
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
if ($key != $newReference) {
|
||||||
|
$pSheet->protectCells( $newReference, $value, true );
|
||||||
|
$pSheet->unprotectCells( $key );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update column dimensions when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
||||||
|
if (!empty($aColumnDimensions)) {
|
||||||
|
foreach ($aColumnDimensions as $objColumnDimension) {
|
||||||
|
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
|
||||||
|
list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||||
|
if ($objColumnDimension->getColumnIndex() != $newReference) {
|
||||||
|
$objColumnDimension->setColumnIndex($newReference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pSheet->refreshColumnDimensions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update row dimensions when inserting/deleting rows/columns
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $beforeRow Number of the row we're inserting/deleting before
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
*/
|
||||||
|
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
|
{
|
||||||
|
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
||||||
|
if (!empty($aRowDimensions)) {
|
||||||
|
foreach ($aRowDimensions as $objRowDimension) {
|
||||||
|
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
|
||||||
|
list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||||
|
if ($objRowDimension->getRowIndex() != $newReference) {
|
||||||
|
$objRowDimension->setRowIndex($newReference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pSheet->refreshRowDimensions();
|
||||||
|
|
||||||
|
$copyDimension = $pSheet->getRowDimension($beforeRow - 1);
|
||||||
|
for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
|
||||||
|
$newDimension = $pSheet->getRowDimension($i);
|
||||||
|
$newDimension->setRowHeight($copyDimension->getRowHeight());
|
||||||
|
$newDimension->setVisible($copyDimension->getVisible());
|
||||||
|
$newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
|
||||||
|
$newDimension->setCollapsed($copyDimension->getCollapsed());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new column or row, updating all possible related data
|
||||||
|
*
|
||||||
|
* @param string $pBefore Insert before this cell address (e.g. 'A1')
|
||||||
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
|
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
|
||||||
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
|
||||||
|
{
|
||||||
|
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
||||||
$aCellCollection = $pSheet->getCellCollection();
|
$aCellCollection = $pSheet->getCellCollection();
|
||||||
|
|
||||||
// Get coordinates of $pBefore
|
// Get coordinates of $pBefore
|
||||||
$beforeColumn = 'A';
|
$beforeColumn = 'A';
|
||||||
$beforeRow = 1;
|
$beforeRow = 1;
|
||||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
|
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
|
||||||
|
$beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn);
|
||||||
|
|
||||||
// Clear cells if we are removing columns or rows
|
// Clear cells if we are removing columns or rows
|
||||||
$highestColumn = $pSheet->getHighestColumn();
|
$highestColumn = $pSheet->getHighestColumn();
|
||||||
$highestRow = $pSheet->getHighestRow();
|
$highestRow = $pSheet->getHighestRow();
|
||||||
|
|
||||||
// 1. Clear column strips if we are removing columns
|
// 1. Clear column strips if we are removing columns
|
||||||
if ($pNumCols < 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols > 0) {
|
if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) {
|
||||||
for ($i = 1; $i <= $highestRow - 1; ++$i) {
|
for ($i = 1; $i <= $highestRow - 1; ++$i) {
|
||||||
for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1 + $pNumCols; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2; ++$j) {
|
for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) {
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i;
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i;
|
||||||
$pSheet->removeConditionalStyles($coordinate);
|
$pSheet->removeConditionalStyles($coordinate);
|
||||||
if ($pSheet->cellExists($coordinate)) {
|
if ($pSheet->cellExists($coordinate)) {
|
||||||
@ -105,7 +411,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
|
|
||||||
// 2. Clear row strips if we are removing rows
|
// 2. Clear row strips if we are removing rows
|
||||||
if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) {
|
if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) {
|
||||||
for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||||
for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) {
|
for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) {
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j;
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j;
|
||||||
$pSheet->removeConditionalStyles($coordinate);
|
$pSheet->removeConditionalStyles($coordinate);
|
||||||
@ -117,21 +423,28 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Loop through cells, bottom-up, and change cell coordinates
|
// Loop through cells, bottom-up, and change cell coordinates
|
||||||
while (($cellID = ($pNumCols < 0 || $pNumRows < 0) ? array_shift($aCellCollection) : array_pop($aCellCollection))) {
|
if($remove) {
|
||||||
|
// It's faster to reverse and pop than to use unshift, especially with large cell collections
|
||||||
|
$aCellCollection = array_reverse($aCellCollection);
|
||||||
|
}
|
||||||
|
while ($cellID = array_pop($aCellCollection)) {
|
||||||
$cell = $pSheet->getCell($cellID);
|
$cell = $pSheet->getCell($cellID);
|
||||||
|
$cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
|
||||||
|
|
||||||
|
if ($cellIndex-1 + $pNumCols < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// New coordinates
|
// New coordinates
|
||||||
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols ) . ($cell->getRow() + $pNumRows);
|
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
|
||||||
|
|
||||||
// Should the cell be updated? Move value and cellXf index from one cell to another.
|
// Should the cell be updated? Move value and cellXf index from one cell to another.
|
||||||
if ((PHPExcel_Cell::columnIndexFromString( $cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) &&
|
if (($cellIndex >= $beforeColumnIndex) &&
|
||||||
($cell->getRow() >= $beforeRow)) {
|
($cell->getRow() >= $beforeRow)) {
|
||||||
|
|
||||||
// Update cell styles
|
// Update cell styles
|
||||||
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
|
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
|
||||||
$cell->setXfIndex(0);
|
|
||||||
|
|
||||||
// Insert this cell at its new location
|
// Insert this cell at its new location
|
||||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||||
@ -145,7 +458,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear the original cell
|
// Clear the original cell
|
||||||
$pSheet->getCell($cell->getCoordinate())->setValue('');
|
$pSheet->getCellCacheController()->deleteCacheData($cellID);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* We don't need to update styles for rows/columns before our insertion position,
|
/* We don't need to update styles for rows/columns before our insertion position,
|
||||||
@ -159,21 +472,20 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Duplicate styles for the newly inserted cells
|
// Duplicate styles for the newly inserted cells
|
||||||
$highestColumn = $pSheet->getHighestColumn();
|
$highestColumn = $pSheet->getHighestColumn();
|
||||||
$highestRow = $pSheet->getHighestRow();
|
$highestRow = $pSheet->getHighestRow();
|
||||||
|
|
||||||
if ($pNumCols > 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 > 0) {
|
if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
|
||||||
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 ) . $i;
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
|
||||||
if ($pSheet->cellExists($coordinate)) {
|
if ($pSheet->cellExists($coordinate)) {
|
||||||
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
||||||
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
||||||
$pSheet->getConditionalStyles($coordinate) : false;
|
$pSheet->getConditionalStyles($coordinate) : false;
|
||||||
for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols; ++$j) {
|
for ($j = $beforeColumnIndex - 1; $j <= $beforeColumnIndex - 2 + $pNumCols; ++$j) {
|
||||||
$pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex);
|
$pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex);
|
||||||
if ($conditionalStyles) {
|
if ($conditionalStyles) {
|
||||||
$cloned = array();
|
$cloned = array();
|
||||||
@ -189,7 +501,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
|
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
|
||||||
for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
|
||||||
@ -211,105 +523,29 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: column dimensions
|
// Update worksheet: column dimensions
|
||||||
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
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 worksheet: row dimensions
|
// Update worksheet: row dimensions
|
||||||
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
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);
|
// Update worksheet: page breaks
|
||||||
for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
|
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
$newDimension = $pSheet->getRowDimension($i);
|
|
||||||
$newDimension->setRowHeight($copyDimension->getRowHeight());
|
|
||||||
$newDimension->setVisible($copyDimension->getVisible());
|
|
||||||
$newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
|
|
||||||
$newDimension->setCollapsed($copyDimension->getCollapsed());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: breaks
|
|
||||||
$aBreaks = array_reverse($pSheet->getBreaks(), true);
|
|
||||||
foreach ($aBreaks as $key => $value) {
|
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
|
||||||
if ($key != $newReference) {
|
|
||||||
$pSheet->setBreak( $newReference, $value );
|
|
||||||
$pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update worksheet: comments
|
// Update worksheet: comments
|
||||||
$aComments = $pSheet->getComments();
|
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
$aNewComments = array(); // the new array of all comments
|
|
||||||
foreach ($aComments as $key => &$value) {
|
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
|
||||||
$aNewComments[$newReference] = $value;
|
|
||||||
}
|
|
||||||
$pSheet->setComments($aNewComments); // replace the comments array
|
|
||||||
|
|
||||||
// Update worksheet: hyperlinks
|
// Update worksheet: hyperlinks
|
||||||
$aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true);
|
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
foreach ($aHyperlinkCollection as $key => $value) {
|
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
|
||||||
if ($key != $newReference) {
|
|
||||||
$pSheet->setHyperlink( $newReference, $value );
|
|
||||||
$pSheet->setHyperlink( $key, null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: data validations
|
// Update worksheet: data validations
|
||||||
$aDataValidationCollection = array_reverse($pSheet->getDataValidationCollection(), true);
|
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
foreach ($aDataValidationCollection as $key => $value) {
|
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
|
||||||
if ($key != $newReference) {
|
|
||||||
$pSheet->setDataValidation( $newReference, $value );
|
|
||||||
$pSheet->setDataValidation( $key, null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: merge cells
|
// Update worksheet: merge cells
|
||||||
$aMergeCells = $pSheet->getMergeCells();
|
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
$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 worksheet: protected cells
|
// Update worksheet: protected cells
|
||||||
$aProtectedCells = array_reverse($pSheet->getProtectedCells(), true);
|
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
|
||||||
foreach ($aProtectedCells as $key => $value) {
|
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
|
||||||
if ($key != $newReference) {
|
|
||||||
$pSheet->protectCells( $newReference, $value, true );
|
|
||||||
$pSheet->unprotectCells( $key );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: autofilter
|
// Update worksheet: autofilter
|
||||||
$autoFilter = $pSheet->getAutoFilter();
|
$autoFilter = $pSheet->getAutoFilter();
|
||||||
@ -318,7 +554,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
if ($pNumCols != 0) {
|
if ($pNumCols != 0) {
|
||||||
$autoFilterColumns = array_keys($autoFilter->getColumns());
|
$autoFilterColumns = array_keys($autoFilter->getColumns());
|
||||||
if (count($autoFilterColumns) > 0) {
|
if (count($autoFilterColumns) > 0) {
|
||||||
list($column,$row) = sscanf($pBefore,'%[A-Z]%d');
|
sscanf($pBefore,'%[A-Z]%d', $column, $row);
|
||||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||||
if ($columnIndex <= $rangeEnd[0]) {
|
if ($columnIndex <= $rangeEnd[0]) {
|
||||||
@ -369,19 +605,16 @@ class PHPExcel_ReferenceHelper
|
|||||||
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: freeze pane
|
// Update worksheet: freeze pane
|
||||||
if ($pSheet->getFreezePane() != '') {
|
if ($pSheet->getFreezePane() != '') {
|
||||||
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Page setup
|
// Page setup
|
||||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||||
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: drawings
|
// Update worksheet: drawings
|
||||||
$aDrawings = $pSheet->getDrawingCollection();
|
$aDrawings = $pSheet->getDrawingCollection();
|
||||||
foreach ($aDrawings as $objDrawing) {
|
foreach ($aDrawings as $objDrawing) {
|
||||||
@ -391,7 +624,6 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update workbook: named ranges
|
// Update workbook: named ranges
|
||||||
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
||||||
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
||||||
@ -414,8 +646,9 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @param int $pBefore Insert before this one
|
* @param int $pBefore Insert before this one
|
||||||
* @param int $pNumCols Number of columns to insert
|
* @param int $pNumCols Number of columns to insert
|
||||||
* @param int $pNumRows Number of rows to insert
|
* @param int $pNumRows Number of rows to insert
|
||||||
|
* @param string $sheetName Worksheet name/title
|
||||||
* @return string Updated formula
|
* @return string Updated formula
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||||
// Update cell references in the formula
|
// Update cell references in the formula
|
||||||
@ -445,7 +678,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
$cellIndex = $column.$row;
|
$cellIndex = $column.$row;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
$cellTokens[$cellIndex] = '/(?<!\d)'.preg_quote($fromString).'(?!\d)/i';
|
$cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i';
|
||||||
++$adjustCount;
|
++$adjustCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -470,7 +703,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
$cellIndex = $column.$row;
|
$cellIndex = $column.$row;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?![A-Z])/i';
|
$cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i';
|
||||||
++$adjustCount;
|
++$adjustCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,7 +729,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
$cellIndex = $column.$row;
|
$cellIndex = $column.$row;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
|
$cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i';
|
||||||
++$adjustCount;
|
++$adjustCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,12 +737,13 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
// Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5)
|
// 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);
|
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||||
|
|
||||||
if ($matchCount > 0) {
|
if ($matchCount > 0) {
|
||||||
foreach($matches as $match) {
|
foreach($matches as $match) {
|
||||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||||
$fromString .= $match[3];
|
$fromString .= $match[3];
|
||||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
|
||||||
|
|
||||||
|
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||||
if ($match[3] !== $modified3) {
|
if ($match[3] !== $modified3) {
|
||||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||||
@ -518,19 +752,23 @@ class PHPExcel_ReferenceHelper
|
|||||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
// 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;
|
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||||
$row = trim($row,'$') + 10000000;
|
$row = trim($row,'$') + 10000000;
|
||||||
$cellIndex = $column.$row;
|
$cellIndex = $row . $column;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
|
$cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i';
|
||||||
++$adjustCount;
|
++$adjustCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($adjustCount > 0) {
|
if ($adjustCount > 0) {
|
||||||
|
if ($pNumCols > 0 || $pNumRows > 0) {
|
||||||
krsort($cellTokens);
|
krsort($cellTokens);
|
||||||
krsort($newCellTokens);
|
krsort($newCellTokens);
|
||||||
// Update cell references in the formula
|
} else {
|
||||||
|
ksort($cellTokens);
|
||||||
|
ksort($newCellTokens);
|
||||||
|
} // Update cell references in the formula
|
||||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
|
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -549,7 +787,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @param int $pNumCols Number of columns to increment
|
* @param int $pNumCols Number of columns to increment
|
||||||
* @param int $pNumRows Number of rows to increment
|
* @param int $pNumRows Number of rows to increment
|
||||||
* @return string Updated cell range
|
* @return string Updated cell range
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||||
// Is it in another worksheet? Will not have to update anything.
|
// Is it in another worksheet? Will not have to update anything.
|
||||||
@ -603,7 +841,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @param int $pNumCols Number of columns to increment
|
* @param int $pNumCols Number of columns to increment
|
||||||
* @param int $pNumRows Number of rows to increment
|
* @param int $pNumRows Number of rows to increment
|
||||||
* @return string Updated cell range
|
* @return string Updated cell range
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||||
@ -628,7 +866,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
// Recreate range string
|
// Recreate range string
|
||||||
return PHPExcel_Cell::buildRange($range);
|
return PHPExcel_Cell::buildRange($range);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Only cell ranges may be passed to this method.");
|
throw new PHPExcel_Exception("Only cell ranges may be passed to this method.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,7 +878,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @param int $pNumCols Number of columns to increment
|
* @param int $pNumCols Number of columns to increment
|
||||||
* @param int $pNumRows Number of rows to increment
|
* @param int $pNumRows Number of rows to increment
|
||||||
* @return string Updated cell reference
|
* @return string Updated cell reference
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||||
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
||||||
@ -653,7 +891,6 @@ class PHPExcel_ReferenceHelper
|
|||||||
// Verify which parts should be updated
|
// Verify which parts should be updated
|
||||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
||||||
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
||||||
|
|
||||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
||||||
$newRow >= $beforeRow);
|
$newRow >= $beforeRow);
|
||||||
|
|
||||||
@ -670,16 +907,16 @@ class PHPExcel_ReferenceHelper
|
|||||||
// Return new reference
|
// Return new reference
|
||||||
return $newColumn . $newRow;
|
return $newColumn . $newRow;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Only single cell references may be passed to this method.");
|
throw new PHPExcel_Exception("Only single cell references may be passed to this method.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __clone implementation. Cloning should not be allowed in a Singleton!
|
* __clone implementation. Cloning should not be allowed in a Singleton!
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public final function __clone() {
|
public final function __clone() {
|
||||||
throw new Exception("Cloning a Singleton is not allowed!");
|
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText implements PHPExcel_IComparable
|
class PHPExcel_RichText implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@ -45,8 +45,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_RichText instance
|
* Create a new PHPExcel_RichText instance
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Cell $pParent
|
* @param PHPExcel_Cell $pCell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel_Cell $pCell = null)
|
public function __construct(PHPExcel_Cell $pCell = null)
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
* Add text
|
* Add text
|
||||||
*
|
*
|
||||||
* @param PHPExcel_RichText_ITextElement $pText Rich text element
|
* @param PHPExcel_RichText_ITextElement $pText Rich text element
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_RichText
|
* @return PHPExcel_RichText
|
||||||
*/
|
*/
|
||||||
public function addText(PHPExcel_RichText_ITextElement $pText = null)
|
public function addText(PHPExcel_RichText_ITextElement $pText = null)
|
||||||
@ -85,7 +85,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @param string $pText Text
|
* @param string $pText Text
|
||||||
* @return PHPExcel_RichText_TextElement
|
* @return PHPExcel_RichText_TextElement
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function createText($pText = '')
|
public function createText($pText = '')
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @param string $pText Text
|
* @param string $pText Text
|
||||||
* @return PHPExcel_RichText_Run
|
* @return PHPExcel_RichText_Run
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function createTextRun($pText = '')
|
public function createTextRun($pText = '')
|
||||||
{
|
{
|
||||||
@ -132,7 +132,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
|
{
|
||||||
return $this->getPlainText();
|
return $this->getPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
* Set Rich Text elements
|
* Set Rich Text elements
|
||||||
*
|
*
|
||||||
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
|
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_RichText
|
* @return PHPExcel_RichText
|
||||||
*/
|
*/
|
||||||
public function setRichTextElements($pElements = null)
|
public function setRichTextElements($pElements = null)
|
||||||
@ -158,7 +159,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
if (is_array($pElements)) {
|
if (is_array($pElements)) {
|
||||||
$this->_richTextElements = $pElements;
|
$this->_richTextElements = $pElements;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
|
throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -168,7 +169,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode()
|
||||||
|
{
|
||||||
$hashElements = '';
|
$hashElements = '';
|
||||||
foreach ($this->_richTextElements as $element) {
|
foreach ($this->_richTextElements as $element) {
|
||||||
$hashElements .= $element->getHashCode();
|
$hashElements .= $element->getHashCode();
|
||||||
@ -183,7 +185,8 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone()
|
||||||
|
{
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_RichText_ITextElement
|
interface PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP
|
|||||||
* Set font
|
* Set font
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Style_Font $pFont Font
|
* @param PHPExcel_Style_Font $pFont Font
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_RichText_ITextElement
|
* @return PHPExcel_RichText_ITextElement
|
||||||
*/
|
*/
|
||||||
public function setFont(PHPExcel_Style_Font $pFont = null) {
|
public function setFont(PHPExcel_Style_Font $pFont = null) {
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Settings
|
* @package PHPExcel_Settings
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
@ -105,6 +105,12 @@ class PHPExcel_Settings
|
|||||||
*/
|
*/
|
||||||
private static $_pdfRendererPath = NULL;
|
private static $_pdfRendererPath = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default options for libxml loader
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private static $_libXmlLoaderOptions = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
|
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
|
||||||
@ -113,7 +119,8 @@ class PHPExcel_Settings
|
|||||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setZipClass($zipClass) {
|
public static function setZipClass($zipClass)
|
||||||
|
{
|
||||||
if (($zipClass === self::PCLZIP) ||
|
if (($zipClass === self::PCLZIP) ||
|
||||||
($zipClass === self::ZIPARCHIVE)) {
|
($zipClass === self::ZIPARCHIVE)) {
|
||||||
self::$_zipClass = $zipClass;
|
self::$_zipClass = $zipClass;
|
||||||
@ -125,13 +132,14 @@ class PHPExcel_Settings
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
|
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
|
||||||
* for Zip file management
|
* or Zip file management
|
||||||
*
|
*
|
||||||
* @return string Name of the Zip handler Class that PHPExcel is configured to use
|
* @return string Name of the Zip handler Class that PHPExcel is configured to use
|
||||||
* for Zip file management
|
* for Zip file management
|
||||||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||||
*/
|
*/
|
||||||
public static function getZipClass() {
|
public static function getZipClass()
|
||||||
|
{
|
||||||
return self::$_zipClass;
|
return self::$_zipClass;
|
||||||
} // function getZipClass()
|
} // function getZipClass()
|
||||||
|
|
||||||
@ -141,7 +149,8 @@ class PHPExcel_Settings
|
|||||||
*
|
*
|
||||||
* @return string Name of the cacheing method
|
* @return string Name of the cacheing method
|
||||||
*/
|
*/
|
||||||
public static function getCacheStorageMethod() {
|
public static function getCacheStorageMethod()
|
||||||
|
{
|
||||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
|
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
|
||||||
} // function getCacheStorageMethod()
|
} // function getCacheStorageMethod()
|
||||||
|
|
||||||
@ -151,7 +160,8 @@ class PHPExcel_Settings
|
|||||||
*
|
*
|
||||||
* @return string Name of the class currently being used for cacheing
|
* @return string Name of the class currently being used for cacheing
|
||||||
*/
|
*/
|
||||||
public static function getCacheStorageClass() {
|
public static function getCacheStorageClass()
|
||||||
|
{
|
||||||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
|
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
|
||||||
} // function getCacheStorageClass()
|
} // function getCacheStorageClass()
|
||||||
|
|
||||||
@ -163,8 +173,11 @@ class PHPExcel_Settings
|
|||||||
* @param array $arguments Optional configuration arguments for the cacheing method
|
* @param array $arguments Optional configuration arguments for the cacheing method
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
|
public static function setCacheStorageMethod(
|
||||||
$arguments = array()) {
|
$method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
|
||||||
|
$arguments = array()
|
||||||
|
)
|
||||||
|
{
|
||||||
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
|
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
|
||||||
} // function setCacheStorageMethod()
|
} // function setCacheStorageMethod()
|
||||||
|
|
||||||
@ -175,7 +188,8 @@ class PHPExcel_Settings
|
|||||||
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
|
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setLocale($locale='en_us') {
|
public static function setLocale($locale='en_us')
|
||||||
|
{
|
||||||
return PHPExcel_Calculation::getInstance()->setLocale($locale);
|
return PHPExcel_Calculation::getInstance()->setLocale($locale);
|
||||||
} // function setLocale()
|
} // function setLocale()
|
||||||
|
|
||||||
@ -186,9 +200,11 @@ class PHPExcel_Settings
|
|||||||
* @param string $libraryName Internal reference name of the library
|
* @param string $libraryName Internal reference name of the library
|
||||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||||
|
*
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setChartRenderer($libraryName, $libraryBaseDir) {
|
public static function setChartRenderer($libraryName, $libraryBaseDir)
|
||||||
|
{
|
||||||
if (!self::setChartRendererName($libraryName))
|
if (!self::setChartRendererName($libraryName))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return self::setChartRendererPath($libraryBaseDir);
|
return self::setChartRendererPath($libraryBaseDir);
|
||||||
@ -200,9 +216,11 @@ class PHPExcel_Settings
|
|||||||
*
|
*
|
||||||
* @param string $libraryName Internal reference name of the library
|
* @param string $libraryName Internal reference name of the library
|
||||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||||
|
*
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setChartRendererName($libraryName) {
|
public static function setChartRendererName($libraryName)
|
||||||
|
{
|
||||||
if (!in_array($libraryName,self::$_chartRenderers)) {
|
if (!in_array($libraryName,self::$_chartRenderers)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -219,7 +237,8 @@ class PHPExcel_Settings
|
|||||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setChartRendererPath($libraryBaseDir) {
|
public static function setChartRendererPath($libraryBaseDir)
|
||||||
|
{
|
||||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -236,7 +255,8 @@ class PHPExcel_Settings
|
|||||||
* currently configured to use
|
* currently configured to use
|
||||||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
|
||||||
*/
|
*/
|
||||||
public static function getChartRendererName() {
|
public static function getChartRendererName()
|
||||||
|
{
|
||||||
return self::$_chartRendererName;
|
return self::$_chartRendererName;
|
||||||
} // function getChartRendererName()
|
} // function getChartRendererName()
|
||||||
|
|
||||||
@ -247,7 +267,8 @@ class PHPExcel_Settings
|
|||||||
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
|
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
|
||||||
* currently configured to use
|
* currently configured to use
|
||||||
*/
|
*/
|
||||||
public static function getChartRendererPath() {
|
public static function getChartRendererPath()
|
||||||
|
{
|
||||||
return self::$_chartRendererPath;
|
return self::$_chartRendererPath;
|
||||||
} // function getChartRendererPath()
|
} // function getChartRendererPath()
|
||||||
|
|
||||||
@ -260,9 +281,11 @@ class PHPExcel_Settings
|
|||||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||||
|
*
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setPdfRenderer($libraryName, $libraryBaseDir) {
|
public static function setPdfRenderer($libraryName, $libraryBaseDir)
|
||||||
|
{
|
||||||
if (!self::setPdfRendererName($libraryName))
|
if (!self::setPdfRendererName($libraryName))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return self::setPdfRendererPath($libraryBaseDir);
|
return self::setPdfRendererPath($libraryBaseDir);
|
||||||
@ -276,9 +299,11 @@ class PHPExcel_Settings
|
|||||||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
|
||||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||||
|
*
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setPdfRendererName($libraryName) {
|
public static function setPdfRendererName($libraryName)
|
||||||
|
{
|
||||||
if (!in_array($libraryName,self::$_pdfRenderers)) {
|
if (!in_array($libraryName,self::$_pdfRenderers)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -295,7 +320,8 @@ class PHPExcel_Settings
|
|||||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setPdfRendererPath($libraryBaseDir) {
|
public static function setPdfRendererPath($libraryBaseDir)
|
||||||
|
{
|
||||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -314,19 +340,48 @@ class PHPExcel_Settings
|
|||||||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
* PHPExcel_Settings::PDF_RENDERER_DOMPDF
|
||||||
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
* or PHPExcel_Settings::PDF_RENDERER_MPDF
|
||||||
*/
|
*/
|
||||||
public static function getPdfRendererName() {
|
public static function getPdfRendererName()
|
||||||
|
{
|
||||||
return self::$_pdfRendererName;
|
return self::$_pdfRendererName;
|
||||||
} // function getPdfRendererName()
|
} // function getPdfRendererName()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use
|
* 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
|
* @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
|
||||||
* currently configured to use
|
* currently configured to use
|
||||||
*/
|
*/
|
||||||
public static function getPdfRendererPath() {
|
public static function getPdfRendererPath()
|
||||||
|
{
|
||||||
return self::$_pdfRendererPath;
|
return self::$_pdfRendererPath;
|
||||||
} // function getPdfRendererPath()
|
} // function getPdfRendererPath()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default options for libxml loader
|
||||||
|
*
|
||||||
|
* @param int $options Default options for libxml loader
|
||||||
|
*/
|
||||||
|
public static function setLibXmlLoaderOptions($options = null)
|
||||||
|
{
|
||||||
|
if (is_null($options)) {
|
||||||
|
$options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
|
||||||
|
}
|
||||||
|
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||||
|
self::$_libXmlLoaderOptions = $options;
|
||||||
|
} // function setLibXmlLoaderOptions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default options for libxml loader.
|
||||||
|
* Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
|
||||||
|
*
|
||||||
|
* @return int Default options for libxml loader
|
||||||
|
*/
|
||||||
|
public static function getLibXmlLoaderOptions()
|
||||||
|
{
|
||||||
|
if (is_null(self::$_libXmlLoaderOptions)) {
|
||||||
|
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
|
||||||
|
}
|
||||||
|
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||||
|
return self::$_libXmlLoaderOptions;
|
||||||
|
} // function getLibXmlLoaderOptions
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_CodePage
|
class PHPExcel_Shared_CodePage
|
||||||
{
|
{
|
||||||
@ -39,16 +39,16 @@ class PHPExcel_Shared_CodePage
|
|||||||
* Convert Microsoft Code Page Identifier to Code Page Name which iconv
|
* Convert Microsoft Code Page Identifier to Code Page Name which iconv
|
||||||
* and mbstring understands
|
* and mbstring understands
|
||||||
*
|
*
|
||||||
* @param int $number Microsoft Code Page Indentifier
|
* @param integer $codePage Microsoft Code Page Indentifier
|
||||||
* @return string Code Page Name
|
* @return string Code Page Name
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function NumberToName($codePage = '1252')
|
public static function NumberToName($codePage = 1252)
|
||||||
{
|
{
|
||||||
switch ($codePage) {
|
switch ($codePage) {
|
||||||
case 367: return 'ASCII'; break; // ASCII
|
case 367: return 'ASCII'; break; // ASCII
|
||||||
case 437: return 'CP437'; break; // OEM US
|
case 437: return 'CP437'; break; // OEM US
|
||||||
case 720: throw new Exception('Code page 720 not supported.');
|
case 720: throw new PHPExcel_Exception('Code page 720 not supported.');
|
||||||
break; // OEM Arabic
|
break; // OEM Arabic
|
||||||
case 737: return 'CP737'; break; // OEM Greek
|
case 737: return 'CP737'; break; // OEM Greek
|
||||||
case 775: return 'CP775'; break; // OEM Baltic
|
case 775: return 'CP775'; break; // OEM Baltic
|
||||||
@ -85,17 +85,18 @@ class PHPExcel_Shared_CodePage
|
|||||||
case 10000: return 'MAC'; break; // Apple Roman
|
case 10000: return 'MAC'; break; // Apple Roman
|
||||||
case 10006: return 'MACGREEK'; break; // Macintosh Greek
|
case 10006: return 'MACGREEK'; break; // Macintosh Greek
|
||||||
case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic
|
case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic
|
||||||
|
case 10008: return 'CP936'; break; // Macintosh - Simplified Chinese (GB 2312)
|
||||||
case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe
|
case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe
|
||||||
case 10079: return 'MACICELAND'; break; // Macintosh Icelandic
|
case 10079: return 'MACICELAND'; break; // Macintosh Icelandic
|
||||||
case 10081: return 'MACTURKISH'; break; // Macintosh Turkish
|
case 10081: return 'MACTURKISH'; break; // Macintosh Turkish
|
||||||
case 32768: return 'MAC'; break; // Apple Roman
|
case 32768: return 'MAC'; break; // Apple Roman
|
||||||
case 32769: throw new Exception('Code page 32769 not supported.');
|
case 32769: throw new PHPExcel_Exception('Code page 32769 not supported.');
|
||||||
break; // ANSI Latin I (BIFF2-BIFF3)
|
break; // ANSI Latin I (BIFF2-BIFF3)
|
||||||
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
||||||
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Unknown codepage: ' . $codePage);
|
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -21,9 +21,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +32,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Date
|
class PHPExcel_Shared_Date
|
||||||
{
|
{
|
||||||
@ -58,7 +58,20 @@ class PHPExcel_Shared_Date
|
|||||||
'Sep' => 'September',
|
'Sep' => 'September',
|
||||||
'Oct' => 'October',
|
'Oct' => 'October',
|
||||||
'Nov' => 'November',
|
'Nov' => 'November',
|
||||||
'Dec' => 'December'
|
'Dec' => 'December',
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Names of the months of the year, indexed by shortname
|
||||||
|
* Planned usage for locale settings
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public static $_numberSuffixes = array( 'st',
|
||||||
|
'nd',
|
||||||
|
'rd',
|
||||||
|
'th',
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -67,27 +80,18 @@ class PHPExcel_Shared_Date
|
|||||||
* @private
|
* @private
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900;
|
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||||
|
|
||||||
/*
|
|
||||||
* Object type for PHP Date/Time values
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public static $dateTimeObjectType = 'DateTime';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
||||||
*
|
*
|
||||||
* @param integer $baseDate Excel base date
|
* @param integer $baseDate Excel base date (1900 or 1904)
|
||||||
* @return boolean Success or failure
|
* @return boolean Success or failure
|
||||||
*/
|
*/
|
||||||
public static function setExcelCalendar($baseDate) {
|
public static function setExcelCalendar($baseDate) {
|
||||||
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
|
||||||
($baseDate == self::CALENDAR_MAC_1904)) {
|
($baseDate == self::CALENDAR_MAC_1904)) {
|
||||||
self::$ExcelBaseDate = $baseDate;
|
self::$_excelBaseDate = $baseDate;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -97,10 +101,10 @@ class PHPExcel_Shared_Date
|
|||||||
/**
|
/**
|
||||||
* Return the Excel calendar (Windows 1900 or Mac 1904)
|
* Return the Excel calendar (Windows 1900 or Mac 1904)
|
||||||
*
|
*
|
||||||
* @return integer $baseDate Excel base date
|
* @return integer Excel base date (1900 or 1904)
|
||||||
*/
|
*/
|
||||||
public static function getExcelCalendar() {
|
public static function getExcelCalendar() {
|
||||||
return self::$ExcelBaseDate;
|
return self::$_excelBaseDate;
|
||||||
} // function getExcelCalendar()
|
} // function getExcelCalendar()
|
||||||
|
|
||||||
|
|
||||||
@ -108,22 +112,25 @@ class PHPExcel_Shared_Date
|
|||||||
* Convert a date from Excel to PHP
|
* Convert a date from Excel to PHP
|
||||||
*
|
*
|
||||||
* @param long $dateValue Excel date/time value
|
* @param long $dateValue Excel date/time value
|
||||||
|
* @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as
|
||||||
|
* a UST timestamp, or adjusted to UST
|
||||||
|
* @param string $timezone The timezone for finding the adjustment from UST
|
||||||
* @return long PHP serialized date/time
|
* @return long PHP serialized date/time
|
||||||
*/
|
*/
|
||||||
public static function ExcelToPHP($dateValue = 0) {
|
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||||
if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
$myExcelBaseDate = 25569;
|
$my_excelBaseDate = 25569;
|
||||||
// Adjust for the spurious 29-Feb-1900 (Day 60)
|
// Adjust for the spurious 29-Feb-1900 (Day 60)
|
||||||
if ($dateValue < 60) {
|
if ($dateValue < 60) {
|
||||||
--$myExcelBaseDate;
|
--$my_excelBaseDate;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$myExcelBaseDate = 24107;
|
$my_excelBaseDate = 24107;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform conversion
|
// Perform conversion
|
||||||
if ($dateValue >= 1) {
|
if ($dateValue >= 1) {
|
||||||
$utcDays = $dateValue - $myExcelBaseDate;
|
$utcDays = $dateValue - $my_excelBaseDate;
|
||||||
$returnValue = round($utcDays * 86400);
|
$returnValue = round($utcDays * 86400);
|
||||||
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
||||||
$returnValue = (integer) $returnValue;
|
$returnValue = (integer) $returnValue;
|
||||||
@ -135,16 +142,20 @@ class PHPExcel_Shared_Date
|
|||||||
$returnValue = (integer) gmmktime($hours, $mins, $secs);
|
$returnValue = (integer) gmmktime($hours, $mins, $secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$timezoneAdjustment = ($adjustToTimezone) ?
|
||||||
|
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
|
||||||
|
0;
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $returnValue;
|
return $returnValue + $timezoneAdjustment;
|
||||||
} // function ExcelToPHP()
|
} // function ExcelToPHP()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a date from Excel to a PHP Date/Time object
|
* Convert a date from Excel to a PHP Date/Time object
|
||||||
*
|
*
|
||||||
* @param long $dateValue Excel date/time value
|
* @param integer $dateValue Excel date/time value
|
||||||
* @return long PHP date/time object
|
* @return integer PHP date/time object
|
||||||
*/
|
*/
|
||||||
public static function ExcelToPHPObject($dateValue = 0) {
|
public static function ExcelToPHPObject($dateValue = 0) {
|
||||||
$dateTime = self::ExcelToPHP($dateValue);
|
$dateTime = self::ExcelToPHP($dateValue);
|
||||||
@ -165,14 +176,17 @@ class PHPExcel_Shared_Date
|
|||||||
* Convert a date from PHP to Excel
|
* Convert a date from PHP to Excel
|
||||||
*
|
*
|
||||||
* @param mixed $dateValue PHP serialized date/time or date object
|
* @param mixed $dateValue PHP serialized date/time or date object
|
||||||
|
* @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as
|
||||||
|
* a UST timestamp, or adjusted to UST
|
||||||
|
* @param string $timezone The timezone for finding the adjustment from UST
|
||||||
* @return mixed Excel date/time value
|
* @return mixed Excel date/time value
|
||||||
* or boolean FALSE on failure
|
* or boolean FALSE on failure
|
||||||
*/
|
*/
|
||||||
public static function PHPToExcel($dateValue = 0) {
|
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
|
||||||
$saveTimeZone = date_default_timezone_get();
|
$saveTimeZone = date_default_timezone_get();
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
$retValue = FALSE;
|
$retValue = FALSE;
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof self::$dateTimeObjectType)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||||
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
||||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||||
);
|
);
|
||||||
@ -199,16 +213,16 @@ class PHPExcel_Shared_Date
|
|||||||
* @return long Excel date/time value
|
* @return long Excel date/time value
|
||||||
*/
|
*/
|
||||||
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
|
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
|
||||||
if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
|
||||||
//
|
//
|
||||||
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
|
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
|
||||||
// This affects every date following 28th February 1900
|
// This affects every date following 28th February 1900
|
||||||
//
|
//
|
||||||
$excel1900isLeapYear = TRUE;
|
$excel1900isLeapYear = TRUE;
|
||||||
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
|
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
|
||||||
$myExcelBaseDate = 2415020;
|
$my_excelBaseDate = 2415020;
|
||||||
} else {
|
} else {
|
||||||
$myExcelBaseDate = 2416481;
|
$my_excelBaseDate = 2416481;
|
||||||
$excel1900isLeapYear = FALSE;
|
$excel1900isLeapYear = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +237,7 @@ class PHPExcel_Shared_Date
|
|||||||
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
||||||
$century = substr($year,0,2);
|
$century = substr($year,0,2);
|
||||||
$decade = substr($year,2,2);
|
$decade = substr($year,2,2);
|
||||||
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myExcelBaseDate + $excel1900isLeapYear;
|
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear;
|
||||||
|
|
||||||
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
||||||
|
|
||||||
@ -239,7 +253,7 @@ class PHPExcel_Shared_Date
|
|||||||
*/
|
*/
|
||||||
public static function isDateTime(PHPExcel_Cell $pCell) {
|
public static function isDateTime(PHPExcel_Cell $pCell) {
|
||||||
return self::isDateTimeFormat(
|
return self::isDateTimeFormat(
|
||||||
$pCell->getParent()->getStyle(
|
$pCell->getWorksheet()->getStyle(
|
||||||
$pCell->getCoordinate()
|
$pCell->getCoordinate()
|
||||||
)->getNumberFormat()
|
)->getNumberFormat()
|
||||||
);
|
);
|
||||||
@ -266,11 +280,14 @@ class PHPExcel_Shared_Date
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function isDateTimeFormatCode($pFormatCode = '') {
|
public static function isDateTimeFormatCode($pFormatCode = '') {
|
||||||
|
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
|
||||||
|
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
|
||||||
|
return FALSE;
|
||||||
|
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
|
||||||
|
// Scientific format
|
||||||
|
return FALSE;
|
||||||
// Switch on formatcode
|
// Switch on formatcode
|
||||||
switch ($pFormatCode) {
|
switch ($pFormatCode) {
|
||||||
// General contains an epoch letter 'e', so we trap for it explicitly here
|
|
||||||
case PHPExcel_Style_NumberFormat::FORMAT_GENERAL:
|
|
||||||
return FALSE;
|
|
||||||
// Explicitly defined date formats
|
// Explicitly defined date formats
|
||||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:
|
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:
|
||||||
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2:
|
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2:
|
||||||
@ -306,10 +323,11 @@ class PHPExcel_Shared_Date
|
|||||||
// We might also have a format mask containing quoted strings...
|
// We might also have a format mask containing quoted strings...
|
||||||
// we don't want to test for any of our characters within the quoted blocks
|
// we don't want to test for any of our characters within the quoted blocks
|
||||||
if (strpos($pFormatCode,'"') !== FALSE) {
|
if (strpos($pFormatCode,'"') !== FALSE) {
|
||||||
$i = FALSE;
|
$segMatcher = FALSE;
|
||||||
foreach(explode('"',$pFormatCode) as $subVal) {
|
foreach(explode('"',$pFormatCode) as $subVal) {
|
||||||
// Only test in alternate array entries (the non-quoted blocks)
|
// Only test in alternate array entries (the non-quoted blocks)
|
||||||
if (($i = !$i) && (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
if (($segMatcher = !$segMatcher) &&
|
||||||
|
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,4 +371,23 @@ class PHPExcel_Shared_Date
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function monthStringToNumber($month) {
|
||||||
|
$monthIndex = 1;
|
||||||
|
foreach(self::$_monthNames as $shortMonthName => $longMonthName) {
|
||||||
|
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
||||||
|
return $monthIndex;
|
||||||
|
}
|
||||||
|
++$monthIndex;
|
||||||
|
}
|
||||||
|
return $month;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function dayStringToNumber($day) {
|
||||||
|
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
|
||||||
|
if (is_numeric($strippedDayValue)) {
|
||||||
|
return $strippedDayValue;
|
||||||
|
}
|
||||||
|
return $day;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Drawing
|
class PHPExcel_Shared_Drawing
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher
|
class PHPExcel_Shared_Escher
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer
|
class PHPExcel_Shared_Escher_DgContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer
|
class PHPExcel_Shared_Escher_DggContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Excel5
|
class PHPExcel_Shared_Excel5
|
||||||
{
|
{
|
||||||
@ -40,7 +40,7 @@ class PHPExcel_Shared_Excel5
|
|||||||
* This holds for Arial 10
|
* This holds for Arial 10
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet The sheet
|
* @param PHPExcel_Worksheet $sheet The sheet
|
||||||
* @param integer $col The column
|
* @param string $col The column
|
||||||
* @return integer The width in pixels
|
* @return integer The width in pixels
|
||||||
*/
|
*/
|
||||||
public static function sizeCol($sheet, $col = 'A')
|
public static function sizeCol($sheet, $col = 'A')
|
||||||
@ -136,9 +136,9 @@ class PHPExcel_Shared_Excel5
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet
|
* @param PHPExcel_Worksheet $sheet
|
||||||
* @param string $startColumn
|
* @param string $startColumn
|
||||||
* @param integer $startOffset Offset within start cell measured in 1/1024 of the cell width
|
* @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
|
||||||
* @param string $endColumn
|
* @param string $endColumn
|
||||||
* @param integer $endOffset Offset within end cell measured in 1/1024 of the cell width
|
* @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
|
||||||
* @return integer Horizontal measured in pixels
|
* @return integer Horizontal measured in pixels
|
||||||
*/
|
*/
|
||||||
public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
|
public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
|
||||||
@ -166,10 +166,10 @@ class PHPExcel_Shared_Excel5
|
|||||||
* The distanceY is found as sum of all the spanning rows minus two offsets
|
* The distanceY is found as sum of all the spanning rows minus two offsets
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $sheet
|
* @param PHPExcel_Worksheet $sheet
|
||||||
* @param string $startRow (1-based)
|
* @param integer $startRow (1-based)
|
||||||
* @param integer $startOffset Offset within start cell measured in 1/256 of the cell height
|
* @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
|
||||||
* @param string $endRow (1-based)
|
* @param integer $endRow (1-based)
|
||||||
* @param integer $endOffset Offset within end cell measured in 1/256 of the cell height
|
* @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
|
||||||
* @return integer Vertical distance measured in pixels
|
* @return integer Vertical distance measured in pixels
|
||||||
*/
|
*/
|
||||||
public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
|
public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,10 +31,39 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_File
|
class PHPExcel_Shared_File
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Use Temp or File Upload Temp for temporary files
|
||||||
|
*
|
||||||
|
* @protected
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected static $_useUploadTempDirectory = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||||
|
*
|
||||||
|
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
||||||
|
*/
|
||||||
|
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
|
||||||
|
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
||||||
|
} // function setUseUploadTempDirectory()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the flag indicating whether the File Upload Temp directory should be used for temporary files
|
||||||
|
*
|
||||||
|
* @return boolean Use File Upload Temporary directory (true or false)
|
||||||
|
*/
|
||||||
|
public static function getUseUploadTempDirectory() {
|
||||||
|
return self::$_useUploadTempDirectory;
|
||||||
|
} // function getUseUploadTempDirectory()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if a file exists
|
* Verify if a file exists
|
||||||
*
|
*
|
||||||
@ -105,9 +134,19 @@ class PHPExcel_Shared_File
|
|||||||
*/
|
*/
|
||||||
public static function sys_get_temp_dir()
|
public static function sys_get_temp_dir()
|
||||||
{
|
{
|
||||||
|
if (self::$_useUploadTempDirectory) {
|
||||||
|
// use upload-directory when defined to allow running on environments having very restricted
|
||||||
|
// open_basedir configs
|
||||||
|
if (ini_get('upload_tmp_dir') !== FALSE) {
|
||||||
|
if ($temp = ini_get('upload_tmp_dir')) {
|
||||||
|
if (file_exists($temp))
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sys_get_temp_dir is only available since PHP 5.2.1
|
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||||
|
|
||||||
if ( !function_exists('sys_get_temp_dir')) {
|
if ( !function_exists('sys_get_temp_dir')) {
|
||||||
if ($temp = getenv('TMP') ) {
|
if ($temp = getenv('TMP') ) {
|
||||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2012 PHPExcel
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.8, 2012-10-12
|
* @version 1.8.0, 2014-03-02
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Font
|
class PHPExcel_Shared_Font
|
||||||
{
|
{
|
||||||
@ -244,11 +244,11 @@ class PHPExcel_Shared_Font
|
|||||||
/**
|
/**
|
||||||
* Calculate an (approximate) OpenXML column width, based on font size and text contained
|
* Calculate an (approximate) OpenXML column width, based on font size and text contained
|
||||||
*
|
*
|
||||||
* @param int $fontSize Font size (in pixels or points)
|
* @param PHPExcel_Style_Font $font Font object
|
||||||
* @param bool $fontSizeInPixels Is the font size specified in pixels (true) or in points (false) ?
|
* @param PHPExcel_RichText|string $cellText Text to calculate width
|
||||||
* @param string $cellText Text to calculate width
|
* @param integer $rotation Rotation angle
|
||||||
* @param int $rotation Rotation angle
|
* @param PHPExcel_Style_Font|NULL $defaultFont Font object
|
||||||
* @return int Column width
|
* @return integer Column width
|
||||||
*/
|
*/
|
||||||
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
|
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ class PHPExcel_Shared_Font
|
|||||||
try {
|
try {
|
||||||
// If autosize method is set to 'approx', use approximation
|
// If autosize method is set to 'approx', use approximation
|
||||||
if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) {
|
if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) {
|
||||||
throw new Exception('AutoSize method is set to approx');
|
throw new PHPExcel_Exception('AutoSize method is set to approx');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Width of text in pixels excl. padding
|
// Width of text in pixels excl. padding
|
||||||
@ -280,7 +280,7 @@ class PHPExcel_Shared_Font
|
|||||||
// Excel adds some padding, use 1.07 of the width of an 'n' glyph
|
// Excel adds some padding, use 1.07 of the width of an 'n' glyph
|
||||||
$columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding
|
$columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Exception $e) {
|
||||||
// Width of text in pixels excl. padding, approximation
|
// Width of text in pixels excl. padding, approximation
|
||||||
$columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation);
|
$columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation);
|
||||||
|
|
||||||
@ -302,11 +302,11 @@ class PHPExcel_Shared_Font
|
|||||||
* @param PHPExcel_Style_Font
|
* @param PHPExcel_Style_Font
|
||||||
* @param int $rotation
|
* @param int $rotation
|
||||||
* @return int
|
* @return int
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
|
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
|
||||||
if (!function_exists('imagettfbbox')) {
|
if (!function_exists('imagettfbbox')) {
|
||||||
throw new Exception('GD library needs to be enabled');
|
throw new PHPExcel_Exception('GD library needs to be enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
// font size should really be supplied in pixels in GD2,
|
// font size should really be supplied in pixels in GD2,
|
||||||
@ -425,7 +425,7 @@ class PHPExcel_Shared_Font
|
|||||||
*/
|
*/
|
||||||
public static function getTrueTypeFontFileFromFont($font) {
|
public static function getTrueTypeFontFileFromFont($font) {
|
||||||
if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
|
if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
|
||||||
throw new Exception('Valid directory to TrueType Font files not specified');
|
throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $font->getName();
|
$name = $font->getName();
|
||||||
@ -530,7 +530,7 @@ class PHPExcel_Shared_Font
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
|
throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ class PHPExcel_Shared_Font
|
|||||||
|
|
||||||
// Check if file actually exists
|
// Check if file actually exists
|
||||||
if (!file_exists($fontFile)) {
|
if (!file_exists($fontFile)) {
|
||||||
throw New Exception('TrueType Font file not found');
|
throw New PHPExcel_Exception('TrueType Font file not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fontFile;
|
return $fontFile;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class CholeskyDecomposition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(JAMAError(ArgumentTypeException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
@ -136,13 +136,13 @@ class CholeskyDecomposition {
|
|||||||
|
|
||||||
return new Matrix($X, $this->m, $nx);
|
return new Matrix($X, $this->m, $nx);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(JAMAError(MatrixSPDException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(JAMAError(MatrixDimensionException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(JAMAError(ArgumentTypeException));
|
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
|
||||||
}
|
}
|
||||||
} // function solve()
|
} // function solve()
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||||
}
|
}
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||||||
}
|
}
|
||||||
return $d;
|
return $d;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||||
}
|
}
|
||||||
} // function det()
|
} // function det()
|
||||||
|
|
||||||
@ -218,8 +218,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||||||
*
|
*
|
||||||
* @param $B A Matrix with as many rows as A and any number of columns.
|
* @param $B A Matrix with as many rows as A and any number of columns.
|
||||||
* @return X so that L*U*X = B(piv,:)
|
* @return X so that L*U*X = B(piv,:)
|
||||||
* @exception IllegalArgumentException Matrix row dimensions must agree.
|
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
|
||||||
* @exception RuntimeException Matrix is singular.
|
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
|
||||||
*/
|
*/
|
||||||
public function solve($B) {
|
public function solve($B) {
|
||||||
if ($B->getRowDimension() == $this->m) {
|
if ($B->getRowDimension() == $this->m) {
|
||||||
@ -248,10 +248,10 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
|||||||
}
|
}
|
||||||
return $X;
|
return $X;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(self::MatrixSingularException);
|
throw new PHPExcel_Calculation_Exception(self::MatrixSingularException);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(self::MatrixSquareException);
|
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
|
||||||
}
|
}
|
||||||
} // function solve()
|
} // function solve()
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user