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