PSR-2 : Fixes
This commit is contained in:
parent
e18ba38f16
commit
96f3d0e6ee
|
@ -109,7 +109,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAuthor() {
|
public function getAuthor()
|
||||||
|
{
|
||||||
return $this->_author;
|
return $this->_author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +120,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setAuthor($pValue = '') {
|
public function setAuthor($pValue = '')
|
||||||
|
{
|
||||||
$this->_author = $pValue;
|
$this->_author = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +131,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_RichText
|
* @return PHPExcel_RichText
|
||||||
*/
|
*/
|
||||||
public function getText() {
|
public function getText()
|
||||||
|
{
|
||||||
return $this->_text;
|
return $this->_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +142,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param PHPExcel_RichText $pValue
|
* @param PHPExcel_RichText $pValue
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setText(PHPExcel_RichText $pValue) {
|
public function setText(PHPExcel_RichText $pValue)
|
||||||
|
{
|
||||||
$this->_text = $pValue;
|
$this->_text = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +153,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getWidth() {
|
public function getWidth()
|
||||||
|
{
|
||||||
return $this->_width;
|
return $this->_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +164,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setWidth($value = '96pt') {
|
public function setWidth($value = '96pt')
|
||||||
|
{
|
||||||
$this->_width = $value;
|
$this->_width = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +175,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getHeight() {
|
public function getHeight()
|
||||||
|
{
|
||||||
return $this->_height;
|
return $this->_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +186,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setHeight($value = '55.5pt') {
|
public function setHeight($value = '55.5pt')
|
||||||
|
{
|
||||||
$this->_height = $value;
|
$this->_height = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +197,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMarginLeft() {
|
public function getMarginLeft()
|
||||||
|
{
|
||||||
return $this->_marginLeft;
|
return $this->_marginLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +208,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setMarginLeft($value = '59.25pt') {
|
public function setMarginLeft($value = '59.25pt')
|
||||||
|
{
|
||||||
$this->_marginLeft = $value;
|
$this->_marginLeft = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +219,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMarginTop() {
|
public function getMarginTop()
|
||||||
|
{
|
||||||
return $this->_marginTop;
|
return $this->_marginTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +230,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setMarginTop($value = '1.5pt') {
|
public function setMarginTop($value = '1.5pt')
|
||||||
|
{
|
||||||
$this->_marginTop = $value;
|
$this->_marginTop = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +241,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getVisible() {
|
public function getVisible()
|
||||||
|
{
|
||||||
return $this->_visible;
|
return $this->_visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +252,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param boolean $value
|
* @param boolean $value
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setVisible($value = false) {
|
public function setVisible($value = false)
|
||||||
|
{
|
||||||
$this->_visible = $value;
|
$this->_visible = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +263,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Style_Color
|
* @return PHPExcel_Style_Color
|
||||||
*/
|
*/
|
||||||
public function getFillColor() {
|
public function getFillColor()
|
||||||
|
{
|
||||||
return $this->_fillColor;
|
return $this->_fillColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +274,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @return PHPExcel_Comment
|
* @return PHPExcel_Comment
|
||||||
*/
|
*/
|
||||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
|
||||||
|
{
|
||||||
$this->_alignment = $pValue;
|
$this->_alignment = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +285,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAlignment() {
|
public function getAlignment()
|
||||||
|
{
|
||||||
return $this->_alignment;
|
return $this->_alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +295,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode()
|
||||||
|
{
|
||||||
return md5(
|
return md5(
|
||||||
$this->_author
|
$this->_author
|
||||||
. $this->_text->getHashCode()
|
. $this->_text->getHashCode()
|
||||||
|
@ -296,7 +314,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone()
|
||||||
|
{
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
|
@ -312,8 +331,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
|
{
|
||||||
return $this->_text->getPlainText();
|
return $this->_text->getPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Exception extends Exception {
|
class PHPExcel_Exception extends Exception
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Error handler callback
|
* Error handler callback
|
||||||
*
|
*
|
||||||
|
@ -43,7 +44,8 @@ class PHPExcel_Exception extends Exception {
|
||||||
* @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;
|
||||||
|
|
|
@ -157,7 +157,7 @@ class PHPExcel_HashTable
|
||||||
public function getByIndex($pIndex = 0)
|
public function getByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if (isset($this->_keyMap[$pIndex])) {
|
if (isset($this->_keyMap[$pIndex])) {
|
||||||
return $this->getByHashCode( $this->_keyMap[$pIndex] );
|
return $this->getByHashCode($this->_keyMap[$pIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -69,7 +69,9 @@ class PHPExcel_IOFactory
|
||||||
/**
|
/**
|
||||||
* Private constructor for PHPExcel_IOFactory
|
* Private constructor for PHPExcel_IOFactory
|
||||||
*/
|
*/
|
||||||
private function __construct() { }
|
private function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get search locations
|
* Get search locations
|
||||||
|
@ -135,7 +137,7 @@ class PHPExcel_IOFactory
|
||||||
$className = str_replace('{0}', $writerType, $searchLocation['class']);
|
$className = str_replace('{0}', $writerType, $searchLocation['class']);
|
||||||
|
|
||||||
$instance = new $className($phpExcel);
|
$instance = new $className($phpExcel);
|
||||||
if ($instance !== NULL) {
|
if ($instance !== null) {
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +167,7 @@ class PHPExcel_IOFactory
|
||||||
$className = str_replace('{0}', $readerType, $searchLocation['class']);
|
$className = str_replace('{0}', $readerType, $searchLocation['class']);
|
||||||
|
|
||||||
$instance = new $className();
|
$instance = new $className();
|
||||||
if ($instance !== NULL) {
|
if ($instance !== null) {
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +224,7 @@ class PHPExcel_IOFactory
|
||||||
// First, lucky guess by inspecting file extension
|
// First, lucky guess by inspecting file extension
|
||||||
$pathinfo = pathinfo($pFilename);
|
$pathinfo = pathinfo($pFilename);
|
||||||
|
|
||||||
$extensionType = NULL;
|
$extensionType = null;
|
||||||
if (isset($pathinfo['extension'])) {
|
if (isset($pathinfo['extension'])) {
|
||||||
switch (strtolower($pathinfo['extension'])) {
|
switch (strtolower($pathinfo['extension'])) {
|
||||||
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet
|
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet
|
||||||
|
|
|
@ -75,7 +75,7 @@ class PHPExcel_NamedRange
|
||||||
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||||
{
|
{
|
||||||
// Validate data
|
// Validate data
|
||||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
|
||||||
throw new PHPExcel_Exception('Parameters can not be null.');
|
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,8 @@ class PHPExcel_NamedRange
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName()
|
||||||
|
{
|
||||||
return $this->_name;
|
return $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,18 +104,19 @@ class PHPExcel_NamedRange
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public function setName($value = null) {
|
public function setName($value = null)
|
||||||
if ($value !== NULL) {
|
{
|
||||||
|
if ($value !== null) {
|
||||||
// Old title
|
// Old title
|
||||||
$oldTitle = $this->_name;
|
$oldTitle = $this->_name;
|
||||||
|
|
||||||
// Re-attach
|
// Re-attach
|
||||||
if ($this->_worksheet !== NULL) {
|
if ($this->_worksheet !== null) {
|
||||||
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
|
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
|
||||||
}
|
}
|
||||||
$this->_name = $value;
|
$this->_name = $value;
|
||||||
|
|
||||||
if ($this->_worksheet !== NULL) {
|
if ($this->_worksheet !== null) {
|
||||||
$this->_worksheet->getParent()->addNamedRange($this);
|
$this->_worksheet->getParent()->addNamedRange($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +132,8 @@ class PHPExcel_NamedRange
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function getWorksheet() {
|
public function getWorksheet()
|
||||||
|
{
|
||||||
return $this->_worksheet;
|
return $this->_worksheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +143,9 @@ class PHPExcel_NamedRange
|
||||||
* @param PHPExcel_Worksheet $value
|
* @param PHPExcel_Worksheet $value
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public function setWorksheet(PHPExcel_Worksheet $value = null) {
|
public function setWorksheet(PHPExcel_Worksheet $value = null)
|
||||||
if ($value !== NULL) {
|
{
|
||||||
|
if ($value !== null) {
|
||||||
$this->_worksheet = $value;
|
$this->_worksheet = $value;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -152,7 +156,8 @@ class PHPExcel_NamedRange
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRange() {
|
public function getRange()
|
||||||
|
{
|
||||||
return $this->_range;
|
return $this->_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +167,9 @@ class PHPExcel_NamedRange
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public function setRange($value = null) {
|
public function setRange($value = null)
|
||||||
if ($value !== NULL) {
|
{
|
||||||
|
if ($value !== null) {
|
||||||
$this->_range = $value;
|
$this->_range = $value;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -174,7 +180,8 @@ class PHPExcel_NamedRange
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getLocalOnly() {
|
public function getLocalOnly()
|
||||||
|
{
|
||||||
return $this->_localOnly;
|
return $this->_localOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +191,8 @@ class PHPExcel_NamedRange
|
||||||
* @param bool $value
|
* @param bool $value
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public function setLocalOnly($value = false) {
|
public function setLocalOnly($value = false)
|
||||||
|
{
|
||||||
$this->_localOnly = $value;
|
$this->_localOnly = $value;
|
||||||
$this->_scope = $value ? $this->_worksheet : null;
|
$this->_scope = $value ? $this->_worksheet : null;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -195,7 +203,8 @@ class PHPExcel_NamedRange
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet|null
|
* @return PHPExcel_Worksheet|null
|
||||||
*/
|
*/
|
||||||
public function getScope() {
|
public function getScope()
|
||||||
|
{
|
||||||
return $this->_scope;
|
return $this->_scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +214,8 @@ class PHPExcel_NamedRange
|
||||||
* @param PHPExcel_Worksheet|null $value
|
* @param PHPExcel_Worksheet|null $value
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public function setScope(PHPExcel_Worksheet $value = null) {
|
public function setScope(PHPExcel_Worksheet $value = null)
|
||||||
|
{
|
||||||
$this->_scope = $value;
|
$this->_scope = $value;
|
||||||
$this->_localOnly = ($value == null) ? false : true;
|
$this->_localOnly = ($value == null) ? false : true;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -218,14 +228,16 @@ class PHPExcel_NamedRange
|
||||||
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
|
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
|
||||||
* @return PHPExcel_NamedRange
|
* @return PHPExcel_NamedRange
|
||||||
*/
|
*/
|
||||||
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
|
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
|
||||||
|
{
|
||||||
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
|
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone()
|
||||||
|
{
|
||||||
$vars = get_object_vars($this);
|
$vars = get_object_vars($this);
|
||||||
foreach ($vars as $key => $value) {
|
foreach ($vars as $key => $value) {
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
|
|
|
@ -46,8 +46,9 @@ class PHPExcel_ReferenceHelper
|
||||||
*
|
*
|
||||||
* @return PHPExcel_ReferenceHelper
|
* @return PHPExcel_ReferenceHelper
|
||||||
*/
|
*/
|
||||||
public static function getInstance() {
|
public static function getInstance()
|
||||||
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
|
{
|
||||||
|
if (!isset(self::$_instance) || (self::$_instance === null)) {
|
||||||
self::$_instance = new PHPExcel_ReferenceHelper();
|
self::$_instance = new PHPExcel_ReferenceHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +58,8 @@ class PHPExcel_ReferenceHelper
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_ReferenceHelper
|
* Create a new PHPExcel_ReferenceHelper
|
||||||
*/
|
*/
|
||||||
protected function __construct() {
|
protected function __construct()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +70,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param string $b Second column to test (e.g. 'Z')
|
* @param string $b Second column to test (e.g. 'Z')
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function columnSort($a, $b) {
|
public static function columnSort($a, $b)
|
||||||
|
{
|
||||||
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +83,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param string $b Second column to test (e.g. 'Z')
|
* @param string $b Second column to test (e.g. 'Z')
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function columnReverseSort($a, $b) {
|
public static function columnReverseSort($a, $b)
|
||||||
|
{
|
||||||
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +96,10 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param string $b Second cell to test (e.g. 'Z1')
|
* @param string $b Second cell to test (e.g. 'Z1')
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function cellSort($a, $b) {
|
public static function cellSort($a, $b)
|
||||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
{
|
||||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||||
|
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||||
|
|
||||||
if ($ar == $br) {
|
if ($ar == $br) {
|
||||||
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||||
|
@ -110,9 +115,10 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param string $b Second cell to test (e.g. 'Z1')
|
* @param string $b Second cell to test (e.g. 'Z1')
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function cellReverseSort($a, $b) {
|
public static function cellReverseSort($a, $b)
|
||||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
{
|
||||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||||
|
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||||
|
|
||||||
if ($ar == $br) {
|
if ($ar == $br) {
|
||||||
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||||
|
@ -130,20 +136,21 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
|
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
|
||||||
|
{
|
||||||
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
|
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
|
||||||
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
|
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
|
||||||
// Is cell within the range of rows/columns if we're deleting
|
// Is cell within the range of rows/columns if we're deleting
|
||||||
if ($pNumRows < 0 &&
|
if ($pNumRows < 0 &&
|
||||||
($cellRow >= ($beforeRow + $pNumRows)) &&
|
($cellRow >= ($beforeRow + $pNumRows)) &&
|
||||||
($cellRow < $beforeRow)) {
|
($cellRow < $beforeRow)) {
|
||||||
return TRUE;
|
return true;
|
||||||
} elseif ($pNumCols < 0 &&
|
} elseif ($pNumCols < 0 &&
|
||||||
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
|
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
|
||||||
($cellColumnIndex < $beforeColumnIndex)) {
|
($cellColumnIndex < $beforeColumnIndex)) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,15 +227,13 @@ class PHPExcel_ReferenceHelper
|
||||||
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
{
|
{
|
||||||
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
||||||
($pNumCols > 0 || $pNumRows > 0) ?
|
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
|
||||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
|
||||||
|
|
||||||
foreach ($aHyperlinkCollection as $key => $value) {
|
foreach ($aHyperlinkCollection as $key => $value) {
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
if ($key != $newReference) {
|
if ($key != $newReference) {
|
||||||
$pSheet->setHyperlink( $newReference, $value );
|
$pSheet->setHyperlink($newReference, $value);
|
||||||
$pSheet->setHyperlink( $key, null );
|
$pSheet->setHyperlink($key, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,14 +251,13 @@ class PHPExcel_ReferenceHelper
|
||||||
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||||
{
|
{
|
||||||
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
||||||
($pNumCols > 0 || $pNumRows > 0) ?
|
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
|
||||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
|
||||||
foreach ($aDataValidationCollection as $key => $value) {
|
foreach ($aDataValidationCollection as $key => $value) {
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
if ($key != $newReference) {
|
if ($key != $newReference) {
|
||||||
$pSheet->setDataValidation( $newReference, $value );
|
$pSheet->setDataValidation($newReference, $value);
|
||||||
$pSheet->setDataValidation( $key, null );
|
$pSheet->setDataValidation($key, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,8 +302,8 @@ class PHPExcel_ReferenceHelper
|
||||||
foreach ($aProtectedCells as $key => $value) {
|
foreach ($aProtectedCells as $key => $value) {
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
if ($key != $newReference) {
|
if ($key != $newReference) {
|
||||||
$pSheet->protectCells( $newReference, $value, true );
|
$pSheet->protectCells($newReference, $value, true);
|
||||||
$pSheet->unprotectCells( $key );
|
$pSheet->unprotectCells($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +376,7 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
|
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null)
|
||||||
{
|
{
|
||||||
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
||||||
$aCellCollection = $pSheet->getCellCollection();
|
$aCellCollection = $pSheet->getCellCollection();
|
||||||
|
@ -442,8 +446,7 @@ class PHPExcel_ReferenceHelper
|
||||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||||
// Formula should be adjusted
|
// Formula should be adjusted
|
||||||
$pSheet->getCell($newCoordinates)
|
$pSheet->getCell($newCoordinates)
|
||||||
->setValue($this->updateFormulaReferences($cell->getValue(),
|
->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
|
||||||
} else {
|
} else {
|
||||||
// Formula should not be adjusted
|
// Formula should not be adjusted
|
||||||
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
|
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
|
||||||
|
@ -451,14 +454,12 @@ class PHPExcel_ReferenceHelper
|
||||||
|
|
||||||
// Clear the original cell
|
// Clear the original cell
|
||||||
$pSheet->getCellCacheController()->deleteCacheData($cellID);
|
$pSheet->getCellCacheController()->deleteCacheData($cellID);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* We don't need to update styles for rows/columns before our insertion position,
|
/* We don't need to update styles for rows/columns before our insertion position,
|
||||||
but we do still need to adjust any formulae in those cells */
|
but we do still need to adjust any formulae in those cells */
|
||||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||||
// Formula should be adjusted
|
// Formula should be adjusted
|
||||||
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
|
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -472,7 +473,7 @@ class PHPExcel_ReferenceHelper
|
||||||
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
|
||||||
if ($pSheet->cellExists($coordinate)) {
|
if ($pSheet->cellExists($coordinate)) {
|
||||||
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
||||||
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
||||||
|
@ -594,17 +595,17 @@ class PHPExcel_ReferenceHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update worksheet: freeze pane
|
// Update worksheet: freeze pane
|
||||||
if ($pSheet->getFreezePane() != '') {
|
if ($pSheet->getFreezePane() != '') {
|
||||||
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page setup
|
// Page setup
|
||||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||||
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
|
$pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update worksheet: drawings
|
// Update worksheet: drawings
|
||||||
|
@ -620,9 +621,7 @@ class PHPExcel_ReferenceHelper
|
||||||
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
||||||
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
||||||
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
|
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
|
||||||
$namedRange->setRange(
|
$namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
|
||||||
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -642,7 +641,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @return string Updated formula
|
* @return string Updated formula
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
|
||||||
|
{
|
||||||
// Update cell references in the formula
|
// Update cell references in the formula
|
||||||
$formulaBlocks = explode('"', $pFormula);
|
$formulaBlocks = explode('"', $pFormula);
|
||||||
$i = false;
|
$i = false;
|
||||||
|
@ -657,8 +657,8 @@ class PHPExcel_ReferenceHelper
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||||
$fromString .= $match[3].':'.$match[4];
|
$fromString .= $match[3].':'.$match[4];
|
||||||
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows),2);
|
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2);
|
||||||
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows),2);
|
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2);
|
||||||
|
|
||||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||||
|
@ -682,8 +682,8 @@ class PHPExcel_ReferenceHelper
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||||
$fromString .= $match[3].':'.$match[4];
|
$fromString .= $match[3].':'.$match[4];
|
||||||
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
|
||||||
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
|
||||||
|
|
||||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||||
|
@ -781,7 +781,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @return string Updated cell range
|
* @return string Updated cell range
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||||
|
{
|
||||||
// Is it in another worksheet? Will not have to update anything.
|
// Is it in another worksheet? Will not have to update anything.
|
||||||
if (strpos($pCellRange, "!") !== false) {
|
if (strpos($pCellRange, "!") !== false) {
|
||||||
return $pCellRange;
|
return $pCellRange;
|
||||||
|
@ -805,7 +806,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @param string $oldName Old name (name to replace)
|
* @param string $oldName Old name (name to replace)
|
||||||
* @param string $newName New name
|
* @param string $newName New name
|
||||||
*/
|
*/
|
||||||
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
|
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
|
||||||
|
{
|
||||||
if ($oldName == '') {
|
if ($oldName == '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +815,7 @@ class PHPExcel_ReferenceHelper
|
||||||
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
||||||
foreach ($sheet->getCellCollection(false) as $cellID) {
|
foreach ($sheet->getCellCollection(false) as $cellID) {
|
||||||
$cell = $sheet->getCell($cellID);
|
$cell = $sheet->getCell($cellID);
|
||||||
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
|
if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
|
||||||
$formula = $cell->getValue();
|
$formula = $cell->getValue();
|
||||||
if (strpos($formula, $oldName) !== false) {
|
if (strpos($formula, $oldName) !== false) {
|
||||||
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
|
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
|
||||||
|
@ -835,7 +837,8 @@ class PHPExcel_ReferenceHelper
|
||||||
* @return string Updated cell range
|
* @return string Updated cell range
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||||
|
{
|
||||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||||
// Update range
|
// Update range
|
||||||
$range = PHPExcel_Cell::splitRange($pCellRange);
|
$range = PHPExcel_Cell::splitRange($pCellRange);
|
||||||
|
@ -872,23 +875,22 @@ class PHPExcel_ReferenceHelper
|
||||||
* @return string Updated cell reference
|
* @return string Updated cell reference
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||||
|
{
|
||||||
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
||||||
// Get coordinates of $pBefore
|
// Get coordinates of $pBefore
|
||||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
|
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
|
||||||
|
|
||||||
// Get coordinates of $pCellReference
|
// Get coordinates of $pCellReference
|
||||||
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference );
|
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
|
||||||
|
|
||||||
// Verify which parts should be updated
|
// Verify which parts should be updated
|
||||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
|
||||||
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
|
||||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
|
||||||
$newRow >= $beforeRow);
|
|
||||||
|
|
||||||
// Create new column reference
|
// Create new column reference
|
||||||
if ($updateColumn) {
|
if ($updateColumn) {
|
||||||
$newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols );
|
$newColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new row reference
|
// Create new row reference
|
||||||
|
@ -908,7 +910,8 @@ class PHPExcel_ReferenceHelper
|
||||||
*
|
*
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public final function __clone() {
|
final public function __clone()
|
||||||
|
{
|
||||||
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
|
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @return int Value in EMU
|
* @return int Value in EMU
|
||||||
*/
|
*/
|
||||||
public static function pixelsToEMU($pValue = 0) {
|
public static function pixelsToEMU($pValue = 0)
|
||||||
|
{
|
||||||
return round($pValue * 9525);
|
return round($pValue * 9525);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Value in EMU
|
* @param int $pValue Value in EMU
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function EMUToPixels($pValue = 0) {
|
public static function EMUToPixels($pValue = 0)
|
||||||
|
{
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return round($pValue / 9525);
|
return round($pValue / 9525);
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,22 +70,19 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in cell dimension
|
* @return int Value in cell dimension
|
||||||
*/
|
*/
|
||||||
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
|
||||||
|
{
|
||||||
// Font name and size
|
// Font name and size
|
||||||
$name = $pDefaultFont->getName();
|
$name = $pDefaultFont->getName();
|
||||||
$size = $pDefaultFont->getSize();
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
// Exact width can be determined
|
// Exact width can be determined
|
||||||
$colWidth = $pValue
|
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
|
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
|
||||||
} else {
|
} else {
|
||||||
// We don't have data for this particular font and size, use approximation by
|
// We don't have data for this particular font and size, use approximation by
|
||||||
// extrapolating from Calibri 11
|
// extrapolating from Calibri 11
|
||||||
$colWidth = $pValue * 11
|
$colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
|
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $colWidth;
|
return $colWidth;
|
||||||
|
@ -96,23 +95,19 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
|
||||||
|
{
|
||||||
// Font name and size
|
// Font name and size
|
||||||
$name = $pDefaultFont->getName();
|
$name = $pDefaultFont->getName();
|
||||||
$size = $pDefaultFont->getSize();
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
// Exact width can be determined
|
// Exact width can be determined
|
||||||
$colWidth = $pValue
|
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
|
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We don't have data for this particular font and size, use approximation by
|
// We don't have data for this particular font and size, use approximation by
|
||||||
// extrapolating from Calibri 11
|
// extrapolating from Calibri 11
|
||||||
$colWidth = $pValue * $size
|
$colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
||||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
|
|
||||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Round pixels to closest integer
|
// Round pixels to closest integer
|
||||||
|
@ -127,7 +122,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @return int Value in points
|
* @return int Value in points
|
||||||
*/
|
*/
|
||||||
public static function pixelsToPoints($pValue = 0) {
|
public static function pixelsToPoints($pValue = 0)
|
||||||
|
{
|
||||||
return $pValue * 0.67777777;
|
return $pValue * 0.67777777;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +133,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Value in points
|
* @param int $pValue Value in points
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function pointsToPixels($pValue = 0) {
|
public static function pointsToPixels($pValue = 0)
|
||||||
|
{
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return (int) ceil($pValue * 1.333333333);
|
return (int) ceil($pValue * 1.333333333);
|
||||||
} else {
|
} else {
|
||||||
|
@ -151,7 +148,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Degrees
|
* @param int $pValue Degrees
|
||||||
* @return int Angle
|
* @return int Angle
|
||||||
*/
|
*/
|
||||||
public static function degreesToAngle($pValue = 0) {
|
public static function degreesToAngle($pValue = 0)
|
||||||
|
{
|
||||||
return (int)round($pValue * 60000);
|
return (int)round($pValue * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +159,8 @@ class PHPExcel_Shared_Drawing
|
||||||
* @param int $pValue Angle
|
* @param int $pValue Angle
|
||||||
* @return int Degrees
|
* @return int Degrees
|
||||||
*/
|
*/
|
||||||
public static function angleToDegrees($pValue = 0) {
|
public static function angleToDegrees($pValue = 0)
|
||||||
|
{
|
||||||
if ($pValue != 0) {
|
if ($pValue != 0) {
|
||||||
return round($pValue / 60000);
|
return round($pValue / 60000);
|
||||||
} else {
|
} else {
|
||||||
|
@ -179,21 +178,21 @@ class PHPExcel_Shared_Drawing
|
||||||
public static function imagecreatefrombmp($p_sFile)
|
public static function imagecreatefrombmp($p_sFile)
|
||||||
{
|
{
|
||||||
// Load the image into a string
|
// Load the image into a string
|
||||||
$file = fopen($p_sFile,"rb");
|
$file = fopen($p_sFile, "rb");
|
||||||
$read = fread($file,10);
|
$read = fread($file, 10);
|
||||||
while (!feof($file)&&($read<>""))
|
while (!feof($file) && ($read<>"")) {
|
||||||
$read .= fread($file,1024);
|
$read .= fread($file, 1024);
|
||||||
|
}
|
||||||
|
|
||||||
$temp = unpack("H*", $read);
|
$temp = unpack("H*", $read);
|
||||||
$hex = $temp[1];
|
$hex = $temp[1];
|
||||||
$header = substr($hex,0,108);
|
$header = substr($hex, 0, 108);
|
||||||
|
|
||||||
// Process the header
|
// Process the header
|
||||||
// Structure: http://www.fastgraph.com/help/bmp_header_format.html
|
// Structure: http://www.fastgraph.com/help/bmp_header_format.html
|
||||||
if (substr($header,0,4)=="424d")
|
if (substr($header, 0, 4)=="424d") {
|
||||||
{
|
|
||||||
// Cut it in parts of 2 bytes
|
// Cut it in parts of 2 bytes
|
||||||
$header_parts = str_split($header,2);
|
$header_parts = str_split($header, 2);
|
||||||
|
|
||||||
// Get the width 4 bytes
|
// Get the width 4 bytes
|
||||||
$width = hexdec($header_parts[19].$header_parts[18]);
|
$width = hexdec($header_parts[19].$header_parts[18]);
|
||||||
|
@ -213,7 +212,7 @@ class PHPExcel_Shared_Drawing
|
||||||
$image = imagecreatetruecolor($width, $height);
|
$image = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
// Grab the body from the image
|
// Grab the body from the image
|
||||||
$body = substr($hex,108);
|
$body = substr($hex, 108);
|
||||||
|
|
||||||
// Calculate if padding at the end-line is needed
|
// Calculate if padding at the end-line is needed
|
||||||
// Divided by two to keep overview.
|
// Divided by two to keep overview.
|
||||||
|
@ -226,15 +225,14 @@ class PHPExcel_Shared_Drawing
|
||||||
|
|
||||||
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
|
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
|
||||||
// Calculate the next DWORD-position in the body
|
// Calculate the next DWORD-position in the body
|
||||||
for ($i=0;$i<$body_size;$i+=3)
|
for ($i = 0 ; $i < $body_size ; $i += 3) {
|
||||||
{
|
|
||||||
// Calculate line-ending and padding
|
// Calculate line-ending and padding
|
||||||
if ($x>=$width)
|
if ($x >= $width) {
|
||||||
{
|
|
||||||
// If padding needed, ignore image-padding
|
// If padding needed, ignore image-padding
|
||||||
// Shift i to the ending of the current 32-bit-block
|
// Shift i to the ending of the current 32-bit-block
|
||||||
if ($usePadding)
|
if ($usePadding) {
|
||||||
$i += $width%4;
|
$i += $width%4;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset horizontal position
|
// Reset horizontal position
|
||||||
$x = 0;
|
$x = 0;
|
||||||
|
@ -243,13 +241,14 @@ class PHPExcel_Shared_Drawing
|
||||||
$y++;
|
$y++;
|
||||||
|
|
||||||
// Reached the image-height? Break the for-loop
|
// Reached the image-height? Break the for-loop
|
||||||
if ($y>$height)
|
if ($y > $height) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculation of the RGB-pixel (defined as BGR in image-data)
|
// Calculation of the RGB-pixel (defined as BGR in image-data)
|
||||||
// Define $i_pos as absolute position in the body
|
// Define $i_pos as absolute position in the body
|
||||||
$i_pos = $i*2;
|
$i_pos = $i * 2;
|
||||||
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
|
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
|
||||||
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
|
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
|
||||||
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
||||||
|
@ -268,5 +267,4 @@ class PHPExcel_Shared_Drawing
|
||||||
// Return image-object
|
// Return image-object
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher
|
||||||
{
|
{
|
||||||
return $this->_dgContainer = $dgContainer;
|
return $this->_dgContainer = $dgContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PHPExcel_Shared_File
|
||||||
* @protected
|
* @protected
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected static $_useUploadTempDirectory = FALSE;
|
protected static $_useUploadTempDirectory = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,9 +49,10 @@ class PHPExcel_Shared_File
|
||||||
*
|
*
|
||||||
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
||||||
*/
|
*/
|
||||||
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
|
public static function setUseUploadTempDirectory($useUploadTempDir = false)
|
||||||
|
{
|
||||||
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
||||||
} // function setUseUploadTempDirectory()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,9 +60,10 @@ class PHPExcel_Shared_File
|
||||||
*
|
*
|
||||||
* @return boolean Use File Upload Temporary directory (true or false)
|
* @return boolean Use File Upload Temporary directory (true or false)
|
||||||
*/
|
*/
|
||||||
public static function getUseUploadTempDirectory() {
|
public static function getUseUploadTempDirectory()
|
||||||
|
{
|
||||||
return self::$_useUploadTempDirectory;
|
return self::$_useUploadTempDirectory;
|
||||||
} // function getUseUploadTempDirectory()
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,11 +72,12 @@ class PHPExcel_Shared_File
|
||||||
* @param string $pFilename Filename
|
* @param string $pFilename Filename
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function file_exists($pFilename) {
|
public static function file_exists($pFilename)
|
||||||
|
{
|
||||||
// Sick construction, but it seems that
|
// Sick construction, but it seems that
|
||||||
// file_exists returns strange values when
|
// file_exists returns strange values when
|
||||||
// doing the original file_exists on ZIP archives...
|
// doing the original file_exists on ZIP archives...
|
||||||
if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
|
if (strtolower(substr($pFilename, 0, 3)) == 'zip') {
|
||||||
// Open ZIP file and verify if the file exists
|
// Open ZIP file and verify if the file exists
|
||||||
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
|
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
|
||||||
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
|
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
|
||||||
|
@ -99,7 +102,8 @@ class PHPExcel_Shared_File
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function realpath($pFilename) {
|
public static function realpath($pFilename)
|
||||||
|
{
|
||||||
// Returnvalue
|
// Returnvalue
|
||||||
$returnValue = '';
|
$returnValue = '';
|
||||||
|
|
||||||
|
@ -109,8 +113,8 @@ class PHPExcel_Shared_File
|
||||||
}
|
}
|
||||||
|
|
||||||
// Found something?
|
// Found something?
|
||||||
if ($returnValue == '' || ($returnValue === NULL)) {
|
if ($returnValue == '' || ($returnValue === null)) {
|
||||||
$pathArray = explode('/' , $pFilename);
|
$pathArray = explode('/', $pFilename);
|
||||||
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
|
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||||
if ($pathArray[$i] == '..' && $i > 0) {
|
if ($pathArray[$i] == '..' && $i > 0) {
|
||||||
|
@ -137,25 +141,32 @@ class PHPExcel_Shared_File
|
||||||
if (self::$_useUploadTempDirectory) {
|
if (self::$_useUploadTempDirectory) {
|
||||||
// use upload-directory when defined to allow running on environments having very restricted
|
// use upload-directory when defined to allow running on environments having very restricted
|
||||||
// open_basedir configs
|
// open_basedir configs
|
||||||
if (ini_get('upload_tmp_dir') !== FALSE) {
|
if (ini_get('upload_tmp_dir') !== false) {
|
||||||
if ($temp = ini_get('upload_tmp_dir')) {
|
if ($temp = ini_get('upload_tmp_dir')) {
|
||||||
if (file_exists($temp))
|
if (file_exists($temp)) {
|
||||||
return realpath($temp);
|
return realpath($temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sys_get_temp_dir is only available since PHP 5.2.1
|
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||||
if ( !function_exists('sys_get_temp_dir')) {
|
if ( !function_exists('sys_get_temp_dir')) {
|
||||||
if ($temp = getenv('TMP') ) {
|
if ($temp = getenv('TMP') ) {
|
||||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
if ((!empty($temp)) && (file_exists($temp))) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($temp = getenv('TEMP') ) {
|
if ($temp = getenv('TEMP') ) {
|
||||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
if ((!empty($temp)) && (file_exists($temp))) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($temp = getenv('TMPDIR') ) {
|
if ($temp = getenv('TMPDIR') ) {
|
||||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
if ((!empty($temp)) && (file_exists($temp))) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// trick for creating a file in system's temporary dir
|
// trick for creating a file in system's temporary dir
|
||||||
|
@ -174,5 +185,4 @@ class PHPExcel_Shared_File
|
||||||
// be called if we're running 5.2.1 or earlier
|
// be called if we're running 5.2.1 or earlier
|
||||||
return realpath(sys_get_temp_dir());
|
return realpath(sys_get_temp_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ class PHPExcel_Shared_OLE
|
||||||
for ($i = 0; $i < $bbatBlockCount; ++$i) {
|
for ($i = 0; $i < $bbatBlockCount; ++$i) {
|
||||||
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
||||||
fseek($fh, $pos);
|
fseek($fh, $pos);
|
||||||
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
|
for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
|
||||||
$this->bbat[] = self::_readInt4($fh);
|
$this->bbat[] = self::_readInt4($fh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,8 +198,7 @@ class PHPExcel_Shared_OLE
|
||||||
{
|
{
|
||||||
static $isRegistered = false;
|
static $isRegistered = false;
|
||||||
if (!$isRegistered) {
|
if (!$isRegistered) {
|
||||||
stream_wrapper_register('ole-chainedblockstream',
|
stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
|
||||||
'PHPExcel_Shared_OLE_ChainedBlockStream');
|
|
||||||
$isRegistered = true;
|
$isRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +265,7 @@ class PHPExcel_Shared_OLE
|
||||||
public function _readPpsWks($blockId)
|
public function _readPpsWks($blockId)
|
||||||
{
|
{
|
||||||
$fh = $this->getStream($blockId);
|
$fh = $this->getStream($blockId);
|
||||||
for ($pos = 0; ; $pos += 128) {
|
for ($pos = 0;; $pos += 128) {
|
||||||
fseek($fh, $pos, SEEK_SET);
|
fseek($fh, $pos, SEEK_SET);
|
||||||
$nameUtf16 = fread($fh, 64);
|
$nameUtf16 = fread($fh, 64);
|
||||||
$nameLength = self::_readInt2($fh);
|
$nameLength = self::_readInt2($fh);
|
||||||
|
@ -280,8 +279,7 @@ class PHPExcel_Shared_OLE
|
||||||
$this->root = $pps;
|
$this->root = $pps;
|
||||||
break;
|
break;
|
||||||
case self::OLE_PPS_TYPE_DIR:
|
case self::OLE_PPS_TYPE_DIR:
|
||||||
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
|
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
|
||||||
null, null, null, null, array());
|
|
||||||
break;
|
break;
|
||||||
case self::OLE_PPS_TYPE_FILE:
|
case self::OLE_PPS_TYPE_FILE:
|
||||||
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
||||||
|
@ -304,9 +302,7 @@ class PHPExcel_Shared_OLE
|
||||||
$this->_list[] = $pps;
|
$this->_list[] = $pps;
|
||||||
|
|
||||||
// check if the PPS tree (starting from root) is complete
|
// check if the PPS tree (starting from root) is complete
|
||||||
if (isset($this->root) &&
|
if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
|
||||||
$this->_ppsTreeComplete($this->root->No)) {
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,8 +469,7 @@ class PHPExcel_Shared_OLE
|
||||||
// days from 1-1-1601 until the beggining of UNIX era
|
// days from 1-1-1601 until the beggining of UNIX era
|
||||||
$days = 134774;
|
$days = 134774;
|
||||||
// calculate seconds
|
// calculate seconds
|
||||||
$big_date = $days*24*3600 + gmmktime(date("H", $date),date("i", $date),date("s", $date),
|
$big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
|
||||||
date("m", $date),date("d", $date),date("Y", $date));
|
|
||||||
// multiply just to make MS happy
|
// multiply just to make MS happy
|
||||||
$big_date *= 10000000;
|
$big_date *= 10000000;
|
||||||
|
|
||||||
|
@ -513,7 +508,7 @@ class PHPExcel_Shared_OLE
|
||||||
}
|
}
|
||||||
|
|
||||||
// factor used for separating numbers into 4 bytes parts
|
// factor used for separating numbers into 4 bytes parts
|
||||||
$factor = pow(2,32);
|
$factor = pow(2, 32);
|
||||||
list(, $high_part) = unpack('V', substr($string, 4, 4));
|
list(, $high_part) = unpack('V', substr($string, 4, 4));
|
||||||
list(, $low_part) = unpack('V', substr($string, 0, 4));
|
list(, $low_part) = unpack('V', substr($string, 0, 4));
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -57,9 +57,10 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
/**
|
/**
|
||||||
* Register wrapper
|
* Register wrapper
|
||||||
*/
|
*/
|
||||||
public static function register() {
|
public static function register()
|
||||||
@stream_wrapper_unregister("zip");
|
{
|
||||||
@stream_wrapper_register("zip", __CLASS__);
|
@stream_wrapper_unregister('zip');
|
||||||
|
@stream_wrapper_register('zip', __CLASS__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +72,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
* @param string &$openedPath absolute path of the opened stream (out parameter)
|
* @param string &$openedPath absolute path of the opened stream (out parameter)
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
public function stream_open($path, $mode, $options, &$opened_path)
|
||||||
|
{
|
||||||
// Check for mode
|
// Check for mode
|
||||||
if ($mode{0} != 'r') {
|
if ($mode{0} != 'r') {
|
||||||
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
|
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
|
||||||
|
@ -87,7 +89,7 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
|
|
||||||
$this->_fileNameInArchive = $url['fragment'];
|
$this->_fileNameInArchive = $url['fragment'];
|
||||||
$this->_position = 0;
|
$this->_position = 0;
|
||||||
$this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
|
$this->_data = $this->_archive->getFromName($this->_fileNameInArchive);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +99,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function statName() {
|
public function statName()
|
||||||
|
{
|
||||||
return $this->_fileNameInArchive;
|
return $this->_fileNameInArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +109,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function url_stat() {
|
public function url_stat()
|
||||||
return $this->statName( $this->_fileNameInArchive );
|
{
|
||||||
|
return $this->statName($this->_fileNameInArchive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,8 +119,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function stream_stat() {
|
public function stream_stat()
|
||||||
return $this->_archive->statName( $this->_fileNameInArchive );
|
{
|
||||||
|
return $this->_archive->statName($this->_fileNameInArchive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,7 +130,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
* @param int $count maximum number of bytes to read
|
* @param int $count maximum number of bytes to read
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function stream_read($count) {
|
function stream_read($count)
|
||||||
|
{
|
||||||
$ret = substr($this->_data, $this->_position, $count);
|
$ret = substr($this->_data, $this->_position, $count);
|
||||||
$this->_position += strlen($ret);
|
$this->_position += strlen($ret);
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -137,7 +143,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function stream_tell() {
|
public function stream_tell()
|
||||||
|
{
|
||||||
return $this->_position;
|
return $this->_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +153,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function stream_eof() {
|
public function stream_eof()
|
||||||
|
{
|
||||||
return $this->_position >= strlen($this->_data);
|
return $this->_position >= strlen($this->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +165,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
|
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function stream_seek($offset, $whence) {
|
public function stream_seek($offset, $whence)
|
||||||
|
{
|
||||||
switch ($whence) {
|
switch ($whence) {
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
if ($offset < strlen($this->_data) && $offset >= 0) {
|
if ($offset < strlen($this->_data) && $offset >= 0) {
|
||||||
|
@ -167,7 +176,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
if ($offset >= 0) {
|
if ($offset >= 0) {
|
||||||
$this->_position += $offset;
|
$this->_position += $offset;
|
||||||
|
@ -176,7 +184,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
if (strlen($this->_data) + $offset >= 0) {
|
if (strlen($this->_data) + $offset >= 0) {
|
||||||
$this->_position = strlen($this->_data) + $offset;
|
$this->_position = strlen($this->_data) + $offset;
|
||||||
|
@ -185,7 +192,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||||
{
|
{
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->isSupervisor) {
|
if ($this->isSupervisor) {
|
||||||
|
|
||||||
$pRange = $this->getSelectedCells();
|
$pRange = $this->getSelectedCells();
|
||||||
|
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
|
@ -322,7 +321,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||||
unset($regionStyles['borders']['inside']);
|
unset($regionStyles['borders']['inside']);
|
||||||
|
|
||||||
// what are the inner edges of the region when looking at the selection
|
// what are the inner edges of the region when looking at the selection
|
||||||
$innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges );
|
$innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges);
|
||||||
|
|
||||||
// inner edges that are not touching the region should take the 'inside' border properties if they have been set
|
// inner edges that are not touching the region should take the 'inside' border properties if they have been set
|
||||||
foreach ($innerEdges as $innerEdge) {
|
foreach ($innerEdges as $innerEdge) {
|
||||||
|
|
|
@ -240,21 +240,21 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||||
$objWriter->writeAttribute('name', $customProperty);
|
$objWriter->writeAttribute('name', $customProperty);
|
||||||
|
|
||||||
switch ($propertyType) {
|
switch ($propertyType) {
|
||||||
case 'i' :
|
case 'i':
|
||||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||||
break;
|
break;
|
||||||
case 'f' :
|
case 'f':
|
||||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||||
break;
|
break;
|
||||||
case 'b' :
|
case 'b':
|
||||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||||
break;
|
break;
|
||||||
case 'd' :
|
case 'd':
|
||||||
$objWriter->startElement('vt:filetime');
|
$objWriter->startElement('vt:filetime');
|
||||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
*/
|
*/
|
||||||
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
|
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
|
||||||
{
|
{
|
||||||
// Create XML writer
|
// Create XML writer
|
||||||
$objWriter = null;
|
$objWriter = null;
|
||||||
|
@ -82,7 +82,6 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
|
|
|
@ -259,10 +259,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||||
// Underline
|
// Underline
|
||||||
$underlineType = $element->getFont()->getUnderline();
|
$underlineType = $element->getFont()->getUnderline();
|
||||||
switch ($underlineType) {
|
switch ($underlineType) {
|
||||||
case 'single' :
|
case 'single':
|
||||||
$underlineType = 'sng';
|
$underlineType = 'sng';
|
||||||
break;
|
break;
|
||||||
case 'double' :
|
case 'double':
|
||||||
$underlineType = 'dbl';
|
$underlineType = 'dbl';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,8 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||||
* @param array $stringTable Stringtable
|
* @param array $stringTable Stringtable
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function flipStringTable($stringTable = array()) {
|
public function flipStringTable($stringTable = array())
|
||||||
|
{
|
||||||
// Return value
|
// Return value
|
||||||
$returnValue = array();
|
$returnValue = array();
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||||
// pane
|
// pane
|
||||||
$pane = 'topRight';
|
$pane = 'topRight';
|
||||||
$objWriter->startElement('pane');
|
$objWriter->startElement('pane');
|
||||||
if ($xSplit > 1)
|
if ($xSplit > 1) {
|
||||||
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
||||||
|
}
|
||||||
if ($ySplit > 1) {
|
if ($ySplit > 1) {
|
||||||
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
||||||
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
|
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
|
||||||
|
@ -491,9 +492,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
||||||
$objWriter->writeAttribute('priority', $id++);
|
$objWriter->writeAttribute('priority', $id++);
|
||||||
|
|
||||||
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
|
||||||
||
|
|
||||||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
|
|
||||||
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
||||||
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
||||||
}
|
}
|
||||||
|
@ -766,13 +765,13 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||||
}
|
}
|
||||||
$range = implode(':', $range);
|
$range = implode(':', $range);
|
||||||
|
|
||||||
$objWriter->writeAttribute('ref', str_replace('$','', $range));
|
$objWriter->writeAttribute('ref', str_replace('$', '', $range));
|
||||||
|
|
||||||
$columns = $pSheet->getAutoFilter()->getColumns();
|
$columns = $pSheet->getAutoFilter()->getColumns();
|
||||||
if (count($columns > 0)) {
|
if (count($columns > 0)) {
|
||||||
foreach ($columns as $columnID => $column) {
|
foreach ($columns as $columnID => $column) {
|
||||||
$rules = $column->getRules();
|
$rules = $column->getRules();
|
||||||
if (count($rules > 0)) {
|
if (count($rules) > 0) {
|
||||||
$objWriter->startElement('filterColumn');
|
$objWriter->startElement('filterColumn');
|
||||||
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
||||||
|
|
||||||
|
@ -830,7 +829,6 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1135,8 +1135,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||||
return $token;
|
return $token;
|
||||||
}
|
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
|
||||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||||
return $token;
|
return $token;
|
||||||
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
|
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
|
||||||
|
@ -1253,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
// If it's an error code
|
// If it's an error code
|
||||||
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A'){
|
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A') {
|
||||||
$result = $this->_createTree($this->_current_token, 'ptgErr', '');
|
$result = $this->_createTree($this->_current_token, 'ptgErr', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -1361,45 +1360,39 @@ class PHPExcel_Writer_Excel5_Parser
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
||||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
||||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
|
||||||
// if it's a range A1:B2 or $A$1:$B$2
|
|
||||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
|
|
||||||
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
|
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
|
||||||
|
// if it's a range A1:B2 or $A$1:$B$2
|
||||||
// must be an error?
|
// must be an error?
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
||||||
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
|
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
|
||||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
|
||||||
// must be an error?
|
// must be an error?
|
||||||
//$result = $this->_current_token;
|
//$result = $this->_current_token;
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
||||||
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
|
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
|
||||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
|
||||||
// must be an error?
|
// must be an error?
|
||||||
//$result = $this->_current_token;
|
//$result = $this->_current_token;
|
||||||
$result = $this->_createTree($this->_current_token, '', '');
|
$result = $this->_createTree($this->_current_token, '', '');
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (is_numeric($this->_current_token)) {
|
||||||
// If it's a number or a percent
|
// If it's a number or a percent
|
||||||
elseif (is_numeric($this->_current_token)) {
|
|
||||||
if ($this->_lookahead == '%') {
|
if ($this->_lookahead == '%') {
|
||||||
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
|
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
|
||||||
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
|
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
|
||||||
|
@ -1408,15 +1401,12 @@ class PHPExcel_Writer_Excel5_Parser
|
||||||
}
|
}
|
||||||
$this->_advance();
|
$this->_advance();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
|
||||||
// if it's a function call
|
// if it's a function call
|
||||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
|
|
||||||
$result = $this->_func();
|
$result = $this->_func();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.
|
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.", lookahead: ".$this->_lookahead.", current char: ".$this->_current_char);
|
||||||
", lookahead: ".$this->_lookahead.
|
|
||||||
", current char: ".$this->_current_char);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue