More PSR-2 changes, and fixes for a couple of breakages introduced by the last commit
This commit is contained in:
parent
4f8c9bfc96
commit
b8f67c6f4d
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
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();
|
||||||
|
@ -41,7 +41,7 @@ class PHPExcel_Autoloader
|
||||||
* Register the Autoloader with SPL
|
* Register the Autoloader with SPL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function Register()
|
public static function register()
|
||||||
{
|
{
|
||||||
if (function_exists('__autoload')) {
|
if (function_exists('__autoload')) {
|
||||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||||
|
@ -49,9 +49,9 @@ class PHPExcel_Autoloader
|
||||||
}
|
}
|
||||||
// Register ourselves with SPL
|
// Register ourselves with SPL
|
||||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
|
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
|
||||||
} else {
|
} else {
|
||||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class PHPExcel_Autoloader
|
||||||
*
|
*
|
||||||
* @param string $pClassName Name of the object to load
|
* @param string $pClassName Name of the object to load
|
||||||
*/
|
*/
|
||||||
public static function Load($pClassName)
|
public static function load($pClassName)
|
||||||
{
|
{
|
||||||
if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||||
// Either already loaded, or not a PHPExcel class request
|
// Either already loaded, or not a PHPExcel class request
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -21,8 +21,8 @@
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,19 +34,19 @@
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Exception extends PHPExcel_Exception {
|
class PHPExcel_Calculation_Exception extends PHPExcel_Exception {
|
||||||
/**
|
/**
|
||||||
* Error handler callback
|
* Error handler callback
|
||||||
*
|
*
|
||||||
* @param mixed $code
|
* @param mixed $code
|
||||||
* @param mixed $string
|
* @param mixed $string
|
||||||
* @param mixed $file
|
* @param mixed $file
|
||||||
* @param mixed $line
|
* @param mixed $line
|
||||||
* @param mixed $context
|
* @param mixed $context
|
||||||
*/
|
*/
|
||||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||||
$e = new self($string, $code);
|
$e = new self($string, $code);
|
||||||
$e->line = $line;
|
$e->line = $line;
|
||||||
$e->file = $file;
|
$e->file = $file;
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,17 +33,17 @@
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_ExceptionHandler {
|
class PHPExcel_Calculation_ExceptionHandler {
|
||||||
/**
|
/**
|
||||||
* Register errorhandler
|
* Register errorhandler
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
|
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister errorhandler
|
* Unregister errorhandler
|
||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -21,32 +21,32 @@
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PARTLY BASED ON:
|
PARTLY BASED ON:
|
||||||
Copyright (c) 2007 E. W. Bachtal, Inc.
|
Copyright (c) 2007 E. W. Bachtal, Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
subject to the following conditions:
|
subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
portions of the Software.
|
portions of the Software.
|
||||||
|
|
||||||
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
||||||
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
||||||
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
||||||
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
||||||
software or the use or other dealings in the software.
|
software or the use or other dealings in the software.
|
||||||
|
|
||||||
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
||||||
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,66 +58,66 @@ PARTLY BASED ON:
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_FormulaToken {
|
class PHPExcel_Calculation_FormulaToken {
|
||||||
/* Token types */
|
/* Token types */
|
||||||
const TOKEN_TYPE_NOOP = 'Noop';
|
const TOKEN_TYPE_NOOP = 'Noop';
|
||||||
const TOKEN_TYPE_OPERAND = 'Operand';
|
const TOKEN_TYPE_OPERAND = 'Operand';
|
||||||
const TOKEN_TYPE_FUNCTION = 'Function';
|
const TOKEN_TYPE_FUNCTION = 'Function';
|
||||||
const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression';
|
const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression';
|
||||||
const TOKEN_TYPE_ARGUMENT = 'Argument';
|
const TOKEN_TYPE_ARGUMENT = 'Argument';
|
||||||
const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix';
|
const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix';
|
||||||
const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix';
|
const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix';
|
||||||
const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
|
const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
|
||||||
const TOKEN_TYPE_WHITESPACE = 'Whitespace';
|
const TOKEN_TYPE_WHITESPACE = 'Whitespace';
|
||||||
const TOKEN_TYPE_UNKNOWN = 'Unknown';
|
const TOKEN_TYPE_UNKNOWN = 'Unknown';
|
||||||
|
|
||||||
/* Token subtypes */
|
/* Token subtypes */
|
||||||
const TOKEN_SUBTYPE_NOTHING = 'Nothing';
|
const TOKEN_SUBTYPE_NOTHING = 'Nothing';
|
||||||
const TOKEN_SUBTYPE_START = 'Start';
|
const TOKEN_SUBTYPE_START = 'Start';
|
||||||
const TOKEN_SUBTYPE_STOP = 'Stop';
|
const TOKEN_SUBTYPE_STOP = 'Stop';
|
||||||
const TOKEN_SUBTYPE_TEXT = 'Text';
|
const TOKEN_SUBTYPE_TEXT = 'Text';
|
||||||
const TOKEN_SUBTYPE_NUMBER = 'Number';
|
const TOKEN_SUBTYPE_NUMBER = 'Number';
|
||||||
const TOKEN_SUBTYPE_LOGICAL = 'Logical';
|
const TOKEN_SUBTYPE_LOGICAL = 'Logical';
|
||||||
const TOKEN_SUBTYPE_ERROR = 'Error';
|
const TOKEN_SUBTYPE_ERROR = 'Error';
|
||||||
const TOKEN_SUBTYPE_RANGE = 'Range';
|
const TOKEN_SUBTYPE_RANGE = 'Range';
|
||||||
const TOKEN_SUBTYPE_MATH = 'Math';
|
const TOKEN_SUBTYPE_MATH = 'Math';
|
||||||
const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
|
const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
|
||||||
const TOKEN_SUBTYPE_INTERSECTION = 'Intersection';
|
const TOKEN_SUBTYPE_INTERSECTION = 'Intersection';
|
||||||
const TOKEN_SUBTYPE_UNION = 'Union';
|
const TOKEN_SUBTYPE_UNION = 'Union';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value
|
* Value
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_value;
|
private $_value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token Type (represented by TOKEN_TYPE_*)
|
* Token Type (represented by TOKEN_TYPE_*)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_tokenType;
|
private $_tokenType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token SubType (represented by TOKEN_SUBTYPE_*)
|
* Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_tokenSubType;
|
private $_tokenSubType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Calculation_FormulaToken
|
* Create a new PHPExcel_Calculation_FormulaToken
|
||||||
*
|
*
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
||||||
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*)
|
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*)
|
||||||
*/
|
*/
|
||||||
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
||||||
{
|
{
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_value = $pValue;
|
$this->_value = $pValue;
|
||||||
$this->_tokenType = $pTokenType;
|
$this->_tokenType = $pTokenType;
|
||||||
$this->_tokenSubType = $pTokenSubType;
|
$this->_tokenSubType = $pTokenSubType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,16 +126,16 @@ class PHPExcel_Calculation_FormulaToken {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getValue() {
|
public function getValue() {
|
||||||
return $this->_value;
|
return $this->_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Value
|
* Set Value
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setValue($value) {
|
public function setValue($value) {
|
||||||
$this->_value = $value;
|
$this->_value = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,16 +144,16 @@ class PHPExcel_Calculation_FormulaToken {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTokenType() {
|
public function getTokenType() {
|
||||||
return $this->_tokenType;
|
return $this->_tokenType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Token Type
|
* Set Token Type
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) {
|
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) {
|
||||||
$this->_tokenType = $value;
|
$this->_tokenType = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,15 +162,15 @@ class PHPExcel_Calculation_FormulaToken {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTokenSubType() {
|
public function getTokenSubType() {
|
||||||
return $this->_tokenSubType;
|
return $this->_tokenSubType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Token SubType
|
* Set Token SubType
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||||
$this->_tokenSubType = $value;
|
$this->_tokenSubType = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -34,58 +34,58 @@
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Function {
|
class PHPExcel_Calculation_Function {
|
||||||
/* Function categories */
|
/* Function categories */
|
||||||
const CATEGORY_CUBE = 'Cube';
|
const CATEGORY_CUBE = 'Cube';
|
||||||
const CATEGORY_DATABASE = 'Database';
|
const CATEGORY_DATABASE = 'Database';
|
||||||
const CATEGORY_DATE_AND_TIME = 'Date and Time';
|
const CATEGORY_DATE_AND_TIME = 'Date and Time';
|
||||||
const CATEGORY_ENGINEERING = 'Engineering';
|
const CATEGORY_ENGINEERING = 'Engineering';
|
||||||
const CATEGORY_FINANCIAL = 'Financial';
|
const CATEGORY_FINANCIAL = 'Financial';
|
||||||
const CATEGORY_INFORMATION = 'Information';
|
const CATEGORY_INFORMATION = 'Information';
|
||||||
const CATEGORY_LOGICAL = 'Logical';
|
const CATEGORY_LOGICAL = 'Logical';
|
||||||
const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
|
const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
|
||||||
const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
|
const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
|
||||||
const CATEGORY_STATISTICAL = 'Statistical';
|
const CATEGORY_STATISTICAL = 'Statistical';
|
||||||
const CATEGORY_TEXT_AND_DATA = 'Text and Data';
|
const CATEGORY_TEXT_AND_DATA = 'Text and Data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category (represented by CATEGORY_*)
|
* Category (represented by CATEGORY_*)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_category;
|
private $_category;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel name
|
* Excel name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_excelName;
|
private $_excelName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel name
|
* PHPExcel name
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_phpExcelName;
|
private $_phpExcelName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Calculation_Function
|
* Create a new 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 PHPExcel_Calculation_Exception
|
* @throws PHPExcel_Calculation_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
||||||
{
|
{
|
||||||
if (($pCategory !== NULL) && ($pExcelName !== NULL) && ($pPHPExcelName !== NULL)) {
|
if (($pCategory !== NULL) && ($pExcelName !== NULL) && ($pPHPExcelName !== NULL)) {
|
||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_category = $pCategory;
|
$this->_category = $pCategory;
|
||||||
$this->_excelName = $pExcelName;
|
$this->_excelName = $pExcelName;
|
||||||
$this->_phpExcelName = $pPHPExcelName;
|
$this->_phpExcelName = $pPHPExcelName;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,21 +94,21 @@ class PHPExcel_Calculation_Function {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCategory() {
|
public function getCategory() {
|
||||||
return $this->_category;
|
return $this->_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Category (represented by CATEGORY_*)
|
* Set Category (represented by CATEGORY_*)
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @throws PHPExcel_Calculation_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 PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,16 +117,16 @@ class PHPExcel_Calculation_Function {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getExcelName() {
|
public function getExcelName() {
|
||||||
return $this->_excelName;
|
return $this->_excelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Excel name
|
* Set Excel name
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setExcelName($value) {
|
public function setExcelName($value) {
|
||||||
$this->_excelName = $value;
|
$this->_excelName = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,15 +135,15 @@ class PHPExcel_Calculation_Function {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPHPExcelName() {
|
public function getPHPExcelName() {
|
||||||
return $this->_phpExcelName;
|
return $this->_phpExcelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set PHPExcel name
|
* Set PHPExcel name
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setPHPExcelName($value) {
|
public function setPHPExcelName($value) {
|
||||||
$this->_phpExcelName = $value;
|
$this->_phpExcelName = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,271 +18,271 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
if (!defined('PHPEXCEL_ROOT')) {
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Calculation_Logical
|
* PHPExcel_Calculation_Logical
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Logical {
|
class PHPExcel_Calculation_Logical {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TRUE
|
* TRUE
|
||||||
*
|
*
|
||||||
* Returns the boolean TRUE.
|
* Returns the boolean TRUE.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =TRUE()
|
* =TRUE()
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @return boolean True
|
* @return boolean True
|
||||||
*/
|
*/
|
||||||
public static function TRUE() {
|
public static function TRUE() {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // function TRUE()
|
} // function TRUE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FALSE
|
* FALSE
|
||||||
*
|
*
|
||||||
* Returns the boolean FALSE.
|
* Returns the boolean FALSE.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =FALSE()
|
* =FALSE()
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @return boolean False
|
* @return boolean False
|
||||||
*/
|
*/
|
||||||
public static function FALSE() {
|
public static function FALSE() {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} // function FALSE()
|
} // function FALSE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LOGICAL_AND
|
* LOGICAL_AND
|
||||||
*
|
*
|
||||||
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =AND(logical1[,logical2[, ...]])
|
* =AND(logical1[,logical2[, ...]])
|
||||||
*
|
*
|
||||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||||
* or references that contain logical values.
|
* or references that contain logical values.
|
||||||
*
|
*
|
||||||
* Boolean arguments are treated as True or False as appropriate
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param mixed $arg,... Data values
|
* @param mixed $arg,... Data values
|
||||||
* @return boolean The logical AND of the arguments.
|
* @return boolean The logical AND of the arguments.
|
||||||
*/
|
*/
|
||||||
public static function LOGICAL_AND() {
|
public static function LOGICAL_AND() {
|
||||||
// Return value
|
// Return value
|
||||||
$returnValue = TRUE;
|
$returnValue = TRUE;
|
||||||
|
|
||||||
// Loop through the arguments
|
// Loop through the arguments
|
||||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||||
$argCount = -1;
|
$argCount = -1;
|
||||||
foreach ($aArgs as $argCount => $arg) {
|
foreach ($aArgs as $argCount => $arg) {
|
||||||
// Is it a boolean value?
|
// Is it a boolean value?
|
||||||
if (is_bool($arg)) {
|
if (is_bool($arg)) {
|
||||||
$returnValue = $returnValue && $arg;
|
$returnValue = $returnValue && $arg;
|
||||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||||
$returnValue = $returnValue && ($arg != 0);
|
$returnValue = $returnValue && ($arg != 0);
|
||||||
} elseif (is_string($arg)) {
|
} elseif (is_string($arg)) {
|
||||||
$arg = strtoupper($arg);
|
$arg = strtoupper($arg);
|
||||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||||
$arg = TRUE;
|
$arg = TRUE;
|
||||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||||
$arg = FALSE;
|
$arg = FALSE;
|
||||||
} else {
|
} else {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
$returnValue = $returnValue && ($arg != 0);
|
$returnValue = $returnValue && ($arg != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
if ($argCount < 0) {
|
if ($argCount < 0) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
} // function LOGICAL_AND()
|
} // function LOGICAL_AND()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LOGICAL_OR
|
* LOGICAL_OR
|
||||||
*
|
*
|
||||||
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =OR(logical1[,logical2[, ...]])
|
* =OR(logical1[,logical2[, ...]])
|
||||||
*
|
*
|
||||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||||
* or references that contain logical values.
|
* or references that contain logical values.
|
||||||
*
|
*
|
||||||
* Boolean arguments are treated as True or False as appropriate
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param mixed $arg,... Data values
|
* @param mixed $arg,... Data values
|
||||||
* @return boolean The logical OR of the arguments.
|
* @return boolean The logical OR of the arguments.
|
||||||
*/
|
*/
|
||||||
public static function LOGICAL_OR() {
|
public static function LOGICAL_OR() {
|
||||||
// Return value
|
// Return value
|
||||||
$returnValue = FALSE;
|
$returnValue = FALSE;
|
||||||
|
|
||||||
// Loop through the arguments
|
// Loop through the arguments
|
||||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||||
$argCount = -1;
|
$argCount = -1;
|
||||||
foreach ($aArgs as $argCount => $arg) {
|
foreach ($aArgs as $argCount => $arg) {
|
||||||
// Is it a boolean value?
|
// Is it a boolean value?
|
||||||
if (is_bool($arg)) {
|
if (is_bool($arg)) {
|
||||||
$returnValue = $returnValue || $arg;
|
$returnValue = $returnValue || $arg;
|
||||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||||
$returnValue = $returnValue || ($arg != 0);
|
$returnValue = $returnValue || ($arg != 0);
|
||||||
} elseif (is_string($arg)) {
|
} elseif (is_string($arg)) {
|
||||||
$arg = strtoupper($arg);
|
$arg = strtoupper($arg);
|
||||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||||
$arg = TRUE;
|
$arg = TRUE;
|
||||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||||
$arg = FALSE;
|
$arg = FALSE;
|
||||||
} else {
|
} else {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
$returnValue = $returnValue || ($arg != 0);
|
$returnValue = $returnValue || ($arg != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
if ($argCount < 0) {
|
if ($argCount < 0) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
} // function LOGICAL_OR()
|
} // function LOGICAL_OR()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOT
|
* NOT
|
||||||
*
|
*
|
||||||
* Returns the boolean inverse of the argument.
|
* Returns the boolean inverse of the argument.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =NOT(logical)
|
* =NOT(logical)
|
||||||
*
|
*
|
||||||
* The argument must evaluate to a logical value such as TRUE or FALSE
|
* The argument must evaluate to a logical value such as TRUE or FALSE
|
||||||
*
|
*
|
||||||
* Boolean arguments are treated as True or False as appropriate
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
||||||
* @return boolean The boolean inverse of the argument.
|
* @return boolean The boolean inverse of the argument.
|
||||||
*/
|
*/
|
||||||
public static function NOT($logical=FALSE) {
|
public static function NOT($logical=FALSE) {
|
||||||
$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
|
$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
|
||||||
if (is_string($logical)) {
|
if (is_string($logical)) {
|
||||||
$logical = strtoupper($logical);
|
$logical = strtoupper($logical);
|
||||||
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !$logical;
|
return !$logical;
|
||||||
} // function NOT()
|
} // function NOT()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* STATEMENT_IF
|
* STATEMENT_IF
|
||||||
*
|
*
|
||||||
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =IF(condition[,returnIfTrue[,returnIfFalse]])
|
* =IF(condition[,returnIfTrue[,returnIfFalse]])
|
||||||
*
|
*
|
||||||
* Condition is any value or expression that can be evaluated to TRUE or FALSE.
|
* Condition is any value or expression that can be evaluated to TRUE or FALSE.
|
||||||
* For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
|
* For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
|
||||||
* the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
|
* the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
|
||||||
* This argument can use any comparison calculation operator.
|
* This argument can use any comparison calculation operator.
|
||||||
* ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
|
* ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
|
||||||
* For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
|
* For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
|
||||||
* then the IF function returns the text "Within budget"
|
* then the IF function returns the text "Within budget"
|
||||||
* If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
|
* If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
|
||||||
* the logical value TRUE for this argument.
|
* the logical value TRUE for this argument.
|
||||||
* ReturnIfTrue can be another formula.
|
* ReturnIfTrue can be another formula.
|
||||||
* ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
|
* ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
|
||||||
* For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
|
* For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
|
||||||
* then the IF function returns the text "Over budget".
|
* then the IF function returns the text "Over budget".
|
||||||
* If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
|
* If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
|
||||||
* If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
|
* If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
|
||||||
* ReturnIfFalse can be another formula.
|
* ReturnIfFalse can be another formula.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param mixed $condition Condition to evaluate
|
* @param mixed $condition Condition to evaluate
|
||||||
* @param mixed $returnIfTrue Value to return when condition is true
|
* @param mixed $returnIfTrue Value to return when condition is true
|
||||||
* @param mixed $returnIfFalse Optional value to return when condition is false
|
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||||
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||||
*/
|
*/
|
||||||
public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) {
|
public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) {
|
||||||
$condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
$condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||||
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
|
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
|
||||||
$returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
|
$returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
|
||||||
|
|
||||||
return ($condition) ? $returnIfTrue : $returnIfFalse;
|
return ($condition) ? $returnIfTrue : $returnIfFalse;
|
||||||
} // function STATEMENT_IF()
|
} // function STATEMENT_IF()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IFERROR
|
* IFERROR
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* =IFERROR(testValue,errorpart)
|
* =IFERROR(testValue,errorpart)
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @category Logical Functions
|
* @category Logical Functions
|
||||||
* @param mixed $testValue Value to check, is also the value returned when no error
|
* @param mixed $testValue Value to check, is also the value returned when no error
|
||||||
* @param mixed $errorpart Value to return when testValue is an error condition
|
* @param mixed $errorpart Value to return when testValue is an error condition
|
||||||
* @return mixed The value of errorpart or testValue determined by error condition
|
* @return mixed The value of errorpart or testValue determined by error condition
|
||||||
*/
|
*/
|
||||||
public static function IFERROR($testValue = '', $errorpart = '') {
|
public static function IFERROR($testValue = '', $errorpart = '') {
|
||||||
$testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
$testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||||
$errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
|
$errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
|
||||||
|
|
||||||
return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
|
return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
|
||||||
} // function IFERROR()
|
} // function IFERROR()
|
||||||
|
|
||||||
} // class PHPExcel_Calculation_Logical
|
} // class PHPExcel_Calculation_Logical
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Calculation_Token_Stack
|
* PHPExcel_Calculation_Token_Stack
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Cell_AdvancedValueBinder
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,25 +34,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
|
||||||
if (!defined('PHPEXCEL_ROOT')) {
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
|
||||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Cell_AdvancedValueBinder
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Cell
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 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
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -66,16 +57,16 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
|
if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
|
||||||
// Test for booleans using locale-setting
|
// Test for booleans using locale-setting
|
||||||
if ($value == PHPExcel_Calculation::getTRUE()) {
|
if ($value == PHPExcel_Calculation::getTRUE()) {
|
||||||
$cell->setValueExplicit( TRUE, PHPExcel_Cell_DataType::TYPE_BOOL);
|
$cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||||
return true;
|
return true;
|
||||||
} elseif($value == PHPExcel_Calculation::getFALSE()) {
|
} elseif($value == PHPExcel_Calculation::getFALSE()) {
|
||||||
$cell->setValueExplicit( FALSE, PHPExcel_Cell_DataType::TYPE_BOOL);
|
$cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for number in scientific format
|
// Check for number in scientific format
|
||||||
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
|
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
|
||||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +75,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
// 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->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( '??/??' );
|
->getNumberFormat()->setFormatCode( '??/??' );
|
||||||
|
@ -93,7 +84,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
// Convert value to number
|
// Convert value to number
|
||||||
$value = $matches[2] + ($matches[3] / $matches[4]);
|
$value = $matches[2] + ($matches[3] / $matches[4]);
|
||||||
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->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
->getNumberFormat()->setFormatCode( '# ??/??' );
|
->getNumberFormat()->setFormatCode( '# ??/??' );
|
||||||
|
@ -107,7 +98,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +113,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->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)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||||
|
@ -131,7 +122,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +134,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +147,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
// Set style
|
// Set style
|
||||||
$cell->getWorksheet()->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,12 +167,12 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for newline character "\n"
|
// Check for newline character "\n"
|
||||||
if (strpos($value, "\n") !== FALSE) {
|
if (strpos($value, "\n") !== false) {
|
||||||
$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->getWorksheet()->getStyle( $cell->getCoordinate() )
|
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||||
->getAlignment()->setWrapText(TRUE);
|
->getAlignment()->setWrapText(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Cell_DataType
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,15 +25,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Cell_DataType
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Cell
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Cell_DataType
|
class PHPExcel_Cell_DataType
|
||||||
{
|
{
|
||||||
/* Data types */
|
/* Data types */
|
||||||
|
@ -50,7 +42,7 @@ class PHPExcel_Cell_DataType
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $_errorCodes = array(
|
private static $errorCodes = array(
|
||||||
'#NULL!' => 0,
|
'#NULL!' => 0,
|
||||||
'#DIV/0!' => 1,
|
'#DIV/0!' => 1,
|
||||||
'#VALUE!' => 2,
|
'#VALUE!' => 2,
|
||||||
|
@ -65,8 +57,9 @@ class PHPExcel_Cell_DataType
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getErrorCodes() {
|
public static function getErrorCodes()
|
||||||
return self::$_errorCodes;
|
{
|
||||||
|
return self::$errorCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +69,8 @@ class PHPExcel_Cell_DataType
|
||||||
* @param mixed $pValue
|
* @param mixed $pValue
|
||||||
* @return string
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +106,7 @@ class PHPExcel_Cell_DataType
|
||||||
{
|
{
|
||||||
$pValue = (string) $pValue;
|
$pValue = (string) $pValue;
|
||||||
|
|
||||||
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
if (!array_key_exists($pValue, self::$errorCodes)) {
|
||||||
$pValue = '#NULL!';
|
$pValue = '#NULL!';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Cell_DataValidation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,15 +25,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Cell_DataValidation
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Cell
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Cell_DataValidation
|
class PHPExcel_Cell_DataValidation
|
||||||
{
|
{
|
||||||
/* Data validation types */
|
/* Data validation types */
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Cell_DefaultValueBinder
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,25 +34,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
|
||||||
if (!defined('PHPEXCEL_ROOT')) {
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
|
||||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Cell_DefaultValueBinder
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Cell
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +58,7 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set value explicit
|
// Set value explicit
|
||||||
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
$cell->setValueExplicit($value, self::dataTypeForValue($value));
|
||||||
|
|
||||||
// Done!
|
// Done!
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,7 +70,8 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
* @param mixed $pValue
|
* @param mixed $pValue
|
||||||
* @return string
|
* @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
|
||||||
if ($pValue === null) {
|
if ($pValue === null) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,15 +25,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Cell_Hyperlink
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Cell
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Cell_Hyperlink
|
class PHPExcel_Cell_Hyperlink
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -40,14 +32,14 @@ class PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_url;
|
private $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tooltip to display on the hyperlink
|
* Tooltip to display on the hyperlink
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_tooltip;
|
private $tooltip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Cell_Hyperlink
|
* Create a new PHPExcel_Cell_Hyperlink
|
||||||
|
@ -58,8 +50,8 @@ class PHPExcel_Cell_Hyperlink
|
||||||
public function __construct($pUrl = '', $pTooltip = '')
|
public function __construct($pUrl = '', $pTooltip = '')
|
||||||
{
|
{
|
||||||
// Initialise member variables
|
// Initialise member variables
|
||||||
$this->_url = $pUrl;
|
$this->url = $pUrl;
|
||||||
$this->_tooltip = $pTooltip;
|
$this->tooltip = $pTooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,8 +59,9 @@ class PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getUrl() {
|
public function getUrl()
|
||||||
return $this->_url;
|
{
|
||||||
|
return $this->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +70,9 @@ class PHPExcel_Cell_Hyperlink
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Cell_Hyperlink
|
* @return PHPExcel_Cell_Hyperlink
|
||||||
*/
|
*/
|
||||||
public function setUrl($value = '') {
|
public function setUrl($value = '')
|
||||||
$this->_url = $value;
|
{
|
||||||
|
$this->url = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +81,9 @@ class PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTooltip() {
|
public function getTooltip()
|
||||||
return $this->_tooltip;
|
{
|
||||||
|
return $this->tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,8 +92,9 @@ class PHPExcel_Cell_Hyperlink
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Cell_Hyperlink
|
* @return PHPExcel_Cell_Hyperlink
|
||||||
*/
|
*/
|
||||||
public function setTooltip($value = '') {
|
public function setTooltip($value = '')
|
||||||
$this->_tooltip = $value;
|
{
|
||||||
|
$this->tooltip = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +103,9 @@ class PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isInternal() {
|
public function isInternal()
|
||||||
return strpos($this->_url, 'sheet://') !== false;
|
{
|
||||||
|
return strpos($this->url, 'sheet://') !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,11 +113,12 @@ class PHPExcel_Cell_Hyperlink
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode()
|
||||||
|
{
|
||||||
return md5(
|
return md5(
|
||||||
$this->_url
|
$this->url .
|
||||||
. $this->_tooltip
|
$this->tooltip .
|
||||||
. __CLASS__
|
__CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -42,5 +43,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP
|
||||||
{
|
{
|
||||||
return md5(
|
return md5(
|
||||||
$this->getText() .
|
$this->getText() .
|
||||||
$this->_font->getHashCode() .
|
$this->font->getHashCode() .
|
||||||
__CLASS__
|
__CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||||
public function getHashCode()
|
public function getHashCode()
|
||||||
{
|
{
|
||||||
return md5(
|
return md5(
|
||||||
$this->_text .
|
$this->text .
|
||||||
__CLASS__
|
__CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ class PHPExcel_Settings
|
||||||
if (!in_array($libraryName, self::$pdfRenderers)) {
|
if (!in_array($libraryName, self::$pdfRenderers)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self::$_pdfRendererName = $libraryName;
|
self::$pdfRendererName = $libraryName;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ class PHPExcel_Settings
|
||||||
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
|
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
|
||||||
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||||
}
|
}
|
||||||
self::$_libXmlLoaderOptions = $options;
|
self::$libXmlLoaderOptions = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,12 +376,12 @@ class PHPExcel_Settings
|
||||||
*/
|
*/
|
||||||
public static function getLibXmlLoaderOptions()
|
public static function getLibXmlLoaderOptions()
|
||||||
{
|
{
|
||||||
if (is_null(self::$_libXmlLoaderOptions) && defined(LIBXML_DTDLOAD)) {
|
if (is_null(self::$libXmlLoaderOptions) && defined(LIBXML_DTDLOAD)) {
|
||||||
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
|
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
|
||||||
}
|
}
|
||||||
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
|
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
|
||||||
@libxml_disable_entity_loader(self::$libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
@libxml_disable_entity_loader(self::$libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
|
||||||
}
|
}
|
||||||
return self::$_libXmlLoaderOptions;
|
return self::$libXmlLoaderOptions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Writer_PDF
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,15 +25,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Writer_PDF
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Writer_PDF
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -41,7 +33,7 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Writer_PDF_Core
|
* @var PHPExcel_Writer_PDF_Core
|
||||||
*/
|
*/
|
||||||
private $_renderer = NULL;
|
private $renderer = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a new renderer of the configured type within this container class
|
* Instantiate a new renderer of the configured type within this container class
|
||||||
|
@ -67,7 +59,7 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
$rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName;
|
$rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName;
|
||||||
$this->_renderer = new $rendererName($phpExcel);
|
$this->renderer = new $rendererName($phpExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,11 +72,11 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
||||||
*/
|
*/
|
||||||
public function __call($name, $arguments)
|
public function __call($name, $arguments)
|
||||||
{
|
{
|
||||||
if ($this->_renderer === NULL) {
|
if ($this->renderer === null) {
|
||||||
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
|
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return call_user_func_array(array($this->_renderer, $name), $arguments);
|
return call_user_func_array(array($this->renderer, $name), $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +84,6 @@ class PHPExcel_Writer_PDF implements PHPExcel_Writer_IWriter
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
$this->_renderer->save($pFilename);
|
$this->renderer->save($pFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Writer_PDF_Core
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,15 +25,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Writer_PDF_Core
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Writer_PDF
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -54,14 +46,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_orientation = NULL;
|
protected $orientation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paper size (Over-ride)
|
* Paper size (Over-ride)
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $_paperSize = NULL;
|
protected $paperSize;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,14 +61,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_saveArrayReturnType;
|
private $saveArrayReturnType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paper Sizes xRef List
|
* Paper Sizes xRef List
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected static $_paperSizes = array(
|
protected static $paperSizes = array(
|
||||||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER
|
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER
|
||||||
=> 'LETTER', // (8.5 in. by 11 in.)
|
=> 'LETTER', // (8.5 in. by 11 in.)
|
||||||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL
|
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL
|
||||||
|
@ -219,7 +211,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(PHPExcel $phpExcel)
|
||||||
{
|
{
|
||||||
parent::__construct($phpExcel);
|
parent::__construct($phpExcel);
|
||||||
$this->setUseInlineCss(TRUE);
|
$this->setUseInlineCss(true);
|
||||||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +247,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function getPaperSize()
|
public function getPaperSize()
|
||||||
{
|
{
|
||||||
return $this->_paperSize;
|
return $this->paperSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -266,7 +258,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
|
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
|
||||||
{
|
{
|
||||||
$this->_paperSize = $pValue;
|
$this->paperSize = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +269,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function getOrientation()
|
public function getOrientation()
|
||||||
{
|
{
|
||||||
return $this->_orientation;
|
return $this->orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,7 +280,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
|
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
|
||||||
{
|
{
|
||||||
$this->_orientation = $pValue;
|
$this->orientation = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,24 +317,24 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
protected function prepareForSave($pFilename = NULL)
|
protected function prepareForSave($pFilename = null)
|
||||||
{
|
{
|
||||||
// garbage collect
|
// garbage collect
|
||||||
$this->_phpExcel->garbageCollect();
|
$this->_phpExcel->garbageCollect();
|
||||||
|
|
||||||
$this->_saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
$this->saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
||||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'w');
|
$fileHandle = fopen($pFilename, 'w');
|
||||||
if ($fileHandle === FALSE) {
|
if ($fileHandle === false) {
|
||||||
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
|
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set PDF
|
// Set PDF
|
||||||
$this->_isPdf = TRUE;
|
$this->_isPdf = true;
|
||||||
// Build CSS
|
// Build CSS
|
||||||
$this->buildCSS(TRUE);
|
$this->buildCSS(true);
|
||||||
|
|
||||||
return $fileHandle;
|
return $fileHandle;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +350,6 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
// Close file
|
// Close file
|
||||||
fclose($fileHandle);
|
fclose($fileHandle);
|
||||||
|
|
||||||
PHPExcel_Calculation::setArrayReturnType($this->_saveArrayReturnType);
|
PHPExcel_Calculation::setArrayReturnType($this->saveArrayReturnType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** Require DomPDF library */
|
||||||
|
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/dompdf_config.inc.php';
|
||||||
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
|
require_once $pdfRendererClassFile;
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Writer_PDF_DomPDF
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,23 +33,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** Require DomPDF library */
|
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/dompdf_config.inc.php';
|
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
|
||||||
require_once $pdfRendererClassFile;
|
|
||||||
} else {
|
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Writer_PDF_DomPDF
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Writer_PDF
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +51,7 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = NULL)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
$fileHandle = parent::prepareForSave($pFilename);
|
$fileHandle = parent::prepareForSave($pFilename);
|
||||||
|
|
||||||
|
@ -69,21 +61,16 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
// Check for paper size and page orientation
|
// Check for paper size and page orientation
|
||||||
if (is_null($this->getSheetIndex())) {
|
if (is_null($this->getSheetIndex())) {
|
||||||
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
||||||
} else {
|
} else {
|
||||||
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$orientation = ($orientation == 'L') ? 'landscape' : 'portrait';
|
$orientation = ($orientation == 'L') ? 'landscape' : 'portrait';
|
||||||
|
|
||||||
// Override Page Orientation
|
// Override Page Orientation
|
||||||
|
@ -97,8 +84,8 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
$printPaperSize = $this->getPaperSize();
|
$printPaperSize = $this->getPaperSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset(self::$_paperSizes[$printPaperSize])) {
|
if (isset(self::$paperSizes[$printPaperSize])) {
|
||||||
$paperSize = self::$_paperSizes[$printPaperSize];
|
$paperSize = self::$paperSizes[$printPaperSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +94,7 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
$pdf->set_paper(strtolower($paperSize), $orientation);
|
$pdf->set_paper(strtolower($paperSize), $orientation);
|
||||||
|
|
||||||
$pdf->load_html(
|
$pdf->load_html(
|
||||||
$this->generateHTMLHeader(FALSE) .
|
$this->generateHTMLHeader(false) .
|
||||||
$this->generateSheetData() .
|
$this->generateSheetData() .
|
||||||
$this->generateHTMLFooter()
|
$this->generateHTMLFooter()
|
||||||
);
|
);
|
||||||
|
@ -116,7 +103,6 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
// Write to file
|
// Write to file
|
||||||
fwrite($fileHandle, $pdf->output());
|
fwrite($fileHandle, $pdf->output());
|
||||||
|
|
||||||
parent::restoreStateAfterSave($fileHandle);
|
parent::restoreStateAfterSave($fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** Require mPDF library */
|
||||||
|
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/mpdf.php';
|
||||||
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
|
require_once $pdfRendererClassFile;
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Writer_PDF_mPDF
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,23 +33,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** Require mPDF library */
|
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/mpdf.php';
|
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
|
||||||
require_once $pdfRendererClassFile;
|
|
||||||
} else {
|
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Writer_PDF_mPDF
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Writer_PDF
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +51,7 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = NULL)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
$fileHandle = parent::prepareForSave($pFilename);
|
$fileHandle = parent::prepareForSave($pFilename);
|
||||||
|
|
||||||
|
@ -69,16 +61,12 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
// Check for paper size and page orientation
|
// Check for paper size and page orientation
|
||||||
if (is_null($this->getSheetIndex())) {
|
if (is_null($this->getSheetIndex())) {
|
||||||
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
||||||
} else {
|
} else {
|
||||||
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
||||||
}
|
}
|
||||||
|
@ -97,10 +85,11 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
$printPaperSize = $this->getPaperSize();
|
$printPaperSize = $this->getPaperSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset(self::$_paperSizes[$printPaperSize])) {
|
if (isset(self::$paperSizes[$printPaperSize])) {
|
||||||
$paperSize = self::$_paperSizes[$printPaperSize];
|
$paperSize = self::$paperSizes[$printPaperSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
$pdf = new mpdf();
|
$pdf = new mpdf();
|
||||||
$ortmp = $orientation;
|
$ortmp = $orientation;
|
||||||
|
@ -116,7 +105,7 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
|
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
|
||||||
|
|
||||||
$pdf->WriteHTML(
|
$pdf->WriteHTML(
|
||||||
$this->generateHTMLHeader(FALSE) .
|
$this->generateHTMLHeader(false) .
|
||||||
$this->generateSheetData() .
|
$this->generateSheetData() .
|
||||||
$this->generateHTMLFooter()
|
$this->generateHTMLFooter()
|
||||||
);
|
);
|
||||||
|
@ -124,7 +113,6 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
// Write to file
|
// Write to file
|
||||||
fwrite($fileHandle, $pdf->Output('', 'S'));
|
fwrite($fileHandle, $pdf->Output('', 'S'));
|
||||||
|
|
||||||
parent::restoreStateAfterSave($fileHandle);
|
parent::restoreStateAfterSave($fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** Require tcPDF library */
|
||||||
|
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/tcpdf.php';
|
||||||
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
|
$k_path_url = PHPExcel_Settings::getPdfRendererPath();
|
||||||
|
require_once $pdfRendererClassFile;
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel_Writer_PDF_tcPDF
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -24,24 +34,6 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** Require tcPDF library */
|
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/tcpdf.php';
|
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
|
||||||
$k_path_url = PHPExcel_Settings::getPdfRendererPath();
|
|
||||||
require_once $pdfRendererClassFile;
|
|
||||||
} else {
|
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHPExcel_Writer_PDF_tcPDF
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel_Writer_PDF
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
*/
|
|
||||||
class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +52,7 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = NULL)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
$fileHandle = parent::prepareForSave($pFilename);
|
$fileHandle = parent::prepareForSave($pFilename);
|
||||||
|
|
||||||
|
@ -70,16 +62,12 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
// Check for paper size and page orientation
|
// Check for paper size and page orientation
|
||||||
if (is_null($this->getSheetIndex())) {
|
if (is_null($this->getSheetIndex())) {
|
||||||
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
|
||||||
} else {
|
} else {
|
||||||
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
|
||||||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
|
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
||||||
? 'L'
|
|
||||||
: 'P';
|
|
||||||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
||||||
}
|
}
|
||||||
|
@ -95,27 +83,27 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
$printPaperSize = $this->getPaperSize();
|
$printPaperSize = $this->getPaperSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset(self::$_paperSizes[$printPaperSize])) {
|
if (isset(self::$paperSizes[$printPaperSize])) {
|
||||||
$paperSize = self::$_paperSizes[$printPaperSize];
|
$paperSize = self::$paperSizes[$printPaperSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
$pdf = new TCPDF($orientation, 'pt', $paperSize);
|
$pdf = new TCPDF($orientation, 'pt', $paperSize);
|
||||||
$pdf->setFontSubsetting(FALSE);
|
$pdf->setFontSubsetting(false);
|
||||||
// Set margins, converting inches to points (using 72 dpi)
|
// Set margins, converting inches to points (using 72 dpi)
|
||||||
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
|
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
|
||||||
$pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72);
|
$pdf->SetAutoPageBreak(true, $printMargins->getBottom() * 72);
|
||||||
|
|
||||||
$pdf->setPrintHeader(FALSE);
|
$pdf->setPrintHeader(false);
|
||||||
$pdf->setPrintFooter(FALSE);
|
$pdf->setPrintFooter(false);
|
||||||
|
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
|
|
||||||
// Set the appropriate font
|
// Set the appropriate font
|
||||||
$pdf->SetFont($this->getFont());
|
$pdf->SetFont($this->getFont());
|
||||||
$pdf->writeHTML(
|
$pdf->writeHTML(
|
||||||
$this->generateHTMLHeader(FALSE) .
|
$this->generateHTMLHeader(false) .
|
||||||
$this->generateSheetData() .
|
$this->generateSheetData() .
|
||||||
$this->generateHTMLFooter()
|
$this->generateHTMLFooter()
|
||||||
);
|
);
|
||||||
|
@ -130,7 +118,6 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
// Write to file
|
// Write to file
|
||||||
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
|
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
|
||||||
|
|
||||||
parent::restoreStateAfterSave($fileHandle);
|
parent::restoreStateAfterSave($fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue