Minor case-sensitivity bugfix to getCell when cell reference is a worksheet!cell
Work on PSR2 Coding standards
This commit is contained in:
parent
e83c359c7c
commit
b3d2db79ea
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
|
@ -40,63 +32,63 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*
|
||||
* @var PHPExcel_Style_Font
|
||||
*/
|
||||
protected $_font;
|
||||
protected $font;
|
||||
|
||||
/**
|
||||
* Fill
|
||||
*
|
||||
* @var PHPExcel_Style_Fill
|
||||
*/
|
||||
protected $_fill;
|
||||
protected $fill;
|
||||
|
||||
/**
|
||||
* Borders
|
||||
*
|
||||
* @var PHPExcel_Style_Borders
|
||||
*/
|
||||
protected $_borders;
|
||||
protected $borders;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var PHPExcel_Style_Alignment
|
||||
*/
|
||||
protected $_alignment;
|
||||
protected $alignment;
|
||||
|
||||
/**
|
||||
* Number Format
|
||||
*
|
||||
* @var PHPExcel_Style_NumberFormat
|
||||
*/
|
||||
protected $_numberFormat;
|
||||
protected $numberFormat;
|
||||
|
||||
/**
|
||||
* Conditional styles
|
||||
*
|
||||
* @var PHPExcel_Style_Conditional[]
|
||||
*/
|
||||
protected $_conditionalStyles;
|
||||
protected $conditionalStyles;
|
||||
|
||||
/**
|
||||
* Protection
|
||||
*
|
||||
* @var PHPExcel_Style_Protection
|
||||
*/
|
||||
protected $_protection;
|
||||
protected $protection;
|
||||
|
||||
/**
|
||||
* Index of style in collection. Only used for real style.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_index;
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* Use Quote Prefix when displaying in cell editor. Only used for real style.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_quotePrefix = false;
|
||||
protected $quotePrefix = false;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style
|
||||
|
@ -111,25 +103,25 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
$this->isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_conditionalStyles = array();
|
||||
$this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
|
||||
$this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
|
||||
$this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
|
||||
$this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
|
||||
$this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
|
||||
$this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
|
||||
$this->conditionalStyles = array();
|
||||
$this->font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
|
||||
$this->fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
|
||||
$this->borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
|
||||
$this->alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
|
||||
$this->numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
|
||||
$this->protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_font->bindParent($this);
|
||||
$this->_fill->bindParent($this);
|
||||
$this->_borders->bindParent($this);
|
||||
$this->_alignment->bindParent($this);
|
||||
$this->_numberFormat->bindParent($this);
|
||||
$this->_protection->bindParent($this);
|
||||
$this->font->bindParent($this);
|
||||
$this->fill->bindParent($this);
|
||||
$this->borders->bindParent($this);
|
||||
$this->alignment->bindParent($this);
|
||||
$this->numberFormat->bindParent($this);
|
||||
$this->protection->bindParent($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +142,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
$xfIndex = 0;
|
||||
}
|
||||
|
||||
return $this->_parent->getCellXfByIndex($xfIndex);
|
||||
return $this->parent->getCellXfByIndex($xfIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +152,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->_parent;
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -217,7 +209,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
public function applyFromArray($pStyles = null, $pAdvanced = true)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
|
||||
$pRange = $this->getSelectedCells();
|
||||
|
||||
|
@ -248,9 +240,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
|
||||
// ADVANCED MODE:
|
||||
|
||||
if ($pAdvanced && isset($pStyles['borders'])) {
|
||||
|
||||
// 'allborders' is a shorthand property for 'outline' and 'inside' and
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['allborders'])) {
|
||||
|
@ -261,7 +251,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
unset($pStyles['borders']['allborders']); // not needed any more
|
||||
}
|
||||
|
||||
// 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left'
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['outline'])) {
|
||||
|
@ -272,7 +261,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
unset($pStyles['borders']['outline']); // not needed any more
|
||||
}
|
||||
|
||||
// 'inside' is a shorthand property for 'vertical' and 'horizontal'
|
||||
// it applies to components that have not been set explicitly
|
||||
if (isset($pStyles['borders']['inside'])) {
|
||||
|
@ -283,7 +271,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
unset($pStyles['borders']['inside']); // not needed any more
|
||||
}
|
||||
|
||||
// width and height characteristics of selection, 1, 2, or 3 (for 3 or more)
|
||||
$xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3);
|
||||
$yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3);
|
||||
|
@ -294,34 +281,28 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
$colStart = ($x == 3) ?
|
||||
PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0])
|
||||
: PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1);
|
||||
|
||||
// end column index for region
|
||||
$colEnd = ($x == 1) ?
|
||||
PHPExcel_Cell::stringFromColumnIndex($rangeStart[0])
|
||||
: PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x);
|
||||
|
||||
for ($y = 1; $y <= $yMax; ++$y) {
|
||||
|
||||
// which edges are touching the region
|
||||
$edges = array();
|
||||
|
||||
// are we at left edge
|
||||
if ($x == 1) {
|
||||
// are we at left edge
|
||||
$edges[] = 'left';
|
||||
}
|
||||
|
||||
// are we at right edge
|
||||
if ($x == $xMax) {
|
||||
// are we at right edge
|
||||
$edges[] = 'right';
|
||||
}
|
||||
|
||||
// are we at top edge?
|
||||
if ($y == 1) {
|
||||
// are we at top edge?
|
||||
$edges[] = 'top';
|
||||
}
|
||||
|
||||
// are we at bottom edge?
|
||||
if ($y == $yMax) {
|
||||
// are we at bottom edge?
|
||||
$edges[] = 'bottom';
|
||||
}
|
||||
|
||||
|
@ -375,7 +356,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
|
||||
// SIMPLE MODE:
|
||||
|
||||
// Selection type, inspect
|
||||
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
|
||||
$selectionType = 'COLUMN';
|
||||
|
@ -393,7 +373,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
$oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ROW':
|
||||
$oldXfIndexes = array();
|
||||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||
|
@ -404,7 +383,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CELL':
|
||||
$oldXfIndexes = array();
|
||||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||
|
@ -483,7 +461,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
$this->getProtection()->applyFromArray($pStyles['protection']);
|
||||
}
|
||||
if (array_key_exists('quotePrefix', $pStyles)) {
|
||||
$this->_quotePrefix = $pStyles['quotePrefix'];
|
||||
$this->quotePrefix = $pStyles['quotePrefix'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -499,7 +477,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getFill()
|
||||
{
|
||||
return $this->_fill;
|
||||
return $this->fill;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -509,7 +487,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getFont()
|
||||
{
|
||||
return $this->_font;
|
||||
return $this->font;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,7 +498,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function setFont(PHPExcel_Style_Font $font)
|
||||
{
|
||||
$this->_font = $font;
|
||||
$this->font = $font;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -531,7 +509,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getBorders()
|
||||
{
|
||||
return $this->_borders;
|
||||
return $this->borders;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -541,7 +519,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getAlignment()
|
||||
{
|
||||
return $this->_alignment;
|
||||
return $this->alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -551,7 +529,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getNumberFormat()
|
||||
{
|
||||
return $this->_numberFormat;
|
||||
return $this->numberFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -585,7 +563,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getProtection()
|
||||
{
|
||||
return $this->_protection;
|
||||
return $this->protection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -595,10 +573,10 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getQuotePrefix()
|
||||
{
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getQuotePrefix();
|
||||
}
|
||||
return $this->_quotePrefix;
|
||||
return $this->quotePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -611,11 +589,11 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = array('quotePrefix' => $pValue);
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_quotePrefix = (boolean) $pValue;
|
||||
$this->quotePrefix = (boolean) $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -628,20 +606,20 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
public function getHashCode()
|
||||
{
|
||||
$hashConditionals = '';
|
||||
foreach ($this->_conditionalStyles as $conditional) {
|
||||
foreach ($this->conditionalStyles as $conditional) {
|
||||
$hashConditionals .= $conditional->getHashCode();
|
||||
}
|
||||
|
||||
return md5(
|
||||
$this->_fill->getHashCode()
|
||||
. $this->_font->getHashCode()
|
||||
. $this->_borders->getHashCode()
|
||||
. $this->_alignment->getHashCode()
|
||||
. $this->_numberFormat->getHashCode()
|
||||
. $hashConditionals
|
||||
. $this->_protection->getHashCode()
|
||||
. ($this->_quotePrefix ? 't' : 'f')
|
||||
. __CLASS__
|
||||
$this->fill->getHashCode() .
|
||||
$this->font->getHashCode() .
|
||||
$this->borders->getHashCode() .
|
||||
$this->alignment->getHashCode() .
|
||||
$this->numberFormat->getHashCode() .
|
||||
$hashConditionals .
|
||||
$this->protection->getHashCode() .
|
||||
($this->quotePrefix ? 't' : 'f') .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -652,7 +630,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->_index;
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -662,7 +640,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
|||
*/
|
||||
public function setIndex($pValue)
|
||||
{
|
||||
$this->_index = $pValue;
|
||||
$this->index = $pValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Alignment
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +24,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Alignment
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Horizontal alignment styles */
|
||||
|
@ -62,49 +53,49 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
protected $horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
|
||||
/**
|
||||
* Vertical alignment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
|
||||
protected $vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
|
||||
|
||||
/**
|
||||
* Text rotation
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_textRotation = 0;
|
||||
protected $textRotation = 0;
|
||||
|
||||
/**
|
||||
* Wrap text
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_wrapText = FALSE;
|
||||
protected $wrapText = false;
|
||||
|
||||
/**
|
||||
* Shrink to fit
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_shrinkToFit = FALSE;
|
||||
protected $shrinkToFit = false;
|
||||
|
||||
/**
|
||||
* Indent - only possible with horizontal alignment left and right
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_indent = 0;
|
||||
protected $indent = 0;
|
||||
|
||||
/**
|
||||
* Read order
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_readorder = 0;
|
||||
protected $readorder = 0;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Alignment
|
||||
|
@ -116,15 +107,15 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
if ($isConditional) {
|
||||
$this->_horizontal = NULL;
|
||||
$this->_vertical = NULL;
|
||||
$this->_textRotation = NULL;
|
||||
$this->horizontal = null;
|
||||
$this->vertical = null;
|
||||
$this->textRotation = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +127,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getAlignment();
|
||||
return $this->parent->getSharedComponent()->getAlignment();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,9 +159,10 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function applyFromArray($pStyles = NULL) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())
|
||||
->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
|
@ -207,11 +199,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontal() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHorizontal()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHorizontal();
|
||||
}
|
||||
return $this->_horizontal;
|
||||
return $this->horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,17 +213,17 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
||||
public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
}
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('horizontal' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
}
|
||||
else {
|
||||
$this->_horizontal = $pValue;
|
||||
} else {
|
||||
$this->horizontal = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -240,11 +233,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVertical() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getVertical()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getVertical();
|
||||
}
|
||||
return $this->_vertical;
|
||||
return $this->vertical;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,16 +247,17 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) {
|
||||
public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
|
||||
}
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('vertical' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_vertical = $pValue;
|
||||
$this->vertical = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -272,11 +267,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTextRotation() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getTextRotation()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getTextRotation();
|
||||
}
|
||||
return $this->_textRotation;
|
||||
return $this->textRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,7 +282,8 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setTextRotation($pValue = 0) {
|
||||
public function setTextRotation($pValue = 0)
|
||||
{
|
||||
// Excel2007 value 255 => PHPExcel value -165
|
||||
if ($pValue == 255) {
|
||||
$pValue = -165;
|
||||
|
@ -294,11 +291,11 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
|
||||
// Set rotation
|
||||
if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_textRotation = $pValue;
|
||||
$this->textRotation = $pValue;
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90.");
|
||||
|
@ -312,11 +309,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getWrapText() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getWrapText()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getWrapText();
|
||||
}
|
||||
return $this->_wrapText;
|
||||
return $this->wrapText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,15 +323,16 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setWrapText($pValue = FALSE) {
|
||||
public function setWrapText($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = FALSE;
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('wrap' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_wrapText = $pValue;
|
||||
$this->wrapText = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -343,11 +342,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShrinkToFit() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getShrinkToFit()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getShrinkToFit();
|
||||
}
|
||||
return $this->_shrinkToFit;
|
||||
return $this->shrinkToFit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -356,15 +356,16 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setShrinkToFit($pValue = FALSE) {
|
||||
public function setShrinkToFit($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = FALSE;
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_shrinkToFit = $pValue;
|
||||
$this->shrinkToFit = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -374,11 +375,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIndent() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getIndent()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getIndent();
|
||||
}
|
||||
return $this->_indent;
|
||||
return $this->indent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -387,7 +389,8 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param int $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setIndent($pValue = 0) {
|
||||
public function setIndent($pValue = 0)
|
||||
{
|
||||
if ($pValue > 0) {
|
||||
if ($this->getHorizontal() != self::HORIZONTAL_GENERAL &&
|
||||
$this->getHorizontal() != self::HORIZONTAL_LEFT &&
|
||||
|
@ -395,11 +398,11 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
$pValue = 0; // indent not supported
|
||||
}
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('indent' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_indent = $pValue;
|
||||
$this->indent = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -409,11 +412,12 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getReadorder() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getReadorder()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getReadorder();
|
||||
}
|
||||
return $this->_readorder;
|
||||
return $this->readorder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -422,15 +426,16 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
* @param int $pValue
|
||||
* @return PHPExcel_Style_Alignment
|
||||
*/
|
||||
public function setReadorder($pValue = 0) {
|
||||
public function setReadorder($pValue = 0)
|
||||
{
|
||||
if ($pValue < 0 || $pValue > 2) {
|
||||
$pValue = 0;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('readorder' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_readorder = $pValue;
|
||||
$this->readorder = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -440,20 +445,20 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_horizontal
|
||||
. $this->_vertical
|
||||
. $this->_textRotation
|
||||
. ($this->_wrapText ? 't' : 'f')
|
||||
. ($this->_shrinkToFit ? 't' : 'f')
|
||||
. $this->_indent
|
||||
. $this->_readorder
|
||||
. __CLASS__
|
||||
$this->horizontal .
|
||||
$this->vertical .
|
||||
$this->textRotation .
|
||||
($this->wrapText ? 't' : 'f') .
|
||||
($this->shrinkToFit ? 't' : 'f') .
|
||||
$this->indent .
|
||||
$this->readorder .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Border
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Border
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Border style */
|
||||
|
@ -56,21 +48,21 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
|
||||
protected $borderStyle = PHPExcel_Style_Border::BORDER_NONE;
|
||||
|
||||
/**
|
||||
* Border color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
protected $_color;
|
||||
protected $color;
|
||||
|
||||
/**
|
||||
* Parent property name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_parentPropertyName;
|
||||
protected $parentPropertyName;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Border
|
||||
|
@ -82,17 +74,17 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
$this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_color->bindParent($this, '_color');
|
||||
$this->color->bindParent($this, 'color');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,10 +95,10 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
* @param string $parentPropertyName
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function bindParent($parent, $parentPropertyName=NULL)
|
||||
public function bindParent($parent, $parentPropertyName = null)
|
||||
{
|
||||
$this->_parent = $parent;
|
||||
$this->_parentPropertyName = $parentPropertyName;
|
||||
$this->parent = $parent;
|
||||
$this->parentPropertyName = $parentPropertyName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -119,25 +111,24 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_allBorders':
|
||||
case '_horizontal':
|
||||
case '_inside':
|
||||
case '_outline':
|
||||
case '_vertical':
|
||||
switch ($this->parentPropertyName) {
|
||||
case 'allBorders':
|
||||
case 'horizontal':
|
||||
case 'inside':
|
||||
case 'outline':
|
||||
case 'vertical':
|
||||
throw new PHPExcel_Exception('Cannot get shared component for a pseudo-border.');
|
||||
break;
|
||||
case '_bottom':
|
||||
return $this->_parent->getSharedComponent()->getBottom(); break;
|
||||
case '_diagonal':
|
||||
return $this->_parent->getSharedComponent()->getDiagonal(); break;
|
||||
case '_left':
|
||||
return $this->_parent->getSharedComponent()->getLeft(); break;
|
||||
case '_right':
|
||||
return $this->_parent->getSharedComponent()->getRight(); break;
|
||||
case '_top':
|
||||
return $this->_parent->getSharedComponent()->getTop(); break;
|
||||
|
||||
case 'bottom':
|
||||
return $this->parent->getSharedComponent()->getBottom();
|
||||
case 'diagonal':
|
||||
return $this->parent->getSharedComponent()->getDiagonal();
|
||||
case 'left':
|
||||
return $this->parent->getSharedComponent()->getLeft();
|
||||
case 'right':
|
||||
return $this->parent->getSharedComponent()->getRight();
|
||||
case 'top':
|
||||
return $this->parent->getSharedComponent()->getTop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,29 +140,21 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*/
|
||||
public function getStyleArray($array)
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_allBorders':
|
||||
$key = 'allborders'; break;
|
||||
case '_bottom':
|
||||
$key = 'bottom'; break;
|
||||
case '_diagonal':
|
||||
$key = 'diagonal'; break;
|
||||
case '_horizontal':
|
||||
$key = 'horizontal'; break;
|
||||
case '_inside':
|
||||
$key = 'inside'; break;
|
||||
case '_left':
|
||||
$key = 'left'; break;
|
||||
case '_outline':
|
||||
$key = 'outline'; break;
|
||||
case '_right':
|
||||
$key = 'right'; break;
|
||||
case '_top':
|
||||
$key = 'top'; break;
|
||||
case '_vertical':
|
||||
$key = 'vertical'; break;
|
||||
switch ($this->parentPropertyName) {
|
||||
case 'allBorders':
|
||||
case 'bottom':
|
||||
case 'diagonal':
|
||||
case 'horizontal':
|
||||
case 'inside':
|
||||
case 'left':
|
||||
case 'outline':
|
||||
case 'right':
|
||||
case 'top':
|
||||
case 'vertical':
|
||||
$key = strtolower('vertical');
|
||||
break;
|
||||
}
|
||||
return $this->_parent->getStyleArray(array($key => $array));
|
||||
return $this->parent->getStyleArray(array($key => $array));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,9 +175,10 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function applyFromArray($pStyles = null) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (isset($pStyles['style'])) {
|
||||
|
@ -215,11 +199,12 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderStyle() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getBorderStyle()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getBorderStyle();
|
||||
}
|
||||
return $this->_borderStyle;
|
||||
return $this->borderStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,18 +215,19 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
* and TRUE to PHPExcel_Style_Border::BORDER_MEDIUM
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) {
|
||||
public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE)
|
||||
{
|
||||
|
||||
if (empty($pValue)) {
|
||||
$pValue = PHPExcel_Style_Border::BORDER_NONE;
|
||||
} elseif (is_bool($pValue) && $pValue) {
|
||||
$pValue = PHPExcel_Style_Border::BORDER_MEDIUM;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('style' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_borderStyle = $pValue;
|
||||
$this->borderStyle = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -251,8 +237,9 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getColor() {
|
||||
return $this->_color;
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,15 +249,16 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null) {
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null)
|
||||
{
|
||||
// make sure parameter is a real color and not a supervisor
|
||||
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_color = $color;
|
||||
$this->color = $color;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -280,15 +268,15 @@ class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExce
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_borderStyle
|
||||
. $this->_color->getHashCode()
|
||||
. __CLASS__
|
||||
$this->borderStyle .
|
||||
$this->color->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Borders
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Borders
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Diagonal directions */
|
||||
|
@ -46,77 +38,77 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_left;
|
||||
protected $left;
|
||||
|
||||
/**
|
||||
* Right
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_right;
|
||||
protected $right;
|
||||
|
||||
/**
|
||||
* Top
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_top;
|
||||
protected $top;
|
||||
|
||||
/**
|
||||
* Bottom
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_bottom;
|
||||
protected $bottom;
|
||||
|
||||
/**
|
||||
* Diagonal
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_diagonal;
|
||||
protected $diagonal;
|
||||
|
||||
/**
|
||||
* DiagonalDirection
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_diagonalDirection;
|
||||
protected $diagonalDirection;
|
||||
|
||||
/**
|
||||
* All borders psedo-border. Only applies to supervisor.
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_allBorders;
|
||||
protected $allBorders;
|
||||
|
||||
/**
|
||||
* Outline psedo-border. Only applies to supervisor.
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_outline;
|
||||
protected $outline;
|
||||
|
||||
/**
|
||||
* Inside psedo-border. Only applies to supervisor.
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_inside;
|
||||
protected $inside;
|
||||
|
||||
/**
|
||||
* Vertical pseudo-border. Only applies to supervisor.
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_vertical;
|
||||
protected $vertical;
|
||||
|
||||
/**
|
||||
* Horizontal pseudo-border. Only applies to supervisor.
|
||||
*
|
||||
* @var PHPExcel_Style_Border
|
||||
*/
|
||||
protected $_horizontal;
|
||||
protected $horizontal;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Borders
|
||||
|
@ -128,39 +120,39 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
$this->_left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
|
||||
$this->left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
|
||||
|
||||
// Specially for supervisor
|
||||
if ($isSupervisor) {
|
||||
// Initialize pseudo-borders
|
||||
$this->_allBorders = new PHPExcel_Style_Border(TRUE);
|
||||
$this->_outline = new PHPExcel_Style_Border(TRUE);
|
||||
$this->_inside = new PHPExcel_Style_Border(TRUE);
|
||||
$this->_vertical = new PHPExcel_Style_Border(TRUE);
|
||||
$this->_horizontal = new PHPExcel_Style_Border(TRUE);
|
||||
$this->allBorders = new PHPExcel_Style_Border(true);
|
||||
$this->outline = new PHPExcel_Style_Border(true);
|
||||
$this->inside = new PHPExcel_Style_Border(true);
|
||||
$this->vertical = new PHPExcel_Style_Border(true);
|
||||
$this->horizontal = new PHPExcel_Style_Border(true);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
$this->_left->bindParent($this, '_left');
|
||||
$this->_right->bindParent($this, '_right');
|
||||
$this->_top->bindParent($this, '_top');
|
||||
$this->_bottom->bindParent($this, '_bottom');
|
||||
$this->_diagonal->bindParent($this, '_diagonal');
|
||||
$this->_allBorders->bindParent($this, '_allBorders');
|
||||
$this->_outline->bindParent($this, '_outline');
|
||||
$this->_inside->bindParent($this, '_inside');
|
||||
$this->_vertical->bindParent($this, '_vertical');
|
||||
$this->_horizontal->bindParent($this, '_horizontal');
|
||||
$this->left->bindParent($this, 'left');
|
||||
$this->right->bindParent($this, 'right');
|
||||
$this->top->bindParent($this, 'top');
|
||||
$this->bottom->bindParent($this, 'bottom');
|
||||
$this->diagonal->bindParent($this, 'diagonal');
|
||||
$this->allBorders->bindParent($this, 'allBorders');
|
||||
$this->outline->bindParent($this, 'outline');
|
||||
$this->inside->bindParent($this, 'inside');
|
||||
$this->vertical->bindParent($this, 'vertical');
|
||||
$this->horizontal->bindParent($this, 'horizontal');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +164,7 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getBorders();
|
||||
return $this->parent->getSharedComponent()->getBorders();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,9 +216,10 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Borders
|
||||
*/
|
||||
public function applyFromArray($pStyles = null) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (array_key_exists('left', $pStyles)) {
|
||||
|
@ -265,8 +258,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function getLeft() {
|
||||
return $this->_left;
|
||||
public function getLeft()
|
||||
{
|
||||
return $this->left;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,8 +268,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function getRight() {
|
||||
return $this->_right;
|
||||
public function getRight()
|
||||
{
|
||||
return $this->right;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,8 +278,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function getTop() {
|
||||
return $this->_top;
|
||||
public function getTop()
|
||||
{
|
||||
return $this->top;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -292,8 +288,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function getBottom() {
|
||||
return $this->_bottom;
|
||||
public function getBottom()
|
||||
{
|
||||
return $this->bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,8 +298,9 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return PHPExcel_Style_Border
|
||||
*/
|
||||
public function getDiagonal() {
|
||||
return $this->_diagonal;
|
||||
public function getDiagonal()
|
||||
{
|
||||
return $this->diagonal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,11 +309,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @return PHPExcel_Style_Border
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getAllBorders() {
|
||||
if (!$this->_isSupervisor) {
|
||||
public function getAllBorders()
|
||||
{
|
||||
if (!$this->isSupervisor) {
|
||||
throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
|
||||
}
|
||||
return $this->_allBorders;
|
||||
return $this->allBorders;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,11 +323,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @return boolean
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getOutline() {
|
||||
if (!$this->_isSupervisor) {
|
||||
public function getOutline()
|
||||
{
|
||||
if (!$this->isSupervisor) {
|
||||
throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
|
||||
}
|
||||
return $this->_outline;
|
||||
return $this->outline;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,11 +337,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @return boolean
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getInside() {
|
||||
if (!$this->_isSupervisor) {
|
||||
public function getInside()
|
||||
{
|
||||
if (!$this->isSupervisor) {
|
||||
throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
|
||||
}
|
||||
return $this->_inside;
|
||||
return $this->inside;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,11 +351,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @return PHPExcel_Style_Border
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getVertical() {
|
||||
if (!$this->_isSupervisor) {
|
||||
public function getVertical()
|
||||
{
|
||||
if (!$this->isSupervisor) {
|
||||
throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
|
||||
}
|
||||
return $this->_vertical;
|
||||
return $this->vertical;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -363,11 +365,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @return PHPExcel_Style_Border
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getHorizontal() {
|
||||
if (!$this->_isSupervisor) {
|
||||
public function getHorizontal()
|
||||
{
|
||||
if (!$this->isSupervisor) {
|
||||
throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
|
||||
}
|
||||
return $this->_horizontal;
|
||||
return $this->horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -375,11 +378,12 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDiagonalDirection() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getDiagonalDirection()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getDiagonalDirection();
|
||||
}
|
||||
return $this->_diagonalDirection;
|
||||
return $this->diagonalDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -388,15 +392,16 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
* @param int $pValue
|
||||
* @return PHPExcel_Style_Borders
|
||||
*/
|
||||
public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE) {
|
||||
public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = PHPExcel_Style_Borders::DIAGONAL_NONE;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_diagonalDirection = $pValue;
|
||||
$this->diagonalDirection = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -406,19 +411,19 @@ class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExc
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashcode();
|
||||
}
|
||||
return md5(
|
||||
$this->getLeft()->getHashCode()
|
||||
. $this->getRight()->getHashCode()
|
||||
. $this->getTop()->getHashCode()
|
||||
. $this->getBottom()->getHashCode()
|
||||
. $this->getDiagonal()->getHashCode()
|
||||
. $this->getDiagonalDirection()
|
||||
. __CLASS__
|
||||
$this->getLeft()->getHashCode() .
|
||||
$this->getRight()->getHashCode() .
|
||||
$this->getTop()->getHashCode() .
|
||||
$this->getBottom()->getHashCode() .
|
||||
$this->getDiagonal()->getHashCode() .
|
||||
$this->getDiagonalDirection() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Color
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Color
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Colors */
|
||||
|
@ -52,21 +44,21 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $_indexedColors;
|
||||
protected static $indexedColors;
|
||||
|
||||
/**
|
||||
* ARGB - Alpha RGB
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_argb = NULL;
|
||||
protected $argb = null;
|
||||
|
||||
/**
|
||||
* Parent property name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_parentPropertyName;
|
||||
protected $parentPropertyName;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,14 +72,14 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
if (!$isConditional) {
|
||||
$this->_argb = $pARGB;
|
||||
$this->argb = $pARGB;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,10 +90,10 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* @param string $parentPropertyName
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function bindParent($parent, $parentPropertyName=NULL)
|
||||
public function bindParent($parent, $parentPropertyName = null)
|
||||
{
|
||||
$this->_parent = $parent;
|
||||
$this->_parentPropertyName = $parentPropertyName;
|
||||
$this->parent = $parent;
|
||||
$this->parentPropertyName = $parentPropertyName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -113,13 +105,13 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_endColor':
|
||||
return $this->_parent->getSharedComponent()->getEndColor(); break;
|
||||
case '_color':
|
||||
return $this->_parent->getSharedComponent()->getColor(); break;
|
||||
case '_startColor':
|
||||
return $this->_parent->getSharedComponent()->getStartColor(); break;
|
||||
switch ($this->parentPropertyName) {
|
||||
case 'endColor':
|
||||
return $this->parent->getSharedComponent()->getEndColor();
|
||||
case 'color':
|
||||
return $this->parent->getSharedComponent()->getColor();
|
||||
case 'startColor':
|
||||
return $this->parent->getSharedComponent()->getStartColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,19 +123,19 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*/
|
||||
public function getStyleArray($array)
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_endColor':
|
||||
switch ($this->parentPropertyName) {
|
||||
case 'endColor':
|
||||
$key = 'endcolor';
|
||||
break;
|
||||
case '_color':
|
||||
case 'color':
|
||||
$key = 'color';
|
||||
break;
|
||||
case '_startColor':
|
||||
case 'startColor':
|
||||
$key = 'startcolor';
|
||||
break;
|
||||
|
||||
}
|
||||
return $this->_parent->getStyleArray(array($key => $array));
|
||||
return $this->parent->getStyleArray(array($key => $array));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,9 +149,10 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function applyFromArray($pStyles = NULL) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (array_key_exists('rgb', $pStyles)) {
|
||||
|
@ -180,11 +173,12 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getARGB() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getARGB()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getARGB();
|
||||
}
|
||||
return $this->_argb;
|
||||
return $this->argb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,15 +187,16 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK) {
|
||||
public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = PHPExcel_Style_Color::COLOR_BLACK;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('argb' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_argb = $pValue;
|
||||
$this->argb = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -211,11 +206,12 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRGB() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getRGB()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getRGB();
|
||||
}
|
||||
return substr($this->_argb, 2);
|
||||
return substr($this->argb, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,15 +220,16 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* @param string $pValue RGB value
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function setRGB($pValue = '000000') {
|
||||
public function setRGB($pValue = '000000')
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = '000000';
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_argb = 'FF' . $pValue;
|
||||
$this->argb = 'FF' . $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -247,10 +244,12 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* decimal value
|
||||
* @return string The extracted colour component
|
||||
*/
|
||||
private static function _getColourComponent($RGB,$offset,$hex=TRUE) {
|
||||
private static function getColourComponent($RGB, $offset, $hex = true)
|
||||
{
|
||||
$colour = substr($RGB, $offset, 2);
|
||||
if (!$hex)
|
||||
if (!$hex) {
|
||||
$colour = hexdec($colour);
|
||||
}
|
||||
return $colour;
|
||||
}
|
||||
|
||||
|
@ -262,8 +261,9 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* decimal value
|
||||
* @return string The red colour component
|
||||
*/
|
||||
public static function getRed($RGB,$hex=TRUE) {
|
||||
return self::_getColourComponent($RGB, strlen($RGB) - 6, $hex);
|
||||
public static function getRed($RGB, $hex = true)
|
||||
{
|
||||
return self::getColourComponent($RGB, strlen($RGB) - 6, $hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,8 +274,9 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* decimal value
|
||||
* @return string The green colour component
|
||||
*/
|
||||
public static function getGreen($RGB,$hex=TRUE) {
|
||||
return self::_getColourComponent($RGB, strlen($RGB) - 4, $hex);
|
||||
public static function getGreen($RGB, $hex = true)
|
||||
{
|
||||
return self::getColourComponent($RGB, strlen($RGB) - 4, $hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,8 +287,9 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* decimal value
|
||||
* @return string The blue colour component
|
||||
*/
|
||||
public static function getBlue($RGB,$hex=TRUE) {
|
||||
return self::_getColourComponent($RGB, strlen($RGB) - 2, $hex);
|
||||
public static function getBlue($RGB, $hex = true)
|
||||
{
|
||||
return self::getColourComponent($RGB, strlen($RGB) - 2, $hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,12 +299,13 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1
|
||||
* @return string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE)
|
||||
*/
|
||||
public static function changeBrightness($hex, $adjustPercentage) {
|
||||
public static function changeBrightness($hex, $adjustPercentage)
|
||||
{
|
||||
$rgba = (strlen($hex) == 8);
|
||||
|
||||
$red = self::getRed($hex, FALSE);
|
||||
$green = self::getGreen($hex, FALSE);
|
||||
$blue = self::getBlue($hex, FALSE);
|
||||
$red = self::getRed($hex, false);
|
||||
$green = self::getGreen($hex, false);
|
||||
$blue = self::getBlue($hex, false);
|
||||
if ($adjustPercentage > 0) {
|
||||
$red += (255 - $red) * $adjustPercentage;
|
||||
$green += (255 - $green) * $adjustPercentage;
|
||||
|
@ -313,14 +316,24 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
$blue += $blue * $adjustPercentage;
|
||||
}
|
||||
|
||||
if ($red < 0) $red = 0;
|
||||
elseif ($red > 255) $red = 255;
|
||||
if ($green < 0) $green = 0;
|
||||
elseif ($green > 255) $green = 255;
|
||||
if ($blue < 0) $blue = 0;
|
||||
elseif ($blue > 255) $blue = 255;
|
||||
if ($red < 0) {
|
||||
$red = 0;
|
||||
} elseif ($red > 255) {
|
||||
$red = 255;
|
||||
}
|
||||
if ($green < 0) {
|
||||
$green = 0;
|
||||
} elseif ($green > 255) {
|
||||
$green = 255;
|
||||
}
|
||||
if ($blue < 0) {
|
||||
$blue = 0;
|
||||
} elseif ($blue > 255) {
|
||||
$blue = 255;
|
||||
}
|
||||
|
||||
$rgb = strtoupper( str_pad(dechex($red), 2, '0', 0) .
|
||||
$rgb = strtoupper(
|
||||
str_pad(dechex($red), 2, '0', 0) .
|
||||
str_pad(dechex($green), 2, '0', 0) .
|
||||
str_pad(dechex($blue), 2, '0', 0)
|
||||
);
|
||||
|
@ -335,13 +348,14 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
* should be returned if the indexed colour doesn't exist
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public static function indexedColor($pIndex, $background=FALSE) {
|
||||
public static function indexedColor($pIndex, $background = false)
|
||||
{
|
||||
// Clean parameter
|
||||
$pIndex = intval($pIndex);
|
||||
|
||||
// Indexed colors
|
||||
if (is_null(self::$_indexedColors)) {
|
||||
self::$_indexedColors = array(
|
||||
if (is_null(self::$indexedColors)) {
|
||||
self::$indexedColors = array(
|
||||
1 => 'FF000000', // System Colour #1 - Black
|
||||
2 => 'FFFFFFFF', // System Colour #2 - White
|
||||
3 => 'FFFF0000', // System Colour #3 - Red
|
||||
|
@ -401,14 +415,14 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
);
|
||||
}
|
||||
|
||||
if (array_key_exists($pIndex, self::$_indexedColors)) {
|
||||
return new PHPExcel_Style_Color(self::$_indexedColors[$pIndex]);
|
||||
if (array_key_exists($pIndex, self::$indexedColors)) {
|
||||
return new PHPExcel_Style_Color(self::$indexedColors[$pIndex]);
|
||||
}
|
||||
|
||||
if ($background) {
|
||||
return new PHPExcel_Style_Color('FFFFFFFF');
|
||||
return new PHPExcel_Style_Color(self::COLOR_WHITE);
|
||||
}
|
||||
return new PHPExcel_Style_Color('FF000000');
|
||||
return new PHPExcel_Style_Color(self::COLOR_BLACK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,14 +430,14 @@ class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_argb
|
||||
. __CLASS__
|
||||
$this->argb .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,35 +60,35 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_conditionType;
|
||||
private $conditionType;
|
||||
|
||||
/**
|
||||
* Operator type
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_operatorType;
|
||||
private $operatorType;
|
||||
|
||||
/**
|
||||
* Text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_text;
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* Condition
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $_condition = array();
|
||||
private $condition = array();
|
||||
|
||||
/**
|
||||
* Style
|
||||
*
|
||||
* @var PHPExcel_Style
|
||||
*/
|
||||
private $_style;
|
||||
private $style;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Conditional
|
||||
|
@ -96,11 +96,11 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
|
||||
$this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
|
||||
$this->_text = null;
|
||||
$this->_condition = array();
|
||||
$this->_style = new PHPExcel_Style(FALSE, TRUE);
|
||||
$this->conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
|
||||
$this->operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
|
||||
$this->text = null;
|
||||
$this->condition = array();
|
||||
$this->style = new PHPExcel_Style(false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConditionType() {
|
||||
return $this->_conditionType;
|
||||
public function getConditionType()
|
||||
{
|
||||
return $this->conditionType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,8 +119,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string $pValue PHPExcel_Style_Conditional condition type
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE) {
|
||||
$this->_conditionType = $pValue;
|
||||
public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE)
|
||||
{
|
||||
$this->conditionType = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -128,8 +130,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperatorType() {
|
||||
return $this->_operatorType;
|
||||
public function getOperatorType()
|
||||
{
|
||||
return $this->operatorType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,8 +141,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string $pValue PHPExcel_Style_Conditional operator type
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
||||
$this->_operatorType = $pValue;
|
||||
public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE)
|
||||
{
|
||||
$this->operatorType = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -148,8 +152,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText() {
|
||||
return $this->_text;
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,8 +163,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string $value
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setText($value = null) {
|
||||
$this->_text = $value;
|
||||
public function setText($value = null)
|
||||
{
|
||||
$this->text = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -169,9 +175,10 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @deprecated Deprecated, use getConditions instead
|
||||
* @return string
|
||||
*/
|
||||
public function getCondition() {
|
||||
if (isset($this->_condition[0])) {
|
||||
return $this->_condition[0];
|
||||
public function getCondition()
|
||||
{
|
||||
if (isset($this->condition[0])) {
|
||||
return $this->condition[0];
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@ -184,9 +191,11 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string $pValue Condition
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setCondition($pValue = '') {
|
||||
if (!is_array($pValue))
|
||||
public function setCondition($pValue = '')
|
||||
{
|
||||
if (!is_array($pValue)) {
|
||||
$pValue = array($pValue);
|
||||
}
|
||||
|
||||
return $this->setConditions($pValue);
|
||||
}
|
||||
|
@ -196,8 +205,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getConditions() {
|
||||
return $this->_condition;
|
||||
public function getConditions()
|
||||
{
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,11 +216,12 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string[] $pValue Condition
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setConditions($pValue) {
|
||||
if (!is_array($pValue))
|
||||
public function setConditions($pValue)
|
||||
{
|
||||
if (!is_array($pValue)) {
|
||||
$pValue = array($pValue);
|
||||
|
||||
$this->_condition = $pValue;
|
||||
}
|
||||
$this->condition = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -220,8 +231,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @param string $pValue Condition
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function addCondition($pValue = '') {
|
||||
$this->_condition[] = $pValue;
|
||||
public function addCondition($pValue = '')
|
||||
{
|
||||
$this->condition[] = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -230,8 +242,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return PHPExcel_Style
|
||||
*/
|
||||
public function getStyle() {
|
||||
return $this->_style;
|
||||
public function getStyle()
|
||||
{
|
||||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,8 +254,9 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Conditional
|
||||
*/
|
||||
public function setStyle(PHPExcel_Style $pValue = null) {
|
||||
$this->_style = $pValue;
|
||||
public function setStyle(PHPExcel_Style $pValue = null)
|
||||
{
|
||||
$this->style = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -251,20 +265,22 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->_conditionType
|
||||
. $this->_operatorType
|
||||
. implode(';', $this->_condition)
|
||||
. $this->_style->getHashCode()
|
||||
. __CLASS__
|
||||
$this->conditionType .
|
||||
$this->operatorType .
|
||||
implode(';', $this->condition) .
|
||||
$this->style->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Fill
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Fill
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Fill types */
|
||||
|
@ -63,28 +55,28 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_fillType = PHPExcel_Style_Fill::FILL_NONE;
|
||||
protected $fillType = PHPExcel_Style_Fill::FILL_NONE;
|
||||
|
||||
/**
|
||||
* Rotation
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
protected $_rotation = 0;
|
||||
protected $rotation = 0;
|
||||
|
||||
/**
|
||||
* Start color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
protected $_startColor;
|
||||
protected $startColor;
|
||||
|
||||
/**
|
||||
* End color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
protected $_endColor;
|
||||
protected $endColor;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Fill
|
||||
|
@ -96,22 +88,22 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
if ($isConditional) {
|
||||
$this->_fillType = NULL;
|
||||
$this->fillType = null;
|
||||
}
|
||||
$this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional);
|
||||
$this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
$this->startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional);
|
||||
$this->endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_startColor->bindParent($this, '_startColor');
|
||||
$this->_endColor->bindParent($this, '_endColor');
|
||||
$this->startColor->bindParent($this, 'startColor');
|
||||
$this->endColor->bindParent($this, 'endColor');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +115,7 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getFill();
|
||||
return $this->parent->getSharedComponent()->getFill();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,9 +151,10 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Fill
|
||||
*/
|
||||
public function applyFromArray($pStyles = null) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (array_key_exists('type', $pStyles)) {
|
||||
|
@ -191,11 +184,12 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFillType() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getFillType()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getFillType();
|
||||
}
|
||||
return $this->_fillType;
|
||||
return $this->fillType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,12 +198,13 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param string $pValue PHPExcel_Style_Fill fill type
|
||||
* @return PHPExcel_Style_Fill
|
||||
*/
|
||||
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) {
|
||||
if ($this->_isSupervisor) {
|
||||
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE)
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('type' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_fillType = $pValue;
|
||||
$this->fillType = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -219,11 +214,12 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getRotation() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getRotation()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getRotation();
|
||||
}
|
||||
return $this->_rotation;
|
||||
return $this->rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,12 +228,13 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param double $pValue
|
||||
* @return PHPExcel_Style_Fill
|
||||
*/
|
||||
public function setRotation($pValue = 0) {
|
||||
if ($this->_isSupervisor) {
|
||||
public function setRotation($pValue = 0)
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_rotation = $pValue;
|
||||
$this->rotation = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -247,8 +244,9 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getStartColor() {
|
||||
return $this->_startColor;
|
||||
public function getStartColor()
|
||||
{
|
||||
return $this->startColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,15 +256,16 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Fill
|
||||
*/
|
||||
public function setStartColor(PHPExcel_Style_Color $pValue = null) {
|
||||
public function setStartColor(PHPExcel_Style_Color $pValue = null)
|
||||
{
|
||||
// make sure parameter is a real color and not a supervisor
|
||||
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_startColor = $color;
|
||||
$this->startColor = $color;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -276,8 +275,9 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getEndColor() {
|
||||
return $this->_endColor;
|
||||
public function getEndColor()
|
||||
{
|
||||
return $this->endColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,15 +287,16 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Fill
|
||||
*/
|
||||
public function setEndColor(PHPExcel_Style_Color $pValue = null) {
|
||||
public function setEndColor(PHPExcel_Style_Color $pValue = null)
|
||||
{
|
||||
// make sure parameter is a real color and not a supervisor
|
||||
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_endColor = $color;
|
||||
$this->endColor = $color;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -305,17 +306,17 @@ class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->getFillType()
|
||||
. $this->getRotation()
|
||||
. $this->getStartColor()->getHashCode()
|
||||
. $this->getEndColor()->getHashCode()
|
||||
. __CLASS__
|
||||
$this->getFillType() .
|
||||
$this->getRotation() .
|
||||
$this->getStartColor()->getHashCode() .
|
||||
$this->getEndColor()->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Font
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Font
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Underline types */
|
||||
|
@ -47,63 +39,63 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Calibri';
|
||||
protected $name = 'Calibri';
|
||||
|
||||
/**
|
||||
* Font Size
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $_size = 11;
|
||||
protected $size = 11;
|
||||
|
||||
/**
|
||||
* Bold
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_bold = FALSE;
|
||||
protected $bold = false;
|
||||
|
||||
/**
|
||||
* Italic
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_italic = FALSE;
|
||||
protected $italic = false;
|
||||
|
||||
/**
|
||||
* Superscript
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_superScript = FALSE;
|
||||
protected $superScript = false;
|
||||
|
||||
/**
|
||||
* Subscript
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_subScript = FALSE;
|
||||
protected $subScript = false;
|
||||
|
||||
/**
|
||||
* Underline
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_underline = self::UNDERLINE_NONE;
|
||||
protected $underline = self::UNDERLINE_NONE;
|
||||
|
||||
/**
|
||||
* Strikethrough
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_strikethrough = FALSE;
|
||||
protected $strikethrough = false;
|
||||
|
||||
/**
|
||||
* Foreground color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
protected $_color;
|
||||
protected $color;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Font
|
||||
|
@ -115,28 +107,28 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
if ($isConditional) {
|
||||
$this->_name = NULL;
|
||||
$this->_size = NULL;
|
||||
$this->_bold = NULL;
|
||||
$this->_italic = NULL;
|
||||
$this->_superScript = NULL;
|
||||
$this->_subScript = NULL;
|
||||
$this->_underline = NULL;
|
||||
$this->_strikethrough = NULL;
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
$this->name = null;
|
||||
$this->size = null;
|
||||
$this->bold = null;
|
||||
$this->italic = null;
|
||||
$this->superScript = null;
|
||||
$this->subScript = null;
|
||||
$this->underline = null;
|
||||
$this->strikethrough = null;
|
||||
$this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
} else {
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
$this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
}
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_color->bindParent($this, '_color');
|
||||
$this->color->bindParent($this, 'color');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +140,7 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getFont();
|
||||
return $this->parent->getSharedComponent()->getFont();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,9 +176,10 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function applyFromArray($pStyles = null) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (array_key_exists('name', $pStyles)) {
|
||||
|
@ -228,11 +221,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getName()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getName();
|
||||
}
|
||||
return $this->_name;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,15 +235,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setName($pValue = 'Calibri') {
|
||||
public function setName($pValue = 'Calibri')
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = 'Calibri';
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('name' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_name = $pValue;
|
||||
$this->name = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -259,11 +254,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getSize() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getSize()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getSize();
|
||||
}
|
||||
return $this->_size;
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,15 +268,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param double $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setSize($pValue = 10) {
|
||||
public function setSize($pValue = 10)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = 10;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('size' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_size = $pValue;
|
||||
$this->size = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -290,11 +287,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getBold() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getBold()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getBold();
|
||||
}
|
||||
return $this->_bold;
|
||||
return $this->bold;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -303,15 +301,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setBold($pValue = false) {
|
||||
public function setBold($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('bold' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_bold = $pValue;
|
||||
$this->bold = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -321,11 +320,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getItalic() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getItalic()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getItalic();
|
||||
}
|
||||
return $this->_italic;
|
||||
return $this->italic;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,15 +334,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setItalic($pValue = false) {
|
||||
public function setItalic($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('italic' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_italic = $pValue;
|
||||
$this->italic = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -352,11 +353,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getSuperScript() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getSuperScript()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getSuperScript();
|
||||
}
|
||||
return $this->_superScript;
|
||||
return $this->superScript;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,16 +367,17 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setSuperScript($pValue = false) {
|
||||
public function setSuperScript($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_superScript = $pValue;
|
||||
$this->_subScript = !$pValue;
|
||||
$this->superScript = $pValue;
|
||||
$this->subScript = !$pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -384,11 +387,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getSubScript() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getSubScript()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getSubScript();
|
||||
}
|
||||
return $this->_subScript;
|
||||
return $this->subScript;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,16 +401,17 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setSubScript($pValue = false) {
|
||||
public function setSubScript($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_subScript = $pValue;
|
||||
$this->_superScript = !$pValue;
|
||||
$this->subScript = $pValue;
|
||||
$this->superScript = !$pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -416,11 +421,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUnderline() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getUnderline()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getUnderline();
|
||||
}
|
||||
return $this->_underline;
|
||||
return $this->underline;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -431,17 +437,18 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* false equates to UNDERLINE_NONE
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setUnderline($pValue = self::UNDERLINE_NONE) {
|
||||
public function setUnderline($pValue = self::UNDERLINE_NONE)
|
||||
{
|
||||
if (is_bool($pValue)) {
|
||||
$pValue = ($pValue) ? self::UNDERLINE_SINGLE : self::UNDERLINE_NONE;
|
||||
} elseif ($pValue == '') {
|
||||
$pValue = self::UNDERLINE_NONE;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('underline' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_underline = $pValue;
|
||||
$this->underline = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -451,11 +458,12 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getStrikethrough() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getStrikethrough()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getStrikethrough();
|
||||
}
|
||||
return $this->_strikethrough;
|
||||
return $this->strikethrough;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -464,15 +472,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @param boolean $pValue
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setStrikethrough($pValue = false) {
|
||||
public function setStrikethrough($pValue = false)
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('strike' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_strikethrough = $pValue;
|
||||
$this->strikethrough = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -482,8 +491,9 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getColor() {
|
||||
return $this->_color;
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -493,15 +503,16 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Font
|
||||
*/
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null) {
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null)
|
||||
{
|
||||
// make sure parameter is a real color and not a supervisor
|
||||
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_color = $color;
|
||||
$this->color = $color;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -511,22 +522,22 @@ class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_name
|
||||
. $this->_size
|
||||
. ($this->_bold ? 't' : 'f')
|
||||
. ($this->_italic ? 't' : 'f')
|
||||
. ($this->_superScript ? 't' : 'f')
|
||||
. ($this->_subScript ? 't' : 'f')
|
||||
. $this->_underline
|
||||
. ($this->_strikethrough ? 't' : 'f')
|
||||
. $this->_color->getHashCode()
|
||||
. __CLASS__
|
||||
$this->name .
|
||||
$this->size .
|
||||
($this->bold ? 't' : 'f') .
|
||||
($this->italic ? 't' : 'f') .
|
||||
($this->superScript ? 't' : 'f') .
|
||||
($this->subScript ? 't' : 'f') .
|
||||
$this->underline .
|
||||
($this->strikethrough ? 't' : 'f') .
|
||||
$this->color->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_NumberFormat
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_NumberFormat
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
/* Pre-defined formats */
|
||||
|
@ -80,28 +72,28 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $_builtInFormats;
|
||||
protected static $builtInFormats;
|
||||
|
||||
/**
|
||||
* Excel built-in number formats (flipped, for faster lookups)
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $_flippedBuiltInFormats;
|
||||
protected static $flippedBuiltInFormats;
|
||||
|
||||
/**
|
||||
* Format Code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||
protected $formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||
|
||||
/**
|
||||
* Built-in format Code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_builtInFormatCode = 0;
|
||||
protected $builtInFormatCode = 0;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_NumberFormat
|
||||
|
@ -113,14 +105,14 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
if ($isConditional) {
|
||||
$this->_formatCode = NULL;
|
||||
$this->_builtInFormatCode = FALSE;
|
||||
$this->formatCode = null;
|
||||
$this->builtInFormatCode = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +124,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getNumberFormat();
|
||||
return $this->parent->getSharedComponent()->getNumberFormat();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,7 +156,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (array_key_exists('code', $pStyles)) {
|
||||
|
@ -184,14 +176,13 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*/
|
||||
public function getFormatCode()
|
||||
{
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getFormatCode();
|
||||
}
|
||||
if ($this->_builtInFormatCode !== false)
|
||||
{
|
||||
return self::builtInFormatCode($this->_builtInFormatCode);
|
||||
if ($this->builtInFormatCode !== false) {
|
||||
return self::builtInFormatCode($this->builtInFormatCode);
|
||||
}
|
||||
return $this->_formatCode;
|
||||
return $this->formatCode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,12 +196,12 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
if ($pValue == '') {
|
||||
$pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||
}
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('code' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_formatCode = $pValue;
|
||||
$this->_builtInFormatCode = self::builtInFormatCodeIndex($pValue);
|
||||
$this->formatCode = $pValue;
|
||||
$this->builtInFormatCode = self::builtInFormatCodeIndex($pValue);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -222,10 +213,10 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*/
|
||||
public function getBuiltInFormatCode()
|
||||
{
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getBuiltInFormatCode();
|
||||
}
|
||||
return $this->_builtInFormatCode;
|
||||
return $this->builtInFormatCode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,12 +228,12 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
public function setBuiltInFormatCode($pValue = 0)
|
||||
{
|
||||
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_builtInFormatCode = $pValue;
|
||||
$this->_formatCode = self::builtInFormatCode($pValue);
|
||||
$this->builtInFormatCode = $pValue;
|
||||
$this->formatCode = self::builtInFormatCode($pValue);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -253,62 +244,62 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
private static function fillBuiltInFormatCodes()
|
||||
{
|
||||
// Built-in format codes
|
||||
if (is_null(self::$_builtInFormats)) {
|
||||
self::$_builtInFormats = array();
|
||||
if (is_null(self::$builtInFormats)) {
|
||||
self::$builtInFormats = array();
|
||||
|
||||
// General
|
||||
self::$_builtInFormats[0] = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||
self::$_builtInFormats[1] = '0';
|
||||
self::$_builtInFormats[2] = '0.00';
|
||||
self::$_builtInFormats[3] = '#,##0';
|
||||
self::$_builtInFormats[4] = '#,##0.00';
|
||||
self::$builtInFormats[0] = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||
self::$builtInFormats[1] = '0';
|
||||
self::$builtInFormats[2] = '0.00';
|
||||
self::$builtInFormats[3] = '#,##0';
|
||||
self::$builtInFormats[4] = '#,##0.00';
|
||||
|
||||
self::$_builtInFormats[9] = '0%';
|
||||
self::$_builtInFormats[10] = '0.00%';
|
||||
self::$_builtInFormats[11] = '0.00E+00';
|
||||
self::$_builtInFormats[12] = '# ?/?';
|
||||
self::$_builtInFormats[13] = '# ??/??';
|
||||
self::$_builtInFormats[14] = 'mm-dd-yy';
|
||||
self::$_builtInFormats[15] = 'd-mmm-yy';
|
||||
self::$_builtInFormats[16] = 'd-mmm';
|
||||
self::$_builtInFormats[17] = 'mmm-yy';
|
||||
self::$_builtInFormats[18] = 'h:mm AM/PM';
|
||||
self::$_builtInFormats[19] = 'h:mm:ss AM/PM';
|
||||
self::$_builtInFormats[20] = 'h:mm';
|
||||
self::$_builtInFormats[21] = 'h:mm:ss';
|
||||
self::$_builtInFormats[22] = 'm/d/yy h:mm';
|
||||
self::$builtInFormats[9] = '0%';
|
||||
self::$builtInFormats[10] = '0.00%';
|
||||
self::$builtInFormats[11] = '0.00E+00';
|
||||
self::$builtInFormats[12] = '# ?/?';
|
||||
self::$builtInFormats[13] = '# ??/??';
|
||||
self::$builtInFormats[14] = 'mm-dd-yy';
|
||||
self::$builtInFormats[15] = 'd-mmm-yy';
|
||||
self::$builtInFormats[16] = 'd-mmm';
|
||||
self::$builtInFormats[17] = 'mmm-yy';
|
||||
self::$builtInFormats[18] = 'h:mm AM/PM';
|
||||
self::$builtInFormats[19] = 'h:mm:ss AM/PM';
|
||||
self::$builtInFormats[20] = 'h:mm';
|
||||
self::$builtInFormats[21] = 'h:mm:ss';
|
||||
self::$builtInFormats[22] = 'm/d/yy h:mm';
|
||||
|
||||
self::$_builtInFormats[37] = '#,##0 ;(#,##0)';
|
||||
self::$_builtInFormats[38] = '#,##0 ;[Red](#,##0)';
|
||||
self::$_builtInFormats[39] = '#,##0.00;(#,##0.00)';
|
||||
self::$_builtInFormats[40] = '#,##0.00;[Red](#,##0.00)';
|
||||
self::$builtInFormats[37] = '#,##0 ;(#,##0)';
|
||||
self::$builtInFormats[38] = '#,##0 ;[Red](#,##0)';
|
||||
self::$builtInFormats[39] = '#,##0.00;(#,##0.00)';
|
||||
self::$builtInFormats[40] = '#,##0.00;[Red](#,##0.00)';
|
||||
|
||||
self::$_builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
|
||||
self::$_builtInFormats[45] = 'mm:ss';
|
||||
self::$_builtInFormats[46] = '[h]:mm:ss';
|
||||
self::$_builtInFormats[47] = 'mmss.0';
|
||||
self::$_builtInFormats[48] = '##0.0E+0';
|
||||
self::$_builtInFormats[49] = '@';
|
||||
self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
|
||||
self::$builtInFormats[45] = 'mm:ss';
|
||||
self::$builtInFormats[46] = '[h]:mm:ss';
|
||||
self::$builtInFormats[47] = 'mmss.0';
|
||||
self::$builtInFormats[48] = '##0.0E+0';
|
||||
self::$builtInFormats[49] = '@';
|
||||
|
||||
// CHT
|
||||
self::$_builtInFormats[27] = '[$-404]e/m/d';
|
||||
self::$_builtInFormats[30] = 'm/d/yy';
|
||||
self::$_builtInFormats[36] = '[$-404]e/m/d';
|
||||
self::$_builtInFormats[50] = '[$-404]e/m/d';
|
||||
self::$_builtInFormats[57] = '[$-404]e/m/d';
|
||||
self::$builtInFormats[27] = '[$-404]e/m/d';
|
||||
self::$builtInFormats[30] = 'm/d/yy';
|
||||
self::$builtInFormats[36] = '[$-404]e/m/d';
|
||||
self::$builtInFormats[50] = '[$-404]e/m/d';
|
||||
self::$builtInFormats[57] = '[$-404]e/m/d';
|
||||
|
||||
// THA
|
||||
self::$_builtInFormats[59] = 't0';
|
||||
self::$_builtInFormats[60] = 't0.00';
|
||||
self::$_builtInFormats[61] = 't#,##0';
|
||||
self::$_builtInFormats[62] = 't#,##0.00';
|
||||
self::$_builtInFormats[67] = 't0%';
|
||||
self::$_builtInFormats[68] = 't0.00%';
|
||||
self::$_builtInFormats[69] = 't# ?/?';
|
||||
self::$_builtInFormats[70] = 't# ??/??';
|
||||
self::$builtInFormats[59] = 't0';
|
||||
self::$builtInFormats[60] = 't0.00';
|
||||
self::$builtInFormats[61] = 't#,##0';
|
||||
self::$builtInFormats[62] = 't#,##0.00';
|
||||
self::$builtInFormats[67] = 't0%';
|
||||
self::$builtInFormats[68] = 't0.00%';
|
||||
self::$builtInFormats[69] = 't# ?/?';
|
||||
self::$builtInFormats[70] = 't# ??/??';
|
||||
|
||||
// Flip array (for faster lookups)
|
||||
self::$_flippedBuiltInFormats = array_flip(self::$_builtInFormats);
|
||||
self::$flippedBuiltInFormats = array_flip(self::$builtInFormats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,8 +318,8 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
self::fillBuiltInFormatCodes();
|
||||
|
||||
// Lookup format code
|
||||
if (isset(self::$_builtInFormats[$pIndex])) {
|
||||
return self::$_builtInFormats[$pIndex];
|
||||
if (isset(self::$builtInFormats[$pIndex])) {
|
||||
return self::$builtInFormats[$pIndex];
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@ -346,8 +337,8 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
self::fillBuiltInFormatCodes();
|
||||
|
||||
// Lookup format code
|
||||
if (isset(self::$_flippedBuiltInFormats[$formatCode])) {
|
||||
return self::$_flippedBuiltInFormats[$formatCode];
|
||||
if (isset(self::$flippedBuiltInFormats[$formatCode])) {
|
||||
return self::$flippedBuiltInFormats[$formatCode];
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -360,13 +351,13 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_formatCode
|
||||
. $this->_builtInFormatCode
|
||||
. __CLASS__
|
||||
$this->formatCode .
|
||||
$this->builtInFormatCode .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -375,7 +366,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_dateFormatReplacements = array(
|
||||
private static $dateFormatReplacements = array(
|
||||
// first remove escapes related to non-format characters
|
||||
'\\' => '',
|
||||
// 12-hour suffix
|
||||
|
@ -418,7 +409,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_dateFormatReplacements24 = array(
|
||||
private static $dateFormatReplacements24 = array(
|
||||
'hh' => 'H',
|
||||
'h' => 'G'
|
||||
);
|
||||
|
@ -427,12 +418,12 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_dateFormatReplacements12 = array(
|
||||
private static $dateFormatReplacements12 = array(
|
||||
'hh' => 'h',
|
||||
'h' => 'g'
|
||||
);
|
||||
|
||||
private static function _formatAsDate(&$value, &$format)
|
||||
private static function formatAsDate(&$value, &$format)
|
||||
{
|
||||
// dvc: convert Excel formats to PHP date formats
|
||||
|
||||
|
@ -444,18 +435,20 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
// OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case
|
||||
$format = strtolower($format);
|
||||
|
||||
$format = strtr($format,self::$_dateFormatReplacements);
|
||||
if (!strpos($format,'A')) { // 24-hour time format
|
||||
$format = strtr($format,self::$_dateFormatReplacements24);
|
||||
} else { // 12-hour time format
|
||||
$format = strtr($format,self::$_dateFormatReplacements12);
|
||||
$format = strtr($format, self::$dateFormatReplacements);
|
||||
if (!strpos($format, 'A')) {
|
||||
// 24-hour time format
|
||||
$format = strtr($format, self::$dateFormatReplacements24);
|
||||
} else {
|
||||
// 12-hour time format
|
||||
$format = strtr($format, self::$dateFormatReplacements12);
|
||||
}
|
||||
|
||||
$dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value);
|
||||
$value = $dateObj->format($format);
|
||||
}
|
||||
|
||||
private static function _formatAsPercentage(&$value, &$format)
|
||||
private static function formatAsPercentage(&$value, &$format)
|
||||
{
|
||||
if ($format === self::FORMAT_PERCENTAGE) {
|
||||
$value = round((100 * $value), 0) . '%';
|
||||
|
@ -473,7 +466,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
}
|
||||
}
|
||||
|
||||
private static function _formatAsFraction(&$value, &$format)
|
||||
private static function formatAsFraction(&$value, &$format)
|
||||
{
|
||||
$sign = ($value < 0) ? '-' : '';
|
||||
|
||||
|
@ -498,14 +491,15 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
}
|
||||
}
|
||||
|
||||
private static function _complexNumberFormatMask($number, $mask, $level = 0) {
|
||||
private static function complexNumberFormatMask($number, $mask, $level = 0)
|
||||
{
|
||||
$sign = ($number < 0.0);
|
||||
$number = abs($number);
|
||||
if (strpos($mask, '.') !== false) {
|
||||
$numbers = explode('.', $number . '.0');
|
||||
$masks = explode('.', $mask . '.0');
|
||||
$result1 = self::_complexNumberFormatMask($numbers[0], $masks[0], 1);
|
||||
$result2 = strrev(self::_complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]), 1));
|
||||
$result1 = self::complexNumberFormatMask($numbers[0], $masks[0], 1);
|
||||
$result2 = strrev(self::complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]), 1));
|
||||
return (($sign) ? '-' : '') . $result1 . '.' . $result2;
|
||||
}
|
||||
|
||||
|
@ -547,7 +541,9 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
public static function toFormattedString($value = '0', $format = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $callBack = null)
|
||||
{
|
||||
// For now we do not treat strings although section 4 of a format code affects strings
|
||||
if (!is_numeric($value)) return $value;
|
||||
if (!is_numeric($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// For 'General' format code, we just pass the value although this is not entirely the way Excel does it,
|
||||
// it seems to round numbers to a total of 10 digits.
|
||||
|
@ -569,26 +565,22 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
case 1:
|
||||
$format = $sections[0];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$format = ($value >= 0) ? $sections[0] : $sections[1];
|
||||
$value = abs($value); // Use the absolute value
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$format = ($value > 0) ?
|
||||
$sections[0] : ( ($value < 0) ?
|
||||
$sections[1] : $sections[2]);
|
||||
$value = abs($value); // Use the absolute value
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$format = ($value > 0) ?
|
||||
$sections[0] : ( ($value < 0) ?
|
||||
$sections[1] : $sections[2]);
|
||||
$value = abs($value); // Use the absolute value
|
||||
break;
|
||||
|
||||
default:
|
||||
// something is wrong, just use first section
|
||||
$format = $sections[0];
|
||||
|
@ -604,9 +596,9 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
|
||||
// Let's begin inspecting the format and converting the value to a formatted string
|
||||
if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $format)) { // datetime format
|
||||
self::_formatAsDate($value, $format);
|
||||
self::formatAsDate($value, $format);
|
||||
} elseif (preg_match('/%$/', $format)) { // % number format
|
||||
self::_formatAsPercentage($value, $format);
|
||||
self::formatAsPercentage($value, $format);
|
||||
} else {
|
||||
if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
|
||||
$value = 'EUR ' . sprintf('%1.2f', $value);
|
||||
|
@ -648,7 +640,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
if (preg_match('/#?.*\?\/\?/', $format, $m)) {
|
||||
//echo 'Format mask is fractional '.$format.' <br />';
|
||||
if ($value != (int)$value) {
|
||||
self::_formatAsFraction($value, $format);
|
||||
self::formatAsFraction($value, $format);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -672,10 +664,10 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
$minWidth = strlen($left) + strlen($dec) + strlen($right);
|
||||
if ($useThousands) {
|
||||
$value = number_format(
|
||||
$value
|
||||
, strlen($right)
|
||||
, PHPExcel_Shared_String::getDecimalSeparator()
|
||||
, PHPExcel_Shared_String::getThousandsSeparator()
|
||||
$value,
|
||||
strlen($right),
|
||||
PHPExcel_Shared_String::getDecimalSeparator(),
|
||||
PHPExcel_Shared_String::getThousandsSeparator()
|
||||
);
|
||||
$value = preg_replace($number_regex, $value, $format);
|
||||
} else {
|
||||
|
@ -683,7 +675,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
// Scientific format
|
||||
$value = sprintf('%5.2E', $value);
|
||||
} elseif (preg_match('/0([^\d\.]+)0/', $format)) {
|
||||
$value = self::_complexNumberFormatMask($value, $format);
|
||||
$value = self::complexNumberFormatMask($value, $format);
|
||||
} else {
|
||||
$sprintf_pattern = "%0$minWidth." . strlen($right) . "f";
|
||||
$value = sprintf($sprintf_pattern, $value);
|
||||
|
@ -713,5 +705,4 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Protection
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -22,16 +23,7 @@
|
|||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.4.5, 2007-08-23
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Protection
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
|
||||
{
|
||||
|
@ -45,14 +37,14 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_locked;
|
||||
protected $locked;
|
||||
|
||||
/**
|
||||
* Hidden
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_hidden;
|
||||
protected $hidden;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Protection
|
||||
|
@ -64,15 +56,15 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
parent::__construct($isSupervisor);
|
||||
|
||||
// Initialise values
|
||||
if (!$isConditional) {
|
||||
$this->_locked = self::PROTECTION_INHERIT;
|
||||
$this->_hidden = self::PROTECTION_INHERIT;
|
||||
$this->locked = self::PROTECTION_INHERIT;
|
||||
$this->hidden = self::PROTECTION_INHERIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +76,7 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
*/
|
||||
public function getSharedComponent()
|
||||
{
|
||||
return $this->_parent->getSharedComponent()->getProtection();
|
||||
return $this->parent->getSharedComponent()->getProtection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,9 +106,10 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Style_Protection
|
||||
*/
|
||||
public function applyFromArray($pStyles = NULL) {
|
||||
public function applyFromArray($pStyles = null)
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->_isSupervisor) {
|
||||
if ($this->isSupervisor) {
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||
} else {
|
||||
if (isset($pStyles['locked'])) {
|
||||
|
@ -137,11 +130,12 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocked() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getLocked()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getLocked();
|
||||
}
|
||||
return $this->_locked;
|
||||
return $this->locked;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,12 +144,13 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Protection
|
||||
*/
|
||||
public function setLocked($pValue = self::PROTECTION_INHERIT) {
|
||||
if ($this->_isSupervisor) {
|
||||
public function setLocked($pValue = self::PROTECTION_INHERIT)
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('locked' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_locked = $pValue;
|
||||
$this->locked = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -165,11 +160,12 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHidden() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHidden()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHidden();
|
||||
}
|
||||
return $this->_hidden;
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,12 +174,13 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
* @param string $pValue
|
||||
* @return PHPExcel_Style_Protection
|
||||
*/
|
||||
public function setHidden($pValue = self::PROTECTION_INHERIT) {
|
||||
if ($this->_isSupervisor) {
|
||||
public function setHidden($pValue = self::PROTECTION_INHERIT)
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->_hidden = $pValue;
|
||||
$this->hidden = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -193,15 +190,15 @@ class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHP
|
|||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
if ($this->_isSupervisor) {
|
||||
public function getHashCode()
|
||||
{
|
||||
if ($this->isSupervisor) {
|
||||
return $this->getSharedComponent()->getHashCode();
|
||||
}
|
||||
return md5(
|
||||
$this->_locked
|
||||
. $this->_hidden
|
||||
. __CLASS__
|
||||
$this->locked .
|
||||
$this->hidden .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Style_Supervisor
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
|
@ -24,15 +25,6 @@
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Style_Supervisor
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Style
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
abstract class PHPExcel_Style_Supervisor
|
||||
{
|
||||
/**
|
||||
|
@ -40,14 +32,14 @@ abstract class PHPExcel_Style_Supervisor
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_isSupervisor;
|
||||
protected $isSupervisor;
|
||||
|
||||
/**
|
||||
* Parent. Only used for supervisor
|
||||
*
|
||||
* @var PHPExcel_Style
|
||||
*/
|
||||
protected $_parent;
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Style_Alignment
|
||||
|
@ -56,10 +48,10 @@ abstract class PHPExcel_Style_Supervisor
|
|||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = FALSE)
|
||||
public function __construct($isSupervisor = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
$this->isSupervisor = $isSupervisor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,9 +60,9 @@ abstract class PHPExcel_Style_Supervisor
|
|||
* @param PHPExcel $parent
|
||||
* @return PHPExcel_Style_Supervisor
|
||||
*/
|
||||
public function bindParent($parent, $parentPropertyName=NULL)
|
||||
public function bindParent($parent, $parentPropertyName = null)
|
||||
{
|
||||
$this->_parent = $parent;
|
||||
$this->parent = $parent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -81,7 +73,7 @@ abstract class PHPExcel_Style_Supervisor
|
|||
*/
|
||||
public function getIsSupervisor()
|
||||
{
|
||||
return $this->_isSupervisor;
|
||||
return $this->isSupervisor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +83,7 @@ abstract class PHPExcel_Style_Supervisor
|
|||
*/
|
||||
public function getActiveSheet()
|
||||
{
|
||||
return $this->_parent->getActiveSheet();
|
||||
return $this->parent->getActiveSheet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,10 +111,11 @@ abstract class PHPExcel_Style_Supervisor
|
|||
/**
|
||||
* 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)) && ($key != '_parent')) {
|
||||
if ((is_object($value)) && ($key != 'parent')) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
|
|
|
@ -1152,16 +1152,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||
*/
|
||||
public function getCell($pCoordinate = 'A1')
|
||||
{
|
||||
$pCoordinate = strtoupper($pCoordinate);
|
||||
// Check cell collection
|
||||
if ($this->_cellCollection->isDataSet($pCoordinate)) {
|
||||
if ($this->_cellCollection->isDataSet(strtoupper($pCoordinate))) {
|
||||
return $this->_cellCollection->getCacheData($pCoordinate);
|
||||
}
|
||||
|
||||
// Worksheet reference?
|
||||
if (strpos($pCoordinate, '!') !== false) {
|
||||
$worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
|
||||
return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]);
|
||||
return $this->_parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1]));
|
||||
}
|
||||
|
||||
// Named range?
|
||||
|
@ -2658,7 +2657,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||
}
|
||||
|
||||
if ($returnRange) {
|
||||
return array( trim(substr($pRange, 0, $sep),"'"),
|
||||
return array(
|
||||
trim(substr($pRange, 0, $sep),"'"),
|
||||
substr($pRange, $sep + 1)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ $callStartTime = microtime(true);
|
|||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
|
||||
->setEnclosure('"')
|
||||
->setLineEnding("\r\n")
|
||||
->setSheetIndex(0)
|
||||
->save(str_replace('.php', '.csv', __FILE__));
|
||||
$callEndTime = microtime(true);
|
||||
|
@ -61,7 +60,6 @@ echo date('H:i:s') , " Read from CSV format" , EOL;
|
|||
$callStartTime = microtime(true);
|
||||
$objReader = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')
|
||||
->setEnclosure('"')
|
||||
->setLineEnding("\r\n")
|
||||
->setSheetIndex(0);
|
||||
$objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__));
|
||||
|
||||
|
|
Loading…
Reference in New Issue