composer update
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -18,377 +19,387 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_AutoFilter_Column
|
||||
{
|
||||
const AUTOFILTER_FILTERTYPE_FILTER = 'filters';
|
||||
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters';
|
||||
// Supports no more than 2 rules, with an And/Or join criteria
|
||||
// if more than 1 rule is defined
|
||||
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||
// Even though the filter rule is constant, the filtered data can vary
|
||||
// e.g. filtered by date = TODAY
|
||||
const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10';
|
||||
const AUTOFILTER_FILTERTYPE_FILTER = 'filters';
|
||||
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters';
|
||||
// Supports no more than 2 rules, with an And/Or join criteria
|
||||
// if more than 1 rule is defined
|
||||
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||
// Even though the filter rule is constant, the filtered data can vary
|
||||
// e.g. filtered by date = TODAY
|
||||
const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10';
|
||||
|
||||
/**
|
||||
* Types of autofilter rules
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_filterTypes = array(
|
||||
// Currently we're not handling
|
||||
// colorFilter
|
||||
// extLst
|
||||
// iconFilter
|
||||
self::AUTOFILTER_FILTERTYPE_FILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_DYNAMICFILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_TOPTENFILTER,
|
||||
);
|
||||
/**
|
||||
* Types of autofilter rules
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $filterTypes = array(
|
||||
// Currently we're not handling
|
||||
// colorFilter
|
||||
// extLst
|
||||
// iconFilter
|
||||
self::AUTOFILTER_FILTERTYPE_FILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_DYNAMICFILTER,
|
||||
self::AUTOFILTER_FILTERTYPE_TOPTENFILTER,
|
||||
);
|
||||
|
||||
/* Multiple Rule Connections */
|
||||
const AUTOFILTER_COLUMN_JOIN_AND = 'and';
|
||||
const AUTOFILTER_COLUMN_JOIN_OR = 'or';
|
||||
/* Multiple Rule Connections */
|
||||
const AUTOFILTER_COLUMN_JOIN_AND = 'and';
|
||||
const AUTOFILTER_COLUMN_JOIN_OR = 'or';
|
||||
|
||||
/**
|
||||
* Join options for autofilter rules
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_ruleJoins = array(
|
||||
self::AUTOFILTER_COLUMN_JOIN_AND,
|
||||
self::AUTOFILTER_COLUMN_JOIN_OR,
|
||||
);
|
||||
/**
|
||||
* Join options for autofilter rules
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $ruleJoins = array(
|
||||
self::AUTOFILTER_COLUMN_JOIN_AND,
|
||||
self::AUTOFILTER_COLUMN_JOIN_OR,
|
||||
);
|
||||
|
||||
/**
|
||||
* Autofilter
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
private $_parent = NULL;
|
||||
/**
|
||||
* Autofilter
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Column Index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_columnIndex = '';
|
||||
/**
|
||||
* Autofilter Column Index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $columnIndex = '';
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Column Filter Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_filterType = self::AUTOFILTER_FILTERTYPE_FILTER;
|
||||
/**
|
||||
* Autofilter Column Filter Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $filterType = self::AUTOFILTER_FILTERTYPE_FILTER;
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Multiple Rules And/Or
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_join = self::AUTOFILTER_COLUMN_JOIN_OR;
|
||||
/**
|
||||
* Autofilter Multiple Rules And/Or
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $join = self::AUTOFILTER_COLUMN_JOIN_OR;
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Column Rules
|
||||
*
|
||||
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
private $_ruleset = array();
|
||||
/**
|
||||
* Autofilter Column Rules
|
||||
*
|
||||
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
private $ruleset = array();
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Column Dynamic Attributes
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $_attributes = array();
|
||||
/**
|
||||
* Autofilter Column Dynamic Attributes
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $attributes = array();
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @param string $pColumn Column (e.g. A)
|
||||
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
|
||||
*/
|
||||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL)
|
||||
{
|
||||
$this->_columnIndex = $pColumn;
|
||||
$this->_parent = $pParent;
|
||||
}
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @param string $pColumn Column (e.g. A)
|
||||
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
|
||||
*/
|
||||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = null)
|
||||
{
|
||||
$this->columnIndex = $pColumn;
|
||||
$this->parent = $pParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Column Index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnIndex() {
|
||||
return $this->_columnIndex;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Column Index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnIndex()
|
||||
{
|
||||
return $this->columnIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Column Index
|
||||
*
|
||||
* @param string $pColumn Column (e.g. A)
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setColumnIndex($pColumn) {
|
||||
// Uppercase coordinate
|
||||
$pColumn = strtoupper($pColumn);
|
||||
if ($this->_parent !== NULL) {
|
||||
$this->_parent->testColumnInRange($pColumn);
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Column Index
|
||||
*
|
||||
* @param string $pColumn Column (e.g. A)
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setColumnIndex($pColumn)
|
||||
{
|
||||
// Uppercase coordinate
|
||||
$pColumn = strtoupper($pColumn);
|
||||
if ($this->parent !== null) {
|
||||
$this->parent->testColumnInRange($pColumn);
|
||||
}
|
||||
|
||||
$this->_columnIndex = $pColumn;
|
||||
$this->columnIndex = $pColumn;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this Column's AutoFilter Parent
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function getParent() {
|
||||
return $this->_parent;
|
||||
}
|
||||
/**
|
||||
* Get this Column's AutoFilter Parent
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this Column's AutoFilter Parent
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
|
||||
$this->_parent = $pParent;
|
||||
/**
|
||||
* Set this Column's AutoFilter Parent
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null)
|
||||
{
|
||||
$this->parent = $pParent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilterType() {
|
||||
return $this->_filterType;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilterType()
|
||||
{
|
||||
return $this->filterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Type
|
||||
*
|
||||
* @param string $pFilterType
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
|
||||
if (!in_array($pFilterType,self::$_filterTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Type
|
||||
*
|
||||
* @param string $pFilterType
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
|
||||
{
|
||||
if (!in_array($pFilterType, self::$filterTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
|
||||
}
|
||||
|
||||
$this->_filterType = $pFilterType;
|
||||
$this->filterType = $pFilterType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Multiple Rules And/Or Join
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getJoin() {
|
||||
return $this->_join;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Multiple Rules And/Or Join
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getJoin()
|
||||
{
|
||||
return $this->join;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Multiple Rules And/Or
|
||||
*
|
||||
* @param string $pJoin And/Or
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
|
||||
// Lowercase And/Or
|
||||
$pJoin = strtolower($pJoin);
|
||||
if (!in_array($pJoin,self::$_ruleJoins)) {
|
||||
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Multiple Rules And/Or
|
||||
*
|
||||
* @param string $pJoin And/Or
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
|
||||
{
|
||||
// Lowercase And/Or
|
||||
$pJoin = strtolower($pJoin);
|
||||
if (!in_array($pJoin, self::$ruleJoins)) {
|
||||
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
|
||||
}
|
||||
|
||||
$this->_join = $pJoin;
|
||||
$this->join = $pJoin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Attributes
|
||||
*
|
||||
* @param string[] $pAttributes
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttributes($pAttributes = array()) {
|
||||
$this->_attributes = $pAttributes;
|
||||
/**
|
||||
* Set AutoFilter Attributes
|
||||
*
|
||||
* @param string[] $pAttributes
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttributes($pAttributes = array())
|
||||
{
|
||||
$this->attributes = $pAttributes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set An AutoFilter Attribute
|
||||
*
|
||||
* @param string $pName Attribute Name
|
||||
* @param string $pValue Attribute Value
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttribute($pName, $pValue) {
|
||||
$this->_attributes[$pName] = $pValue;
|
||||
/**
|
||||
* Set An AutoFilter Attribute
|
||||
*
|
||||
* @param string $pName Attribute Name
|
||||
* @param string $pValue Attribute Value
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttribute($pName, $pValue)
|
||||
{
|
||||
$this->attributes[$pName] = $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Column Attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAttributes() {
|
||||
return $this->_attributes;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Column Attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get specific AutoFilter Column Attribute
|
||||
*
|
||||
* @param string $pName Attribute Name
|
||||
* @return string
|
||||
*/
|
||||
public function getAttribute($pName) {
|
||||
if (isset($this->_attributes[$pName]))
|
||||
return $this->_attributes[$pName];
|
||||
return NULL;
|
||||
}
|
||||
/**
|
||||
* Get specific AutoFilter Column Attribute
|
||||
*
|
||||
* @param string $pName Attribute Name
|
||||
* @return string
|
||||
*/
|
||||
public function getAttribute($pName)
|
||||
{
|
||||
if (isset($this->attributes[$pName])) {
|
||||
return $this->attributes[$pName];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all AutoFilter Column Rules
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRules() {
|
||||
return $this->_ruleset;
|
||||
}
|
||||
/**
|
||||
* Get all AutoFilter Column Rules
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRules()
|
||||
{
|
||||
return $this->ruleset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specified AutoFilter Column Rule
|
||||
*
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRule($pIndex) {
|
||||
if (!isset($this->_ruleset[$pIndex])) {
|
||||
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
}
|
||||
return $this->_ruleset[$pIndex];
|
||||
}
|
||||
/**
|
||||
* Get a specified AutoFilter Column Rule
|
||||
*
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRule($pIndex)
|
||||
{
|
||||
if (!isset($this->ruleset[$pIndex])) {
|
||||
$this->ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
}
|
||||
return $this->ruleset[$pIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new AutoFilter Column Rule in the ruleset
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function createRule() {
|
||||
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
/**
|
||||
* Create a new AutoFilter Column Rule in the ruleset
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function createRule()
|
||||
{
|
||||
$this->ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
|
||||
return end($this->_ruleset);
|
||||
}
|
||||
return end($this->ruleset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new AutoFilter Column Rule to the ruleset
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule
|
||||
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) {
|
||||
$pRule->setParent($this);
|
||||
$this->_ruleset[] = $pRule;
|
||||
/**
|
||||
* Add a new AutoFilter Column Rule to the ruleset
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule
|
||||
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true)
|
||||
{
|
||||
$pRule->setParent($this);
|
||||
$this->ruleset[] = $pRule;
|
||||
|
||||
return ($returnRule) ? $pRule : $this;
|
||||
}
|
||||
return ($returnRule) ? $pRule : $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a specified AutoFilter Column Rule
|
||||
* If the number of rules is reduced to 1, then we reset And/Or logic to Or
|
||||
*
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function deleteRule($pIndex) {
|
||||
if (isset($this->_ruleset[$pIndex])) {
|
||||
unset($this->_ruleset[$pIndex]);
|
||||
// If we've just deleted down to a single rule, then reset And/Or joining to Or
|
||||
if (count($this->_ruleset) <= 1) {
|
||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Delete a specified AutoFilter Column Rule
|
||||
* If the number of rules is reduced to 1, then we reset And/Or logic to Or
|
||||
*
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function deleteRule($pIndex)
|
||||
{
|
||||
if (isset($this->ruleset[$pIndex])) {
|
||||
unset($this->ruleset[$pIndex]);
|
||||
// If we've just deleted down to a single rule, then reset And/Or joining to Or
|
||||
if (count($this->ruleset) <= 1) {
|
||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all AutoFilter Column Rules
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function clearRules() {
|
||||
$this->_ruleset = array();
|
||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||
/**
|
||||
* Delete all AutoFilter Column Rules
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function clearRules()
|
||||
{
|
||||
$this->ruleset = array();
|
||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == '_parent') {
|
||||
// Detach from autofilter parent
|
||||
$this->$key = NULL;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
} elseif ((is_array($value)) && ($key == '_ruleset')) {
|
||||
// The columns array of PHPExcel_Worksheet_AutoFilter objects
|
||||
$this->$key = array();
|
||||
foreach ($value as $k => $v) {
|
||||
$this->$key[$k] = clone $v;
|
||||
// attach the new cloned Rule to this new cloned Autofilter Cloned object
|
||||
$this->$key[$k]->setParent($this);
|
||||
}
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == 'parent') {
|
||||
// Detach from autofilter parent
|
||||
$this->$key = null;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
} elseif ((is_array($value)) && ($key == 'ruleset')) {
|
||||
// The columns array of PHPExcel_Worksheet_AutoFilter objects
|
||||
$this->$key = array();
|
||||
foreach ($value as $k => $v) {
|
||||
$this->$key[$k] = clone $v;
|
||||
// attach the new cloned Rule to this new cloned Autofilter Cloned object
|
||||
$this->$key[$k]->setParent($this);
|
||||
}
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -18,447 +19,450 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
{
|
||||
const AUTOFILTER_RULETYPE_FILTER = 'filter';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem';
|
||||
const AUTOFILTER_RULETYPE_CUSTOMFILTER = 'customFilter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||
const AUTOFILTER_RULETYPE_TOPTENFILTER = 'top10Filter';
|
||||
const AUTOFILTER_RULETYPE_FILTER = 'filter';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem';
|
||||
const AUTOFILTER_RULETYPE_CUSTOMFILTER = 'customFilter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMICFILTER = 'dynamicFilter';
|
||||
const AUTOFILTER_RULETYPE_TOPTENFILTER = 'top10Filter';
|
||||
|
||||
private static $_ruleTypes = array(
|
||||
// Currently we're not handling
|
||||
// colorFilter
|
||||
// extLst
|
||||
// iconFilter
|
||||
self::AUTOFILTER_RULETYPE_FILTER,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP,
|
||||
self::AUTOFILTER_RULETYPE_CUSTOMFILTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMICFILTER,
|
||||
self::AUTOFILTER_RULETYPE_TOPTENFILTER,
|
||||
);
|
||||
private static $ruleTypes = array(
|
||||
// Currently we're not handling
|
||||
// colorFilter
|
||||
// extLst
|
||||
// iconFilter
|
||||
self::AUTOFILTER_RULETYPE_FILTER,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP,
|
||||
self::AUTOFILTER_RULETYPE_CUSTOMFILTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMICFILTER,
|
||||
self::AUTOFILTER_RULETYPE_TOPTENFILTER,
|
||||
);
|
||||
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_YEAR = 'year';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_MONTH = 'month';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_DAY = 'day';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_HOUR = 'hour';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_MINUTE = 'minute';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_SECOND = 'second';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_YEAR = 'year';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_MONTH = 'month';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_DAY = 'day';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_HOUR = 'hour';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_MINUTE = 'minute';
|
||||
const AUTOFILTER_RULETYPE_DATEGROUP_SECOND = 'second';
|
||||
|
||||
private static $_dateTimeGroups = array(
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_YEAR,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MONTH,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_DAY,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_HOUR,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_SECOND,
|
||||
);
|
||||
private static $dateTimeGroups = array(
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_YEAR,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MONTH,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_DAY,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_HOUR,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE,
|
||||
self::AUTOFILTER_RULETYPE_DATEGROUP_SECOND,
|
||||
);
|
||||
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY = 'yesterday';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_TODAY = 'today';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW = 'tomorrow';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE = 'yearToDate';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR = 'thisYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER = 'thisQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH = 'thisMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK = 'thisWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR = 'lastYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER = 'lastQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH = 'lastMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK = 'lastWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR = 'nextYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER = 'nextQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH = 'nextMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK = 'nextWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 = 'M1';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JANUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 = 'M2';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 = 'M3';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MARCH = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 = 'M4';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_APRIL = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 = 'M5';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MAY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 = 'M6';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JUNE = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 = 'M7';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JULY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 = 'M8';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_AUGUST = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 = 'M9';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 = 'M10';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 = 'M11';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 = 'M12';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 = 'Q1';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 = 'Q2';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 = 'Q3';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 = 'Q4';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE = 'aboveAverage';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE = 'belowAverage';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY = 'yesterday';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_TODAY = 'today';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW = 'tomorrow';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE = 'yearToDate';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR = 'thisYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER = 'thisQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH = 'thisMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK = 'thisWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR = 'lastYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER = 'lastQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH = 'lastMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK = 'lastWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR = 'nextYear';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER = 'nextQuarter';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH = 'nextMonth';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK = 'nextWeek';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 = 'M1';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JANUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 = 'M2';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 = 'M3';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MARCH = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 = 'M4';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_APRIL = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 = 'M5';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MAY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 = 'M6';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JUNE = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 = 'M7';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_JULY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 = 'M8';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_AUGUST = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 = 'M9';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 = 'M10';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 = 'M11';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 = 'M12';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12;
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 = 'Q1';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 = 'Q2';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 = 'Q3';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 = 'Q4';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE = 'aboveAverage';
|
||||
const AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE = 'belowAverage';
|
||||
|
||||
private static $_dynamicTypes = array(
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TODAY,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE,
|
||||
);
|
||||
private static $dynamicTypes = array(
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TODAY,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE,
|
||||
self::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE,
|
||||
);
|
||||
|
||||
/*
|
||||
* The only valid filter rule operators for filter and customFilter types are:
|
||||
* <xsd:enumeration value="equal"/>
|
||||
* <xsd:enumeration value="lessThan"/>
|
||||
* <xsd:enumeration value="lessThanOrEqual"/>
|
||||
* <xsd:enumeration value="notEqual"/>
|
||||
* <xsd:enumeration value="greaterThanOrEqual"/>
|
||||
* <xsd:enumeration value="greaterThan"/>
|
||||
*/
|
||||
const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal';
|
||||
const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual';
|
||||
const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan';
|
||||
const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||
const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan';
|
||||
const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||
/*
|
||||
* The only valid filter rule operators for filter and customFilter types are:
|
||||
* <xsd:enumeration value="equal"/>
|
||||
* <xsd:enumeration value="lessThan"/>
|
||||
* <xsd:enumeration value="lessThanOrEqual"/>
|
||||
* <xsd:enumeration value="notEqual"/>
|
||||
* <xsd:enumeration value="greaterThanOrEqual"/>
|
||||
* <xsd:enumeration value="greaterThan"/>
|
||||
*/
|
||||
const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal';
|
||||
const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual';
|
||||
const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan';
|
||||
const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||
const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan';
|
||||
const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||
|
||||
private static $_operators = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_NOTEQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHAN,
|
||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_LESSTHAN,
|
||||
self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
||||
);
|
||||
private static $operators = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_NOTEQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHAN,
|
||||
self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
||||
self::AUTOFILTER_COLUMN_RULE_LESSTHAN,
|
||||
self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
||||
);
|
||||
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent';
|
||||
|
||||
private static $_topTenValue = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
|
||||
);
|
||||
private static $topTenValue = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
|
||||
);
|
||||
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top';
|
||||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom';
|
||||
|
||||
private static $_topTenType = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP,
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM,
|
||||
);
|
||||
private static $topTenType = array(
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP,
|
||||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM,
|
||||
);
|
||||
|
||||
|
||||
/* Rule Operators (Numeric, Boolean etc) */
|
||||
// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2
|
||||
/* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */
|
||||
// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value
|
||||
// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value
|
||||
// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average
|
||||
// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average
|
||||
/* Rule Operators (String) which are set as wild-carded values */
|
||||
// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A*
|
||||
// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z
|
||||
// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B*
|
||||
// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B*
|
||||
/* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */
|
||||
// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan';
|
||||
// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan';
|
||||
// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday';
|
||||
// const AUTOFILTER_COLUMN_RULE_TODAY = 'today';
|
||||
// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // <dynamicFilter val="40909" type="yearToDate" maxVal="41113"/>
|
||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // <dynamicFilter type="M2"/> for Month/February
|
||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // <dynamicFilter type="Q2"/> for Quarter 2
|
||||
/* Rule Operators (Numeric, Boolean etc) */
|
||||
// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2
|
||||
/* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */
|
||||
// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value
|
||||
// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value
|
||||
// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average
|
||||
// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average
|
||||
/* Rule Operators (String) which are set as wild-carded values */
|
||||
// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A*
|
||||
// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z
|
||||
// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B*
|
||||
// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B*
|
||||
/* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */
|
||||
// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan';
|
||||
// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan';
|
||||
// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday';
|
||||
// const AUTOFILTER_COLUMN_RULE_TODAY = 'today';
|
||||
// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter';
|
||||
// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear';
|
||||
// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // <dynamicFilter val="40909" type="yearToDate" maxVal="41113"/>
|
||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // <dynamicFilter type="M2"/> for Month/February
|
||||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // <dynamicFilter type="Q2"/> for Quarter 2
|
||||
|
||||
/**
|
||||
* Autofilter Column
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
private $_parent = NULL;
|
||||
/**
|
||||
* Autofilter Column
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Rule Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_ruleType = self::AUTOFILTER_RULETYPE_FILTER;
|
||||
/**
|
||||
* Autofilter Rule Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ruleType = self::AUTOFILTER_RULETYPE_FILTER;
|
||||
|
||||
|
||||
/**
|
||||
* Autofilter Rule Value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_value = '';
|
||||
/**
|
||||
* Autofilter Rule Value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $value = '';
|
||||
|
||||
/**
|
||||
* Autofilter Rule Operator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_operator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||
/**
|
||||
* Autofilter Rule Operator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||
|
||||
/**
|
||||
* DateTimeGrouping Group Value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_grouping = '';
|
||||
/**
|
||||
* DateTimeGrouping Group Value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $grouping = '';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
|
||||
{
|
||||
$this->_parent = $pParent;
|
||||
}
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
|
||||
{
|
||||
$this->parent = $pParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Rule Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRuleType() {
|
||||
return $this->_ruleType;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Rule Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRuleType()
|
||||
{
|
||||
return $this->ruleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Rule Type
|
||||
*
|
||||
* @param string $pRuleType
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
|
||||
if (!in_array($pRuleType,self::$_ruleTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Rule Type
|
||||
*
|
||||
* @param string $pRuleType
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER)
|
||||
{
|
||||
if (!in_array($pRuleType, self::$ruleTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
|
||||
$this->_ruleType = $pRuleType;
|
||||
$this->ruleType = $pRuleType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Rule Value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->_value;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Rule Value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Rule Value
|
||||
*
|
||||
* @param string|string[] $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setValue($pValue = '') {
|
||||
if (is_array($pValue)) {
|
||||
$grouping = -1;
|
||||
foreach($pValue as $key => $value) {
|
||||
// Validate array entries
|
||||
if (!in_array($key,self::$_dateTimeGroups)) {
|
||||
// Remove any invalid entries from the value array
|
||||
unset($pValue[$key]);
|
||||
} else {
|
||||
// Work out what the dateTime grouping will be
|
||||
$grouping = max($grouping,array_search($key,self::$_dateTimeGroups));
|
||||
}
|
||||
}
|
||||
if (count($pValue) == 0) {
|
||||
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
|
||||
}
|
||||
// Set the dateTime grouping that we've anticipated
|
||||
$this->setGrouping(self::$_dateTimeGroups[$grouping]);
|
||||
}
|
||||
$this->_value = $pValue;
|
||||
/**
|
||||
* Set AutoFilter Rule Value
|
||||
*
|
||||
* @param string|string[] $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setValue($pValue = '')
|
||||
{
|
||||
if (is_array($pValue)) {
|
||||
$grouping = -1;
|
||||
foreach ($pValue as $key => $value) {
|
||||
// Validate array entries
|
||||
if (!in_array($key, self::$dateTimeGroups)) {
|
||||
// Remove any invalid entries from the value array
|
||||
unset($pValue[$key]);
|
||||
} else {
|
||||
// Work out what the dateTime grouping will be
|
||||
$grouping = max($grouping, array_search($key, self::$dateTimeGroups));
|
||||
}
|
||||
}
|
||||
if (count($pValue) == 0) {
|
||||
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
|
||||
}
|
||||
// Set the dateTime grouping that we've anticipated
|
||||
$this->setGrouping(self::$dateTimeGroups[$grouping]);
|
||||
}
|
||||
$this->value = $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Rule Operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator() {
|
||||
return $this->_operator;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Rule Operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Rule Operator
|
||||
*
|
||||
* @param string $pOperator
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||
if (empty($pOperator))
|
||||
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||
if ((!in_array($pOperator,self::$_operators)) &&
|
||||
(!in_array($pOperator,self::$_topTenValue))) {
|
||||
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
|
||||
}
|
||||
$this->_operator = $pOperator;
|
||||
/**
|
||||
* Set AutoFilter Rule Operator
|
||||
*
|
||||
* @param string $pOperator
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL)
|
||||
{
|
||||
if (empty($pOperator)) {
|
||||
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||
}
|
||||
if ((!in_array($pOperator, self::$operators)) &&
|
||||
(!in_array($pOperator, self::$topTenValue))) {
|
||||
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
|
||||
}
|
||||
$this->operator = $pOperator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AutoFilter Rule Grouping
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGrouping() {
|
||||
return $this->_grouping;
|
||||
}
|
||||
/**
|
||||
* Get AutoFilter Rule Grouping
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGrouping()
|
||||
{
|
||||
return $this->grouping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Rule Grouping
|
||||
*
|
||||
* @param string $pGrouping
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setGrouping($pGrouping = NULL) {
|
||||
if (($pGrouping !== NULL) &&
|
||||
(!in_array($pGrouping,self::$_dateTimeGroups)) &&
|
||||
(!in_array($pGrouping,self::$_dynamicTypes)) &&
|
||||
(!in_array($pGrouping,self::$_topTenType))) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Rule Grouping
|
||||
*
|
||||
* @param string $pGrouping
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setGrouping($pGrouping = null)
|
||||
{
|
||||
if (($pGrouping !== null) &&
|
||||
(!in_array($pGrouping, self::$dateTimeGroups)) &&
|
||||
(!in_array($pGrouping, self::$dynamicTypes)) &&
|
||||
(!in_array($pGrouping, self::$topTenType))) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
$this->grouping = $pGrouping;
|
||||
|
||||
$this->_grouping = $pGrouping;
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set AutoFilter Rule
|
||||
*
|
||||
* @param string $pOperator
|
||||
* @param string|string[] $pValue
|
||||
* @param string $pGrouping
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null)
|
||||
{
|
||||
$this->setOperator($pOperator);
|
||||
$this->setValue($pValue);
|
||||
// Only set grouping if it's been passed in as a user-supplied argument,
|
||||
// otherwise we're calculating it when we setValue() and don't want to overwrite that
|
||||
// If the user supplies an argumnet for grouping, then on their own head be it
|
||||
if ($pGrouping !== null) {
|
||||
$this->setGrouping($pGrouping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AutoFilter Rule
|
||||
*
|
||||
* @param string $pOperator
|
||||
* @param string|string[] $pValue
|
||||
* @param string $pGrouping
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
|
||||
$this->setOperator($pOperator);
|
||||
$this->setValue($pValue);
|
||||
// Only set grouping if it's been passed in as a user-supplied argument,
|
||||
// otherwise we're calculating it when we setValue() and don't want to overwrite that
|
||||
// If the user supplies an argumnet for grouping, then on their own head be it
|
||||
if ($pGrouping !== NULL)
|
||||
$this->setGrouping($pGrouping);
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get this Rule's AutoFilter Column Parent
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this Rule's AutoFilter Column Parent
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function getParent() {
|
||||
return $this->_parent;
|
||||
}
|
||||
/**
|
||||
* Set this Rule's AutoFilter Column Parent
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
|
||||
{
|
||||
$this->parent = $pParent;
|
||||
|
||||
/**
|
||||
* Set this Rule's AutoFilter Column Parent
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
|
||||
$this->_parent = $pParent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == '_parent') {
|
||||
// Detach from autofilter column parent
|
||||
$this->$key = NULL;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == 'parent') {
|
||||
// Detach from autofilter column parent
|
||||
$this->$key = null;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_BaseDrawing
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,133 +21,124 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_BaseDrawing
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Image counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private static $_imageCounter = 0;
|
||||
/**
|
||||
* Image counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private static $imageCounter = 0;
|
||||
|
||||
/**
|
||||
* Image index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_imageIndex = 0;
|
||||
/**
|
||||
* Image index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $imageIndex = 0;
|
||||
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name;
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_description;
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $_worksheet;
|
||||
/**
|
||||
* Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $worksheet;
|
||||
|
||||
/**
|
||||
* Coordinates
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_coordinates;
|
||||
/**
|
||||
* Coordinates
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $coordinates;
|
||||
|
||||
/**
|
||||
* Offset X
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetX;
|
||||
/**
|
||||
* Offset X
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $offsetX;
|
||||
|
||||
/**
|
||||
* Offset Y
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetY;
|
||||
/**
|
||||
* Offset Y
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $offsetY;
|
||||
|
||||
/**
|
||||
* Width
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_width;
|
||||
/**
|
||||
* Width
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_height;
|
||||
/**
|
||||
* Height
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Proportional resize
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_resizeProportional;
|
||||
/**
|
||||
* Proportional resize
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $resizeProportional;
|
||||
|
||||
/**
|
||||
* Rotation
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_rotation;
|
||||
/**
|
||||
* Rotation
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $rotation;
|
||||
|
||||
/**
|
||||
* Shadow
|
||||
*
|
||||
* @var PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
protected $_shadow;
|
||||
/**
|
||||
* Shadow
|
||||
*
|
||||
* @var PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
protected $shadow;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_name = '';
|
||||
$this->_description = '';
|
||||
$this->_worksheet = null;
|
||||
$this->_coordinates = 'A1';
|
||||
$this->_offsetX = 0;
|
||||
$this->_offsetY = 0;
|
||||
$this->_width = 0;
|
||||
$this->_height = 0;
|
||||
$this->_resizeProportional = true;
|
||||
$this->_rotation = 0;
|
||||
$this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
||||
// Initialise values
|
||||
$this->name = '';
|
||||
$this->description = '';
|
||||
$this->worksheet = null;
|
||||
$this->coordinates = 'A1';
|
||||
$this->offsetX = 0;
|
||||
$this->offsetY = 0;
|
||||
$this->width = 0;
|
||||
$this->height = 0;
|
||||
$this->resizeProportional = true;
|
||||
$this->rotation = 0;
|
||||
$this->shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
||||
|
||||
// Set image index
|
||||
self::$_imageCounter++;
|
||||
$this->_imageIndex = self::$_imageCounter;
|
||||
// Set image index
|
||||
self::$imageCounter++;
|
||||
$this->imageIndex = self::$imageCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,8 +146,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getImageIndex() {
|
||||
return $this->_imageIndex;
|
||||
public function getImageIndex()
|
||||
{
|
||||
return $this->imageIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,8 +156,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->_name;
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,9 +167,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setName($pValue = '') {
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
public function setName($pValue = '')
|
||||
{
|
||||
$this->name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,8 +178,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->_description;
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,9 +189,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setDescription($pValue = '') {
|
||||
$this->_description = $pValue;
|
||||
return $this;
|
||||
public function setDescription($pValue = '')
|
||||
{
|
||||
$this->description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,44 +200,46 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet() {
|
||||
return $this->_worksheet;
|
||||
public function getWorksheet()
|
||||
{
|
||||
return $this->worksheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Worksheet
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pValue
|
||||
* @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
|
||||
* @throws PHPExcel_Exception
|
||||
* @param PHPExcel_Worksheet $pValue
|
||||
* @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
|
||||
if (is_null($this->_worksheet)) {
|
||||
// Add drawing to PHPExcel_Worksheet
|
||||
$this->_worksheet = $pValue;
|
||||
$this->_worksheet->getCell($this->_coordinates);
|
||||
$this->_worksheet->getDrawingCollection()->append($this);
|
||||
} else {
|
||||
if ($pOverrideOld) {
|
||||
// Remove drawing from old PHPExcel_Worksheet
|
||||
$iterator = $this->_worksheet->getDrawingCollection()->getIterator();
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
|
||||
{
|
||||
if (is_null($this->worksheet)) {
|
||||
// Add drawing to PHPExcel_Worksheet
|
||||
$this->worksheet = $pValue;
|
||||
$this->worksheet->getCell($this->coordinates);
|
||||
$this->worksheet->getDrawingCollection()->append($this);
|
||||
} else {
|
||||
if ($pOverrideOld) {
|
||||
// Remove drawing from old PHPExcel_Worksheet
|
||||
$iterator = $this->worksheet->getDrawingCollection()->getIterator();
|
||||
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
||||
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
|
||||
$this->_worksheet = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
||||
$this->worksheet->getDrawingCollection()->offsetUnset($iterator->key());
|
||||
$this->worksheet = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set new PHPExcel_Worksheet
|
||||
$this->setWorksheet($pValue);
|
||||
} else {
|
||||
throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
// Set new PHPExcel_Worksheet
|
||||
$this->setWorksheet($pValue);
|
||||
} else {
|
||||
throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,8 +247,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCoordinates() {
|
||||
return $this->_coordinates;
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,9 +258,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setCoordinates($pValue = 'A1') {
|
||||
$this->_coordinates = $pValue;
|
||||
return $this;
|
||||
public function setCoordinates($pValue = 'A1')
|
||||
{
|
||||
$this->coordinates = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,8 +269,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetX() {
|
||||
return $this->_offsetX;
|
||||
public function getOffsetX()
|
||||
{
|
||||
return $this->offsetX;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,9 +280,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setOffsetX($pValue = 0) {
|
||||
$this->_offsetX = $pValue;
|
||||
return $this;
|
||||
public function setOffsetX($pValue = 0)
|
||||
{
|
||||
$this->offsetX = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,8 +291,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetY() {
|
||||
return $this->_offsetY;
|
||||
public function getOffsetY()
|
||||
{
|
||||
return $this->offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,9 +302,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setOffsetY($pValue = 0) {
|
||||
$this->_offsetY = $pValue;
|
||||
return $this;
|
||||
public function setOffsetY($pValue = 0)
|
||||
{
|
||||
$this->offsetY = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,8 +313,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,17 +324,18 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWidth($pValue = 0) {
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
|
||||
$this->_height = round($ratio * $pValue);
|
||||
}
|
||||
public function setWidth($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->height / ($this->width != 0 ? $this->width : 1);
|
||||
$this->height = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set width
|
||||
$this->_width = $pValue;
|
||||
// Set width
|
||||
$this->width = $pValue;
|
||||
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,8 +343,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->_height;
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,58 +354,61 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setHeight($pValue = 0) {
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
|
||||
$this->_width = round($ratio * $pValue);
|
||||
}
|
||||
public function setHeight($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->width / ($this->height != 0 ? $this->height : 1);
|
||||
$this->width = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set height
|
||||
$this->_height = $pValue;
|
||||
// Set height
|
||||
$this->height = $pValue;
|
||||
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set width and height with proportional resize
|
||||
* Example:
|
||||
* <code>
|
||||
* $objDrawing->setResizeProportional(true);
|
||||
* $objDrawing->setWidthAndHeight(160,120);
|
||||
* </code>
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* $objDrawing->setResizeProportional(true);
|
||||
* $objDrawing->setWidthAndHeight(160,120);
|
||||
* </code>
|
||||
*
|
||||
* @author Vincent@luo MSN:kele_100@hotmail.com
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
|
||||
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
|
||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->_height) < $height) {
|
||||
$this->_height = ceil($xratio * $this->_height);
|
||||
$this->_width = $width;
|
||||
} else {
|
||||
$this->_width = ceil($yratio * $this->_width);
|
||||
$this->_height = $height;
|
||||
}
|
||||
} else {
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
public function setWidthAndHeight($width = 0, $height = 0)
|
||||
{
|
||||
$xratio = $width / ($this->width != 0 ? $this->width : 1);
|
||||
$yratio = $height / ($this->height != 0 ? $this->height : 1);
|
||||
if ($this->resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->height) < $height) {
|
||||
$this->height = ceil($xratio * $this->height);
|
||||
$this->width = $width;
|
||||
} else {
|
||||
$this->width = ceil($yratio * $this->width);
|
||||
$this->height = $height;
|
||||
}
|
||||
} else {
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ResizeProportional
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getResizeProportional() {
|
||||
return $this->_resizeProportional;
|
||||
public function getResizeProportional()
|
||||
{
|
||||
return $this->resizeProportional;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,9 +417,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setResizeProportional($pValue = true) {
|
||||
$this->_resizeProportional = $pValue;
|
||||
return $this;
|
||||
public function setResizeProportional($pValue = true)
|
||||
{
|
||||
$this->resizeProportional = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,8 +428,9 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRotation() {
|
||||
return $this->_rotation;
|
||||
public function getRotation()
|
||||
{
|
||||
return $this->rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,9 +439,10 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setRotation($pValue = 0) {
|
||||
$this->_rotation = $pValue;
|
||||
return $this;
|
||||
public function setRotation($pValue = 0)
|
||||
{
|
||||
$this->rotation = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,54 +450,58 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function getShadow() {
|
||||
return $this->_shadow;
|
||||
public function getShadow()
|
||||
{
|
||||
return $this->shadow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow
|
||||
*
|
||||
* @param PHPExcel_Worksheet_Drawing_Shadow $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @param PHPExcel_Worksheet_Drawing_Shadow $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
|
||||
$this->_shadow = $pValue;
|
||||
return $this;
|
||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
|
||||
{
|
||||
$this->shadow = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_name
|
||||
. $this->_description
|
||||
. $this->_worksheet->getHashCode()
|
||||
. $this->_coordinates
|
||||
. $this->_offsetX
|
||||
. $this->_offsetY
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. $this->_rotation
|
||||
. $this->_shadow->getHashCode()
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->name .
|
||||
$this->description .
|
||||
$this->worksheet->getHashCode() .
|
||||
$this->coordinates .
|
||||
$this->offsetX .
|
||||
$this->offsetY .
|
||||
$this->width .
|
||||
$this->height .
|
||||
$this->rotation .
|
||||
$this->shadow->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_CellIterator
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,75 +21,67 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_CellIterator
|
||||
*
|
||||
* Used to iterate rows in a PHPExcel_Worksheet
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
abstract class PHPExcel_Worksheet_CellIterator
|
||||
{
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $_subject;
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $subject;
|
||||
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_position = null;
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $position = null;
|
||||
|
||||
/**
|
||||
* Iterate only existing cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_onlyExistingCells = false;
|
||||
/**
|
||||
* Iterate only existing cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $onlyExistingCells = false;
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get loop only existing cells
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIterateOnlyExistingCells() {
|
||||
return $this->_onlyExistingCells;
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
/**
|
||||
* Get loop only existing cells
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIterateOnlyExistingCells()
|
||||
{
|
||||
return $this->onlyExistingCells;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
abstract protected function adjustForExistingOnlyRange();
|
||||
|
||||
/**
|
||||
* Set the iterator to loop only existing cells
|
||||
*
|
||||
* @param boolean $value
|
||||
/**
|
||||
* Set the iterator to loop only existing cells
|
||||
*
|
||||
* @param boolean $value
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function setIterateOnlyExistingCells($value = true) {
|
||||
$this->_onlyExistingCells = (boolean) $value;
|
||||
*/
|
||||
public function setIterateOnlyExistingCells($value = true)
|
||||
{
|
||||
$this->onlyExistingCells = (boolean) $value;
|
||||
|
||||
$this->adjustForExistingOnlyRange();
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_Column
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,73 +21,66 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_Column
|
||||
*
|
||||
* Represents a column in PHPExcel_Worksheet, used by PHPExcel_Worksheet_ColumnIterator
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Column
|
||||
{
|
||||
/**
|
||||
* PHPExcel_Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_parent;
|
||||
/**
|
||||
* PHPExcel_Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_columnIndex;
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $columnIndex;
|
||||
|
||||
/**
|
||||
* Create a new column
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent
|
||||
* @param string $columnIndex
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent = null, $columnIndex = 'A') {
|
||||
// Set parent and column index
|
||||
$this->_parent = $parent;
|
||||
$this->_columnIndex = $columnIndex;
|
||||
}
|
||||
/**
|
||||
* Create a new column
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent
|
||||
* @param string $columnIndex
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent = null, $columnIndex = 'A')
|
||||
{
|
||||
// Set parent and column index
|
||||
$this->parent = $parent;
|
||||
$this->columnIndex = $columnIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_parent);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getColumnIndex() {
|
||||
return $this->_columnIndex;
|
||||
}
|
||||
/**
|
||||
* Get column index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnIndex()
|
||||
{
|
||||
return $this->columnIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell iterator
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_CellIterator
|
||||
*/
|
||||
public function getCellIterator($startRow = 1, $endRow = null) {
|
||||
return new PHPExcel_Worksheet_ColumnCellIterator($this->_parent, $this->_columnIndex, $startRow, $endRow);
|
||||
}
|
||||
/**
|
||||
* Get cell iterator
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_CellIterator
|
||||
*/
|
||||
public function getCellIterator($startRow = 1, $endRow = null)
|
||||
{
|
||||
return new PHPExcel_Worksheet_ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_ColumnCellIterator
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,197 +20,197 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_ColumnCellIterator
|
||||
*
|
||||
* Used to iterate columns in a PHPExcel_Worksheet
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_ColumnCellIterator extends PHPExcel_Worksheet_CellIterator implements Iterator
|
||||
{
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_columnIndex;
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $columnIndex;
|
||||
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_startRow = 1;
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $startRow = 1;
|
||||
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_endRow = 1;
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $endRow = 1;
|
||||
|
||||
/**
|
||||
* Create a new row iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
/**
|
||||
* Create a new row iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param string $columnIndex The column that we want to iterate
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $columnIndex, $startRow = 1, $endRow = null) {
|
||||
// Set subject
|
||||
$this->_subject = $subject;
|
||||
$this->_columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1;
|
||||
$this->resetEnd($endRow);
|
||||
$this->resetStart($startRow);
|
||||
}
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null)
|
||||
{
|
||||
// Set subject
|
||||
$this->subject = $subject;
|
||||
$this->columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1;
|
||||
$this->resetEnd($endRow);
|
||||
$this->resetStart($startRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_subject);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the start row and the current row pointer
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
/**
|
||||
* (Re)Set the start row and the current row pointer
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @return PHPExcel_Worksheet_ColumnCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function resetStart($startRow = 1) {
|
||||
$this->_startRow = $startRow;
|
||||
*/
|
||||
public function resetStart($startRow = 1)
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
$this->adjustForExistingOnlyRange();
|
||||
$this->seek($startRow);
|
||||
$this->seek($startRow);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the end row
|
||||
*
|
||||
* @param integer $endRow The row number at which to stop iterating
|
||||
/**
|
||||
* (Re)Set the end row
|
||||
*
|
||||
* @param integer $endRow The row number at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_ColumnCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function resetEnd($endRow = null) {
|
||||
$this->_endRow = ($endRow) ? $endRow : $this->_subject->getHighestRow();
|
||||
*/
|
||||
public function resetEnd($endRow = null)
|
||||
{
|
||||
$this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow();
|
||||
$this->adjustForExistingOnlyRange();
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the row pointer to the selected row
|
||||
*
|
||||
* @param integer $row The row number to set the current pointer at
|
||||
/**
|
||||
* Set the row pointer to the selected row
|
||||
*
|
||||
* @param integer $row The row number to set the current pointer at
|
||||
* @return PHPExcel_Worksheet_ColumnCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($row = 1) {
|
||||
if (($row < $this->_startRow) || ($row > $this->_endRow)) {
|
||||
throw new PHPExcel_Exception("Row $row is out of range ({$this->_startRow} - {$this->_endRow})");
|
||||
} elseif ($this->_onlyExistingCells && !($this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $row))) {
|
||||
*/
|
||||
public function seek($row = 1)
|
||||
{
|
||||
if (($row < $this->startRow) || ($row > $this->endRow)) {
|
||||
throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
|
||||
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) {
|
||||
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
|
||||
}
|
||||
$this->_position = $row;
|
||||
$this->position = $row;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting row
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = $this->_startRow;
|
||||
}
|
||||
/**
|
||||
* Rewind the iterator to the starting row
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = $this->startRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current cell in this worksheet column
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Row
|
||||
*/
|
||||
public function current() {
|
||||
return $this->_subject->getCellByColumnAndRow($this->_columnIndex, $this->_position);
|
||||
}
|
||||
/**
|
||||
* Return the current cell in this worksheet column
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Row
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->subject->getCellByColumnAndRow($this->columnIndex, $this->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function key() {
|
||||
return $this->_position;
|
||||
}
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next() {
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
do {
|
||||
++$this->_position;
|
||||
} while (($this->_onlyExistingCells) &&
|
||||
(!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_position)) &&
|
||||
($this->_position <= $this->_endRow));
|
||||
}
|
||||
++$this->position;
|
||||
} while (($this->onlyExistingCells) &&
|
||||
(!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) &&
|
||||
($this->position <= $this->endRow));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*/
|
||||
public function prev() {
|
||||
if ($this->_position <= $this->_startRow) {
|
||||
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->_startRow} - {$this->_endRow})");
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*/
|
||||
public function prev()
|
||||
{
|
||||
if ($this->position <= $this->startRow) {
|
||||
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
|
||||
}
|
||||
|
||||
do {
|
||||
--$this->_position;
|
||||
} while (($this->_onlyExistingCells) &&
|
||||
(!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_position)) &&
|
||||
($this->_position >= $this->_startRow));
|
||||
}
|
||||
--$this->position;
|
||||
} while (($this->onlyExistingCells) &&
|
||||
(!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) &&
|
||||
($this->position >= $this->startRow));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if more rows exist in the worksheet range of rows that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->_position <= $this->_endRow;
|
||||
}
|
||||
/**
|
||||
* Indicate if more rows exist in the worksheet range of rows that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return $this->position <= $this->endRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function adjustForExistingOnlyRange() {
|
||||
if ($this->_onlyExistingCells) {
|
||||
while ((!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_startRow)) &&
|
||||
($this->_startRow <= $this->_endRow)) {
|
||||
++$this->_startRow;
|
||||
*/
|
||||
protected function adjustForExistingOnlyRange()
|
||||
{
|
||||
if ($this->onlyExistingCells) {
|
||||
while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) &&
|
||||
($this->startRow <= $this->endRow)) {
|
||||
++$this->startRow;
|
||||
}
|
||||
if ($this->_startRow > $this->_endRow) {
|
||||
if ($this->startRow > $this->endRow) {
|
||||
throw new PHPExcel_Exception('No cells exist within the specified range');
|
||||
}
|
||||
while ((!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_endRow)) &&
|
||||
($this->_endRow >= $this->_startRow)) {
|
||||
--$this->_endRow;
|
||||
while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) &&
|
||||
($this->endRow >= $this->startRow)) {
|
||||
--$this->endRow;
|
||||
}
|
||||
if ($this->_endRow < $this->_startRow) {
|
||||
if ($this->endRow < $this->startRow) {
|
||||
throw new PHPExcel_Exception('No cells exist within the specified range');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_ColumnDimension
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,71 +21,34 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_ColumnDimension
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_ColumnDimension
|
||||
class PHPExcel_Worksheet_ColumnDimension extends PHPExcel_Worksheet_Dimension
|
||||
{
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_columnIndex;
|
||||
/**
|
||||
* Column index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $columnIndex;
|
||||
|
||||
/**
|
||||
* Column width
|
||||
*
|
||||
* When this is set to a negative value, the column width should be ignored by IWriter
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_width = -1;
|
||||
/**
|
||||
* Column width
|
||||
*
|
||||
* When this is set to a negative value, the column width should be ignored by IWriter
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $width = -1;
|
||||
|
||||
/**
|
||||
* Auto size?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_autoSize = false;
|
||||
|
||||
/**
|
||||
* Visible?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_visible = true;
|
||||
|
||||
/**
|
||||
* Outline level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_outlineLevel = 0;
|
||||
|
||||
/**
|
||||
* Collapsed
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_collapsed = false;
|
||||
|
||||
/**
|
||||
* Index to cellXf
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_xfIndex;
|
||||
/**
|
||||
* Auto size?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $autoSize = false;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_ColumnDimension
|
||||
@@ -93,11 +57,11 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function __construct($pIndex = 'A')
|
||||
{
|
||||
// Initialise values
|
||||
$this->_columnIndex = $pIndex;
|
||||
// Initialise values
|
||||
$this->columnIndex = $pIndex;
|
||||
|
||||
// set default index to cellXf
|
||||
$this->_xfIndex = 0;
|
||||
// set dimension as unformatted by default
|
||||
parent::__construct(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,8 +69,9 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnIndex() {
|
||||
return $this->_columnIndex;
|
||||
public function getColumnIndex()
|
||||
{
|
||||
return $this->columnIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +80,10 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setColumnIndex($pValue) {
|
||||
$this->_columnIndex = $pValue;
|
||||
return $this;
|
||||
public function setColumnIndex($pValue)
|
||||
{
|
||||
$this->columnIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,8 +91,9 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,9 +102,10 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setWidth($pValue = -1) {
|
||||
$this->_width = $pValue;
|
||||
return $this;
|
||||
public function setWidth($pValue = -1)
|
||||
{
|
||||
$this->width = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,8 +113,9 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAutoSize() {
|
||||
return $this->_autoSize;
|
||||
public function getAutoSize()
|
||||
{
|
||||
return $this->autoSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,112 +124,9 @@ class PHPExcel_Worksheet_ColumnDimension
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setAutoSize($pValue = false) {
|
||||
$this->_autoSize = $pValue;
|
||||
return $this;
|
||||
public function setAutoSize($pValue = false)
|
||||
{
|
||||
$this->autoSize = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Visible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible() {
|
||||
return $this->_visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Visible
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setVisible($pValue = true) {
|
||||
$this->_visible = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Outline Level
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOutlineLevel() {
|
||||
return $this->_outlineLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Outline Level
|
||||
*
|
||||
* Value must be between 0 and 7
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setOutlineLevel($pValue) {
|
||||
if ($pValue < 0 || $pValue > 7) {
|
||||
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
|
||||
}
|
||||
|
||||
$this->_outlineLevel = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collapsed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getCollapsed() {
|
||||
return $this->_collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Collapsed
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setCollapsed($pValue = true) {
|
||||
$this->_collapsed = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index to cellXf
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getXfIndex()
|
||||
{
|
||||
return $this->_xfIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set index to cellXf
|
||||
*
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_ColumnDimension
|
||||
*/
|
||||
public function setXfIndex($pValue = 0)
|
||||
{
|
||||
$this->_xfIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_ColumnIterator
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,174 +20,182 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_ColumnIterator
|
||||
*
|
||||
* Used to iterate columns in a PHPExcel_Worksheet
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_ColumnIterator implements Iterator
|
||||
{
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_subject;
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $subject;
|
||||
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_position = 0;
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $position = 0;
|
||||
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_startColumn = 0;
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $startColumn = 0;
|
||||
|
||||
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_endColumn = 0;
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $endColumn = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new column iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $startColumn = 'A', $endColumn = null) {
|
||||
// Set subject
|
||||
$this->_subject = $subject;
|
||||
$this->resetEnd($endColumn);
|
||||
$this->resetStart($startColumn);
|
||||
}
|
||||
/**
|
||||
* Create a new column iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $startColumn = 'A', $endColumn = null)
|
||||
{
|
||||
// Set subject
|
||||
$this->subject = $subject;
|
||||
$this->resetEnd($endColumn);
|
||||
$this->resetStart($startColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_subject);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the start column and the current column pointer
|
||||
*
|
||||
* @param integer $startColumn The column address at which to start iterating
|
||||
* @return PHPExcel_Worksheet_ColumnIterator
|
||||
*/
|
||||
public function resetStart($startColumn = 'A') {
|
||||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
|
||||
$this->_startColumn = $startColumnIndex;
|
||||
$this->seek($startColumn);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the end column
|
||||
*
|
||||
* @param string $endColumn The column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_ColumnIterator
|
||||
*/
|
||||
public function resetEnd($endColumn = null) {
|
||||
$endColumn = ($endColumn) ? $endColumn : $this->_subject->getHighestColumn();
|
||||
$this->_endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the column pointer to the selected column
|
||||
*
|
||||
* @param string $column The column address to set the current pointer at
|
||||
/**
|
||||
* (Re)Set the start column and the current column pointer
|
||||
*
|
||||
* @param integer $startColumn The column address at which to start iterating
|
||||
* @return PHPExcel_Worksheet_ColumnIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($column = 'A') {
|
||||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
if (($column < $this->_startColumn) || ($column > $this->_endColumn)) {
|
||||
throw new PHPExcel_Exception("Column $column is out of range ({$this->_startColumn} - {$this->_endColumn})");
|
||||
*/
|
||||
public function resetStart($startColumn = 'A')
|
||||
{
|
||||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
|
||||
if ($startColumnIndex > PHPExcel_Cell::columnIndexFromString($this->subject->getHighestColumn()) - 1) {
|
||||
throw new PHPExcel_Exception("Start column ({$startColumn}) is beyond highest column ({$this->subject->getHighestColumn()})");
|
||||
}
|
||||
$this->_position = $column;
|
||||
|
||||
$this->startColumn = $startColumnIndex;
|
||||
if ($this->endColumn < $this->startColumn) {
|
||||
$this->endColumn = $this->startColumn;
|
||||
}
|
||||
$this->seek($startColumn);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting column
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = $this->_startColumn;
|
||||
}
|
||||
/**
|
||||
* (Re)Set the end column
|
||||
*
|
||||
* @param string $endColumn The column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_ColumnIterator
|
||||
*/
|
||||
public function resetEnd($endColumn = null)
|
||||
{
|
||||
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
|
||||
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
|
||||
|
||||
/**
|
||||
* Return the current column in this worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Column
|
||||
*/
|
||||
public function current() {
|
||||
return new PHPExcel_Worksheet_Column($this->_subject, PHPExcel_Cell::stringFromColumnIndex($this->_position));
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function key() {
|
||||
return PHPExcel_Cell::stringFromColumnIndex($this->_position);
|
||||
}
|
||||
/**
|
||||
* Set the column pointer to the selected column
|
||||
*
|
||||
* @param string $column The column address to set the current pointer at
|
||||
* @return PHPExcel_Worksheet_ColumnIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($column = 'A')
|
||||
{
|
||||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
if (($column < $this->startColumn) || ($column > $this->endColumn)) {
|
||||
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
|
||||
}
|
||||
$this->position = $column;
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next() {
|
||||
++$this->_position;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
/**
|
||||
* Rewind the iterator to the starting column
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = $this->startColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current column in this worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Column
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return new PHPExcel_Worksheet_Column($this->subject, PHPExcel_Cell::stringFromColumnIndex($this->position));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return PHPExcel_Cell::stringFromColumnIndex($this->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
++$this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function prev() {
|
||||
if ($this->_position <= $this->_startColumn) {
|
||||
*/
|
||||
public function prev()
|
||||
{
|
||||
if ($this->position <= $this->startColumn) {
|
||||
throw new PHPExcel_Exception(
|
||||
"Column is already at the beginning of range (" .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . " - " .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . ")"
|
||||
"Column is already at the beginning of range (" .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")"
|
||||
);
|
||||
}
|
||||
|
||||
--$this->_position;
|
||||
}
|
||||
--$this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if more columns exist in the worksheet range of columns that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->_position <= $this->_endColumn;
|
||||
}
|
||||
/**
|
||||
* Indicate if more columns exist in the worksheet range of columns that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return $this->position <= $this->endColumn;
|
||||
}
|
||||
}
|
||||
|
178
vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Dimension.php
vendored
Normal file
178
vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Dimension.php
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_Dimension
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
abstract class PHPExcel_Worksheet_Dimension
|
||||
{
|
||||
/**
|
||||
* Visible?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $visible = true;
|
||||
|
||||
/**
|
||||
* Outline level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $outlineLevel = 0;
|
||||
|
||||
/**
|
||||
* Collapsed
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $collapsed = false;
|
||||
|
||||
/**
|
||||
* Index to cellXf. Null value means row has no explicit cellXf format.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
private $xfIndex;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_Dimension
|
||||
*
|
||||
* @param int $pIndex Numeric row index
|
||||
*/
|
||||
public function __construct($initialValue = null)
|
||||
{
|
||||
// set dimension as unformatted by default
|
||||
$this->xfIndex = $initialValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Visible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible()
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Visible
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_Dimension
|
||||
*/
|
||||
public function setVisible($pValue = true)
|
||||
{
|
||||
$this->visible = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Outline Level
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOutlineLevel()
|
||||
{
|
||||
return $this->outlineLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Outline Level
|
||||
*
|
||||
* Value must be between 0 and 7
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_Dimension
|
||||
*/
|
||||
public function setOutlineLevel($pValue)
|
||||
{
|
||||
if ($pValue < 0 || $pValue > 7) {
|
||||
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
|
||||
}
|
||||
|
||||
$this->outlineLevel = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collapsed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getCollapsed()
|
||||
{
|
||||
return $this->collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Collapsed
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_Dimension
|
||||
*/
|
||||
public function setCollapsed($pValue = true)
|
||||
{
|
||||
$this->collapsed = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index to cellXf
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getXfIndex()
|
||||
{
|
||||
return $this->xfIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set index to cellXf
|
||||
*
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Dimension
|
||||
*/
|
||||
public function setXfIndex($pValue = 0)
|
||||
{
|
||||
$this->xfIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,38 +21,29 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet_Drawing
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet_Drawing
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_path;
|
||||
/**
|
||||
* Path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_Drawing
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_path = '';
|
||||
// Initialise values
|
||||
$this->path = '';
|
||||
|
||||
// Initialize parent
|
||||
parent::__construct();
|
||||
// Initialize parent
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,8 +51,9 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename() {
|
||||
return basename($this->_path);
|
||||
public function getFilename()
|
||||
{
|
||||
return basename($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,10 +61,11 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIndexedFilename() {
|
||||
$fileName = $this->getFilename();
|
||||
$fileName = str_replace(' ', '_', $fileName);
|
||||
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
|
||||
public function getIndexedFilename()
|
||||
{
|
||||
$fileName = $this->getFilename();
|
||||
$fileName = str_replace(' ', '_', $fileName);
|
||||
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,9 +73,10 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension() {
|
||||
$exploded = explode(".", basename($this->_path));
|
||||
return $exploded[count($exploded) - 1];
|
||||
public function getExtension()
|
||||
{
|
||||
$exploded = explode(".", basename($this->path));
|
||||
return $exploded[count($exploded) - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,60 +84,64 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
return $this->_path;
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Path
|
||||
*
|
||||
* @param string $pValue File path
|
||||
* @param boolean $pVerifyFile Verify file
|
||||
* @throws PHPExcel_Exception
|
||||
* @param string $pValue File path
|
||||
* @param boolean $pVerifyFile Verify file
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_Drawing
|
||||
*/
|
||||
public function setPath($pValue = '', $pVerifyFile = true) {
|
||||
if ($pVerifyFile) {
|
||||
if (file_exists($pValue)) {
|
||||
$this->_path = $pValue;
|
||||
public function setPath($pValue = '', $pVerifyFile = true)
|
||||
{
|
||||
if ($pVerifyFile) {
|
||||
if (file_exists($pValue)) {
|
||||
$this->path = $pValue;
|
||||
|
||||
if ($this->_width == 0 && $this->_height == 0) {
|
||||
// Get width/height
|
||||
list($this->_width, $this->_height) = getimagesize($pValue);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("File $pValue not found!");
|
||||
}
|
||||
} else {
|
||||
$this->_path = $pValue;
|
||||
}
|
||||
return $this;
|
||||
if ($this->width == 0 && $this->height == 0) {
|
||||
// Get width/height
|
||||
list($this->width, $this->height) = getimagesize($pValue);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("File $pValue not found!");
|
||||
}
|
||||
} else {
|
||||
$this->path = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_path
|
||||
. parent::getHashCode()
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->path .
|
||||
parent::getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_Drawing_Shadow
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,97 +21,88 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet_Drawing
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_Drawing_Shadow
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet_Drawing
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
{
|
||||
/* Shadow alignment */
|
||||
const SHADOW_BOTTOM = 'b';
|
||||
const SHADOW_BOTTOM_LEFT = 'bl';
|
||||
const SHADOW_BOTTOM_RIGHT = 'br';
|
||||
const SHADOW_CENTER = 'ctr';
|
||||
const SHADOW_LEFT = 'l';
|
||||
const SHADOW_TOP = 't';
|
||||
const SHADOW_TOP_LEFT = 'tl';
|
||||
const SHADOW_TOP_RIGHT = 'tr';
|
||||
/* Shadow alignment */
|
||||
const SHADOW_BOTTOM = 'b';
|
||||
const SHADOW_BOTTOM_LEFT = 'bl';
|
||||
const SHADOW_BOTTOM_RIGHT = 'br';
|
||||
const SHADOW_CENTER = 'ctr';
|
||||
const SHADOW_LEFT = 'l';
|
||||
const SHADOW_TOP = 't';
|
||||
const SHADOW_TOP_LEFT = 'tl';
|
||||
const SHADOW_TOP_RIGHT = 'tr';
|
||||
|
||||
/**
|
||||
* Visible
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_visible;
|
||||
/**
|
||||
* Visible
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $visible;
|
||||
|
||||
/**
|
||||
* Blur radius
|
||||
*
|
||||
* Defaults to 6
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_blurRadius;
|
||||
/**
|
||||
* Blur radius
|
||||
*
|
||||
* Defaults to 6
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $blurRadius;
|
||||
|
||||
/**
|
||||
* Shadow distance
|
||||
*
|
||||
* Defaults to 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_distance;
|
||||
/**
|
||||
* Shadow distance
|
||||
*
|
||||
* Defaults to 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $distance;
|
||||
|
||||
/**
|
||||
* Shadow direction (in degrees)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_direction;
|
||||
/**
|
||||
* Shadow direction (in degrees)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $direction;
|
||||
|
||||
/**
|
||||
* Shadow alignment
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_alignment;
|
||||
/**
|
||||
* Shadow alignment
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $alignment;
|
||||
|
||||
/**
|
||||
* Color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
private $_color;
|
||||
/**
|
||||
* Color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
private $color;
|
||||
|
||||
/**
|
||||
* Alpha
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_alpha;
|
||||
/**
|
||||
* Alpha
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $alpha;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_visible = false;
|
||||
$this->_blurRadius = 6;
|
||||
$this->_distance = 2;
|
||||
$this->_direction = 0;
|
||||
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
|
||||
$this->_alpha = 50;
|
||||
// Initialise values
|
||||
$this->visible = false;
|
||||
$this->blurRadius = 6;
|
||||
$this->distance = 2;
|
||||
$this->direction = 0;
|
||||
$this->alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
|
||||
$this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
|
||||
$this->alpha = 50;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,8 +110,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getVisible() {
|
||||
return $this->_visible;
|
||||
public function getVisible()
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,9 +121,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setVisible($pValue = false) {
|
||||
$this->_visible = $pValue;
|
||||
return $this;
|
||||
public function setVisible($pValue = false)
|
||||
{
|
||||
$this->visible = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,8 +132,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBlurRadius() {
|
||||
return $this->_blurRadius;
|
||||
public function getBlurRadius()
|
||||
{
|
||||
return $this->blurRadius;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,9 +143,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setBlurRadius($pValue = 6) {
|
||||
$this->_blurRadius = $pValue;
|
||||
return $this;
|
||||
public function setBlurRadius($pValue = 6)
|
||||
{
|
||||
$this->blurRadius = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,8 +154,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDistance() {
|
||||
return $this->_distance;
|
||||
public function getDistance()
|
||||
{
|
||||
return $this->distance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,9 +165,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setDistance($pValue = 2) {
|
||||
$this->_distance = $pValue;
|
||||
return $this;
|
||||
public function setDistance($pValue = 2)
|
||||
{
|
||||
$this->distance = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,8 +176,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDirection() {
|
||||
return $this->_direction;
|
||||
public function getDirection()
|
||||
{
|
||||
return $this->direction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,9 +187,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setDirection($pValue = 0) {
|
||||
$this->_direction = $pValue;
|
||||
return $this;
|
||||
public function setDirection($pValue = 0)
|
||||
{
|
||||
$this->direction = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,8 +198,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAlignment() {
|
||||
return $this->_alignment;
|
||||
public function getAlignment()
|
||||
{
|
||||
return $this->alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,9 +209,10 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setAlignment($pValue = 0) {
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
public function setAlignment($pValue = 0)
|
||||
{
|
||||
$this->alignment = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,20 +220,22 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getColor() {
|
||||
return $this->_color;
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Color
|
||||
*
|
||||
* @param PHPExcel_Style_Color $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @param PHPExcel_Style_Color $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null) {
|
||||
$this->_color = $pValue;
|
||||
return $this;
|
||||
public function setColor(PHPExcel_Style_Color $pValue = null)
|
||||
{
|
||||
$this->color = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,8 +243,9 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAlpha() {
|
||||
return $this->_alpha;
|
||||
public function getAlpha()
|
||||
{
|
||||
return $this->alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,40 +254,43 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function setAlpha($pValue = 0) {
|
||||
$this->_alpha = $pValue;
|
||||
return $this;
|
||||
public function setAlpha($pValue = 0)
|
||||
{
|
||||
$this->alpha = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
($this->_visible ? 't' : 'f')
|
||||
. $this->_blurRadius
|
||||
. $this->_distance
|
||||
. $this->_direction
|
||||
. $this->_alignment
|
||||
. $this->_color->getHashCode()
|
||||
. $this->_alpha
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
($this->visible ? 't' : 'f') .
|
||||
$this->blurRadius .
|
||||
$this->distance .
|
||||
$this->direction .
|
||||
$this->alignment .
|
||||
$this->color->getHashCode() .
|
||||
$this->alpha .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -15,19 +15,14 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* License along with this library; if not,241 write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* <code>
|
||||
* Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference, page 1970:
|
||||
@@ -37,7 +32,7 @@
|
||||
*
|
||||
* Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on
|
||||
* the second line (center section).
|
||||
* &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
|
||||
* &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
|
||||
*
|
||||
* General Rules:
|
||||
* There is no required order in which these codes must appear.
|
||||
@@ -89,96 +84,93 @@
|
||||
* &H - code for "shadow style"
|
||||
* </code>
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_HeaderFooter
|
||||
{
|
||||
/* Header/footer image location */
|
||||
const IMAGE_HEADER_LEFT = 'LH';
|
||||
const IMAGE_HEADER_CENTER = 'CH';
|
||||
const IMAGE_HEADER_RIGHT = 'RH';
|
||||
const IMAGE_FOOTER_LEFT = 'LF';
|
||||
const IMAGE_FOOTER_CENTER = 'CF';
|
||||
const IMAGE_FOOTER_RIGHT = 'RF';
|
||||
/* Header/footer image location */
|
||||
const IMAGE_HEADER_LEFT = 'LH';
|
||||
const IMAGE_HEADER_CENTER = 'CH';
|
||||
const IMAGE_HEADER_RIGHT = 'RH';
|
||||
const IMAGE_FOOTER_LEFT = 'LF';
|
||||
const IMAGE_FOOTER_CENTER = 'CF';
|
||||
const IMAGE_FOOTER_RIGHT = 'RF';
|
||||
|
||||
/**
|
||||
* OddHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_oddHeader = '';
|
||||
/**
|
||||
* OddHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $oddHeader = '';
|
||||
|
||||
/**
|
||||
* OddFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_oddFooter = '';
|
||||
/**
|
||||
* OddFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $oddFooter = '';
|
||||
|
||||
/**
|
||||
* EvenHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_evenHeader = '';
|
||||
/**
|
||||
* EvenHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $evenHeader = '';
|
||||
|
||||
/**
|
||||
* EvenFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_evenFooter = '';
|
||||
/**
|
||||
* EvenFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $evenFooter = '';
|
||||
|
||||
/**
|
||||
* FirstHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_firstHeader = '';
|
||||
/**
|
||||
* FirstHeader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $firstHeader = '';
|
||||
|
||||
/**
|
||||
* FirstFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_firstFooter = '';
|
||||
/**
|
||||
* FirstFooter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $firstFooter = '';
|
||||
|
||||
/**
|
||||
* Different header for Odd/Even, defaults to false
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_differentOddEven = false;
|
||||
/**
|
||||
* Different header for Odd/Even, defaults to false
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $differentOddEven = false;
|
||||
|
||||
/**
|
||||
* Different header for first page, defaults to false
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_differentFirst = false;
|
||||
/**
|
||||
* Different header for first page, defaults to false
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $differentFirst = false;
|
||||
|
||||
/**
|
||||
* Scale with document, defaults to true
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_scaleWithDocument = true;
|
||||
/**
|
||||
* Scale with document, defaults to true
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $scaleWithDocument = true;
|
||||
|
||||
/**
|
||||
* Align with margins, defaults to true
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_alignWithMargins = true;
|
||||
/**
|
||||
* Align with margins, defaults to true
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $alignWithMargins = true;
|
||||
|
||||
/**
|
||||
* Header/footer images
|
||||
*
|
||||
* @var PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||
*/
|
||||
private $_headerFooterImages = array();
|
||||
/**
|
||||
* Header/footer images
|
||||
*
|
||||
* @var PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||
*/
|
||||
private $headerFooterImages = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_HeaderFooter
|
||||
@@ -192,8 +184,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOddHeader() {
|
||||
return $this->_oddHeader;
|
||||
public function getOddHeader()
|
||||
{
|
||||
return $this->oddHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,9 +195,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setOddHeader($pValue) {
|
||||
$this->_oddHeader = $pValue;
|
||||
return $this;
|
||||
public function setOddHeader($pValue)
|
||||
{
|
||||
$this->oddHeader = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,8 +206,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOddFooter() {
|
||||
return $this->_oddFooter;
|
||||
public function getOddFooter()
|
||||
{
|
||||
return $this->oddFooter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,9 +217,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setOddFooter($pValue) {
|
||||
$this->_oddFooter = $pValue;
|
||||
return $this;
|
||||
public function setOddFooter($pValue)
|
||||
{
|
||||
$this->oddFooter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,8 +228,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEvenHeader() {
|
||||
return $this->_evenHeader;
|
||||
public function getEvenHeader()
|
||||
{
|
||||
return $this->evenHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,9 +239,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setEvenHeader($pValue) {
|
||||
$this->_evenHeader = $pValue;
|
||||
return $this;
|
||||
public function setEvenHeader($pValue)
|
||||
{
|
||||
$this->evenHeader = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,8 +250,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEvenFooter() {
|
||||
return $this->_evenFooter;
|
||||
public function getEvenFooter()
|
||||
{
|
||||
return $this->evenFooter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,9 +261,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setEvenFooter($pValue) {
|
||||
$this->_evenFooter = $pValue;
|
||||
return $this;
|
||||
public function setEvenFooter($pValue)
|
||||
{
|
||||
$this->evenFooter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,8 +272,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstHeader() {
|
||||
return $this->_firstHeader;
|
||||
public function getFirstHeader()
|
||||
{
|
||||
return $this->firstHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,9 +283,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setFirstHeader($pValue) {
|
||||
$this->_firstHeader = $pValue;
|
||||
return $this;
|
||||
public function setFirstHeader($pValue)
|
||||
{
|
||||
$this->firstHeader = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,8 +294,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstFooter() {
|
||||
return $this->_firstFooter;
|
||||
public function getFirstFooter()
|
||||
{
|
||||
return $this->firstFooter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,9 +305,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setFirstFooter($pValue) {
|
||||
$this->_firstFooter = $pValue;
|
||||
return $this;
|
||||
public function setFirstFooter($pValue)
|
||||
{
|
||||
$this->firstFooter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,8 +316,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDifferentOddEven() {
|
||||
return $this->_differentOddEven;
|
||||
public function getDifferentOddEven()
|
||||
{
|
||||
return $this->differentOddEven;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,9 +327,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setDifferentOddEven($pValue = false) {
|
||||
$this->_differentOddEven = $pValue;
|
||||
return $this;
|
||||
public function setDifferentOddEven($pValue = false)
|
||||
{
|
||||
$this->differentOddEven = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,8 +338,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDifferentFirst() {
|
||||
return $this->_differentFirst;
|
||||
public function getDifferentFirst()
|
||||
{
|
||||
return $this->differentFirst;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,9 +349,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setDifferentFirst($pValue = false) {
|
||||
$this->_differentFirst = $pValue;
|
||||
return $this;
|
||||
public function setDifferentFirst($pValue = false)
|
||||
{
|
||||
$this->differentFirst = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,8 +360,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getScaleWithDocument() {
|
||||
return $this->_scaleWithDocument;
|
||||
public function getScaleWithDocument()
|
||||
{
|
||||
return $this->scaleWithDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,9 +371,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setScaleWithDocument($pValue = true) {
|
||||
$this->_scaleWithDocument = $pValue;
|
||||
return $this;
|
||||
public function setScaleWithDocument($pValue = true)
|
||||
{
|
||||
$this->scaleWithDocument = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -372,8 +382,9 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAlignWithMargins() {
|
||||
return $this->_alignWithMargins;
|
||||
public function getAlignWithMargins()
|
||||
{
|
||||
return $this->alignWithMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,9 +393,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setAlignWithMargins($pValue = true) {
|
||||
$this->_alignWithMargins = $pValue;
|
||||
return $this;
|
||||
public function setAlignWithMargins($pValue = true)
|
||||
{
|
||||
$this->alignWithMargins = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,9 +407,10 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
|
||||
$this->_headerFooterImages[$location] = $image;
|
||||
return $this;
|
||||
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
|
||||
{
|
||||
$this->headerFooterImages[$location] = $image;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,11 +420,12 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function removeImage($location = self::IMAGE_HEADER_LEFT) {
|
||||
if (isset($this->_headerFooterImages[$location])) {
|
||||
unset($this->_headerFooterImages[$location]);
|
||||
}
|
||||
return $this;
|
||||
public function removeImage($location = self::IMAGE_HEADER_LEFT)
|
||||
{
|
||||
if (isset($this->headerFooterImages[$location])) {
|
||||
unset($this->headerFooterImages[$location]);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,13 +435,14 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_HeaderFooter
|
||||
*/
|
||||
public function setImages($images) {
|
||||
if (!is_array($images)) {
|
||||
throw new PHPExcel_Exception('Invalid parameter!');
|
||||
}
|
||||
public function setImages($images)
|
||||
{
|
||||
if (!is_array($images)) {
|
||||
throw new PHPExcel_Exception('Invalid parameter!');
|
||||
}
|
||||
|
||||
$this->_headerFooterImages = $images;
|
||||
return $this;
|
||||
$this->headerFooterImages = $images;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -435,31 +450,45 @@ class PHPExcel_Worksheet_HeaderFooter
|
||||
*
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||
*/
|
||||
public function getImages() {
|
||||
// Sort array
|
||||
$images = array();
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
|
||||
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
|
||||
$this->_headerFooterImages = $images;
|
||||
public function getImages()
|
||||
{
|
||||
// Sort array
|
||||
$images = array();
|
||||
if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) {
|
||||
$images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT];
|
||||
}
|
||||
if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) {
|
||||
$images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER];
|
||||
}
|
||||
if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
|
||||
$images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT];
|
||||
}
|
||||
if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
|
||||
$images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT];
|
||||
}
|
||||
if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
|
||||
$images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER];
|
||||
}
|
||||
if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
|
||||
$images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT];
|
||||
}
|
||||
$this->headerFooterImages = $images;
|
||||
|
||||
return $this->_headerFooterImages;
|
||||
return $this->headerFooterImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,83 +21,74 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_path;
|
||||
/**
|
||||
* Path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name;
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Offset X
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetX;
|
||||
/**
|
||||
* Offset X
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $offsetX;
|
||||
|
||||
/**
|
||||
* Offset Y
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetY;
|
||||
/**
|
||||
* Offset Y
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $offsetY;
|
||||
|
||||
/**
|
||||
* Width
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_width;
|
||||
/**
|
||||
* Width
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_height;
|
||||
/**
|
||||
* Height
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Proportional resize
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_resizeProportional;
|
||||
/**
|
||||
* Proportional resize
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $resizeProportional;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_path = '';
|
||||
$this->_name = '';
|
||||
$this->_offsetX = 0;
|
||||
$this->_offsetY = 0;
|
||||
$this->_width = 0;
|
||||
$this->_height = 0;
|
||||
$this->_resizeProportional = true;
|
||||
// Initialise values
|
||||
$this->path = '';
|
||||
$this->name = '';
|
||||
$this->offsetX = 0;
|
||||
$this->offsetY = 0;
|
||||
$this->width = 0;
|
||||
$this->height = 0;
|
||||
$this->resizeProportional = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +96,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->_name;
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,9 +107,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setName($pValue = '') {
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
public function setName($pValue = '')
|
||||
{
|
||||
$this->name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,8 +118,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetX() {
|
||||
return $this->_offsetX;
|
||||
public function getOffsetX()
|
||||
{
|
||||
return $this->offsetX;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,9 +129,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setOffsetX($pValue = 0) {
|
||||
$this->_offsetX = $pValue;
|
||||
return $this;
|
||||
public function setOffsetX($pValue = 0)
|
||||
{
|
||||
$this->offsetX = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,8 +140,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetY() {
|
||||
return $this->_offsetY;
|
||||
public function getOffsetY()
|
||||
{
|
||||
return $this->offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,9 +151,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setOffsetY($pValue = 0) {
|
||||
$this->_offsetY = $pValue;
|
||||
return $this;
|
||||
public function setOffsetY($pValue = 0)
|
||||
{
|
||||
$this->offsetY = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,8 +162,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,17 +173,18 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setWidth($pValue = 0) {
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / $this->_height;
|
||||
$this->_height = round($ratio * $pValue);
|
||||
}
|
||||
public function setWidth($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->width / $this->height;
|
||||
$this->height = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set width
|
||||
$this->_width = $pValue;
|
||||
// Set width
|
||||
$this->width = $pValue;
|
||||
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,8 +192,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->_height;
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,54 +203,57 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setHeight($pValue = 0) {
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / $this->_height;
|
||||
$this->_width = round($ratio * $pValue);
|
||||
}
|
||||
public function setHeight($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->width / $this->height;
|
||||
$this->width = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set height
|
||||
$this->_height = $pValue;
|
||||
// Set height
|
||||
$this->height = $pValue;
|
||||
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set width and height with proportional resize
|
||||
* Example:
|
||||
* <code>
|
||||
* Example:
|
||||
* <code>
|
||||
* $objDrawing->setResizeProportional(true);
|
||||
* $objDrawing->setWidthAndHeight(160,120);
|
||||
* </code>
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @author Vincent@luo MSN:kele_100@hotmail.com
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||
$xratio = $width / $this->_width;
|
||||
$yratio = $height / $this->_height;
|
||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->_height) < $height) {
|
||||
$this->_height = ceil($xratio * $this->_height);
|
||||
$this->_width = $width;
|
||||
} else {
|
||||
$this->_width = ceil($yratio * $this->_width);
|
||||
$this->_height = $height;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
public function setWidthAndHeight($width = 0, $height = 0)
|
||||
{
|
||||
$xratio = $width / $this->width;
|
||||
$yratio = $height / $this->height;
|
||||
if ($this->resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->height) < $height) {
|
||||
$this->height = ceil($xratio * $this->height);
|
||||
$this->width = $width;
|
||||
} else {
|
||||
$this->width = ceil($yratio * $this->width);
|
||||
$this->height = $height;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ResizeProportional
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getResizeProportional() {
|
||||
return $this->_resizeProportional;
|
||||
public function getResizeProportional()
|
||||
{
|
||||
return $this->resizeProportional;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,9 +262,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setResizeProportional($pValue = true) {
|
||||
$this->_resizeProportional = $pValue;
|
||||
return $this;
|
||||
public function setResizeProportional($pValue = true)
|
||||
{
|
||||
$this->resizeProportional = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,8 +273,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename() {
|
||||
return basename($this->_path);
|
||||
public function getFilename()
|
||||
{
|
||||
return basename($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,8 +283,9 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension() {
|
||||
$parts = explode(".", basename($this->_path));
|
||||
public function getExtension()
|
||||
{
|
||||
$parts = explode(".", basename($this->path));
|
||||
return end($parts);
|
||||
}
|
||||
|
||||
@@ -287,64 +294,68 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
return $this->_path;
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Path
|
||||
*
|
||||
* @param string $pValue File path
|
||||
* @param boolean $pVerifyFile Verify file
|
||||
* @throws PHPExcel_Exception
|
||||
* @param string $pValue File path
|
||||
* @param boolean $pVerifyFile Verify file
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setPath($pValue = '', $pVerifyFile = true) {
|
||||
if ($pVerifyFile) {
|
||||
if (file_exists($pValue)) {
|
||||
$this->_path = $pValue;
|
||||
public function setPath($pValue = '', $pVerifyFile = true)
|
||||
{
|
||||
if ($pVerifyFile) {
|
||||
if (file_exists($pValue)) {
|
||||
$this->path = $pValue;
|
||||
|
||||
if ($this->_width == 0 && $this->_height == 0) {
|
||||
// Get width/height
|
||||
list($this->_width, $this->_height) = getimagesize($pValue);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("File $pValue not found!");
|
||||
}
|
||||
} else {
|
||||
$this->_path = $pValue;
|
||||
}
|
||||
return $this;
|
||||
if ($this->width == 0 && $this->height == 0) {
|
||||
// Get width/height
|
||||
list($this->width, $this->height) = getimagesize($pValue);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("File $pValue not found!");
|
||||
}
|
||||
} else {
|
||||
$this->path = $pValue;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_path
|
||||
. $this->_name
|
||||
. $this->_offsetX
|
||||
. $this->_offsetY
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->path .
|
||||
$this->name .
|
||||
$this->offsetX .
|
||||
$this->offsetY .
|
||||
$this->width .
|
||||
$this->height .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_MemoryDrawing
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,74 +21,65 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_MemoryDrawing
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
{
|
||||
/* Rendering functions */
|
||||
const RENDERING_DEFAULT = 'imagepng';
|
||||
const RENDERING_PNG = 'imagepng';
|
||||
const RENDERING_GIF = 'imagegif';
|
||||
const RENDERING_JPEG = 'imagejpeg';
|
||||
/* Rendering functions */
|
||||
const RENDERING_DEFAULT = 'imagepng';
|
||||
const RENDERING_PNG = 'imagepng';
|
||||
const RENDERING_GIF = 'imagegif';
|
||||
const RENDERING_JPEG = 'imagejpeg';
|
||||
|
||||
/* MIME types */
|
||||
const MIMETYPE_DEFAULT = 'image/png';
|
||||
const MIMETYPE_PNG = 'image/png';
|
||||
const MIMETYPE_GIF = 'image/gif';
|
||||
const MIMETYPE_JPEG = 'image/jpeg';
|
||||
/* MIME types */
|
||||
const MIMETYPE_DEFAULT = 'image/png';
|
||||
const MIMETYPE_PNG = 'image/png';
|
||||
const MIMETYPE_GIF = 'image/gif';
|
||||
const MIMETYPE_JPEG = 'image/jpeg';
|
||||
|
||||
/**
|
||||
* Image resource
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $_imageResource;
|
||||
/**
|
||||
* Image resource
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $imageResource;
|
||||
|
||||
/**
|
||||
* Rendering function
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_renderingFunction;
|
||||
/**
|
||||
* Rendering function
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $renderingFunction;
|
||||
|
||||
/**
|
||||
* Mime type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_mimeType;
|
||||
/**
|
||||
* Mime type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $mimeType;
|
||||
|
||||
/**
|
||||
* Unique name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_uniqueName;
|
||||
/**
|
||||
* Unique name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $uniqueName;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_imageResource = null;
|
||||
$this->_renderingFunction = self::RENDERING_DEFAULT;
|
||||
$this->_mimeType = self::MIMETYPE_DEFAULT;
|
||||
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
||||
// Initialise values
|
||||
$this->imageResource = null;
|
||||
$this->renderingFunction = self::RENDERING_DEFAULT;
|
||||
$this->mimeType = self::MIMETYPE_DEFAULT;
|
||||
$this->uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
||||
|
||||
// Initialize parent
|
||||
parent::__construct();
|
||||
// Initialize parent
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,25 +87,27 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getImageResource() {
|
||||
return $this->_imageResource;
|
||||
public function getImageResource()
|
||||
{
|
||||
return $this->imageResource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image resource
|
||||
*
|
||||
* @param $value resource
|
||||
* @param $value resource
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setImageResource($value = null) {
|
||||
$this->_imageResource = $value;
|
||||
public function setImageResource($value = null)
|
||||
{
|
||||
$this->imageResource = $value;
|
||||
|
||||
if (!is_null($this->_imageResource)) {
|
||||
// Get width/height
|
||||
$this->_width = imagesx($this->_imageResource);
|
||||
$this->_height = imagesy($this->_imageResource);
|
||||
}
|
||||
return $this;
|
||||
if (!is_null($this->imageResource)) {
|
||||
// Get width/height
|
||||
$this->width = imagesx($this->imageResource);
|
||||
$this->height = imagesy($this->imageResource);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,8 +115,9 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRenderingFunction() {
|
||||
return $this->_renderingFunction;
|
||||
public function getRenderingFunction()
|
||||
{
|
||||
return $this->renderingFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,9 +126,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
* @param string $value
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
|
||||
$this->_renderingFunction = $value;
|
||||
return $this;
|
||||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT)
|
||||
{
|
||||
$this->renderingFunction = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,8 +137,9 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType() {
|
||||
return $this->_mimeType;
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,9 +148,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
* @param string $value
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
|
||||
$this->_mimeType = $value;
|
||||
return $this;
|
||||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT)
|
||||
{
|
||||
$this->mimeType = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,40 +159,43 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIndexedFilename() {
|
||||
$extension = strtolower($this->getMimeType());
|
||||
$extension = explode('/', $extension);
|
||||
$extension = $extension[1];
|
||||
public function getIndexedFilename()
|
||||
{
|
||||
$extension = strtolower($this->getMimeType());
|
||||
$extension = explode('/', $extension);
|
||||
$extension = $extension[1];
|
||||
|
||||
return $this->_uniqueName . $this->getImageIndex() . '.' . $extension;
|
||||
return $this->uniqueName . $this->getImageIndex() . '.' . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_renderingFunction
|
||||
. $this->_mimeType
|
||||
. $this->_uniqueName
|
||||
. parent::getHashCode()
|
||||
. __CLASS__
|
||||
);
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->renderingFunction .
|
||||
$this->mimeType .
|
||||
$this->uniqueName .
|
||||
parent::getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,8 +20,8 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
@@ -31,51 +31,51 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_PageMargins
|
||||
{
|
||||
/**
|
||||
* Left
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_left = 0.7;
|
||||
/**
|
||||
* Left
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $left = 0.7;
|
||||
|
||||
/**
|
||||
* Right
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_right = 0.7;
|
||||
/**
|
||||
* Right
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $right = 0.7;
|
||||
|
||||
/**
|
||||
* Top
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_top = 0.75;
|
||||
/**
|
||||
* Top
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $top = 0.75;
|
||||
|
||||
/**
|
||||
* Bottom
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_bottom = 0.75;
|
||||
/**
|
||||
* Bottom
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $bottom = 0.75;
|
||||
|
||||
/**
|
||||
* Header
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_header = 0.3;
|
||||
/**
|
||||
* Header
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $header = 0.3;
|
||||
|
||||
/**
|
||||
* Footer
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_footer = 0.3;
|
||||
/**
|
||||
* Footer
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $footer = 0.3;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_PageMargins
|
||||
@@ -89,8 +89,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getLeft() {
|
||||
return $this->_left;
|
||||
public function getLeft()
|
||||
{
|
||||
return $this->left;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,9 +100,10 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setLeft($pValue) {
|
||||
$this->_left = $pValue;
|
||||
return $this;
|
||||
public function setLeft($pValue)
|
||||
{
|
||||
$this->left = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,8 +111,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getRight() {
|
||||
return $this->_right;
|
||||
public function getRight()
|
||||
{
|
||||
return $this->right;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,9 +122,10 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setRight($pValue) {
|
||||
$this->_right = $pValue;
|
||||
return $this;
|
||||
public function setRight($pValue)
|
||||
{
|
||||
$this->right = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,8 +133,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getTop() {
|
||||
return $this->_top;
|
||||
public function getTop()
|
||||
{
|
||||
return $this->top;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,9 +144,10 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setTop($pValue) {
|
||||
$this->_top = $pValue;
|
||||
return $this;
|
||||
public function setTop($pValue)
|
||||
{
|
||||
$this->top = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,8 +155,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getBottom() {
|
||||
return $this->_bottom;
|
||||
public function getBottom()
|
||||
{
|
||||
return $this->bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,9 +166,10 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setBottom($pValue) {
|
||||
$this->_bottom = $pValue;
|
||||
return $this;
|
||||
public function setBottom($pValue)
|
||||
{
|
||||
$this->bottom = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,8 +177,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getHeader() {
|
||||
return $this->_header;
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->header;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,9 +188,10 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setHeader($pValue) {
|
||||
$this->_header = $pValue;
|
||||
return $this;
|
||||
public function setHeader($pValue)
|
||||
{
|
||||
$this->header = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,8 +199,9 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getFooter() {
|
||||
return $this->_footer;
|
||||
public function getFooter()
|
||||
{
|
||||
return $this->footer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,22 +210,24 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setFooter($pValue) {
|
||||
$this->_footer = $pValue;
|
||||
return $this;
|
||||
public function setFooter($pValue)
|
||||
{
|
||||
$this->footer = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,8 +20,8 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
@@ -31,128 +31,128 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Protection
|
||||
{
|
||||
/**
|
||||
* Sheet
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_sheet = false;
|
||||
/**
|
||||
* Sheet
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $sheet = false;
|
||||
|
||||
/**
|
||||
* Objects
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_objects = false;
|
||||
/**
|
||||
* Objects
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $objects = false;
|
||||
|
||||
/**
|
||||
* Scenarios
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_scenarios = false;
|
||||
/**
|
||||
* Scenarios
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $scenarios = false;
|
||||
|
||||
/**
|
||||
* Format cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatCells = false;
|
||||
/**
|
||||
* Format cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatCells = false;
|
||||
|
||||
/**
|
||||
* Format columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatColumns = false;
|
||||
/**
|
||||
* Format columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatColumns = false;
|
||||
|
||||
/**
|
||||
* Format rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatRows = false;
|
||||
/**
|
||||
* Format rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatRows = false;
|
||||
|
||||
/**
|
||||
* Insert columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertColumns = false;
|
||||
/**
|
||||
* Insert columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertColumns = false;
|
||||
|
||||
/**
|
||||
* Insert rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertRows = false;
|
||||
/**
|
||||
* Insert rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertRows = false;
|
||||
|
||||
/**
|
||||
* Insert hyperlinks
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertHyperlinks = false;
|
||||
/**
|
||||
* Insert hyperlinks
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertHyperlinks = false;
|
||||
|
||||
/**
|
||||
* Delete columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_deleteColumns = false;
|
||||
/**
|
||||
* Delete columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $deleteColumns = false;
|
||||
|
||||
/**
|
||||
* Delete rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_deleteRows = false;
|
||||
/**
|
||||
* Delete rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $deleteRows = false;
|
||||
|
||||
/**
|
||||
* Select locked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_selectLockedCells = false;
|
||||
/**
|
||||
* Select locked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $selectLockedCells = false;
|
||||
|
||||
/**
|
||||
* Sort
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_sort = false;
|
||||
/**
|
||||
* Sort
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $sort = false;
|
||||
|
||||
/**
|
||||
* AutoFilter
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_autoFilter = false;
|
||||
/**
|
||||
* AutoFilter
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $autoFilter = false;
|
||||
|
||||
/**
|
||||
* Pivot tables
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_pivotTables = false;
|
||||
/**
|
||||
* Pivot tables
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $pivotTables = false;
|
||||
|
||||
/**
|
||||
* Select unlocked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_selectUnlockedCells = false;
|
||||
/**
|
||||
* Select unlocked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $selectUnlockedCells = false;
|
||||
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_password = '';
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $password = '';
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_Protection
|
||||
@@ -166,23 +166,24 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isProtectionEnabled() {
|
||||
return $this->_sheet ||
|
||||
$this->_objects ||
|
||||
$this->_scenarios ||
|
||||
$this->_formatCells ||
|
||||
$this->_formatColumns ||
|
||||
$this->_formatRows ||
|
||||
$this->_insertColumns ||
|
||||
$this->_insertRows ||
|
||||
$this->_insertHyperlinks ||
|
||||
$this->_deleteColumns ||
|
||||
$this->_deleteRows ||
|
||||
$this->_selectLockedCells ||
|
||||
$this->_sort ||
|
||||
$this->_autoFilter ||
|
||||
$this->_pivotTables ||
|
||||
$this->_selectUnlockedCells;
|
||||
public function isProtectionEnabled()
|
||||
{
|
||||
return $this->sheet ||
|
||||
$this->objects ||
|
||||
$this->scenarios ||
|
||||
$this->formatCells ||
|
||||
$this->formatColumns ||
|
||||
$this->formatRows ||
|
||||
$this->insertColumns ||
|
||||
$this->insertRows ||
|
||||
$this->insertHyperlinks ||
|
||||
$this->deleteColumns ||
|
||||
$this->deleteRows ||
|
||||
$this->selectLockedCells ||
|
||||
$this->sort ||
|
||||
$this->autoFilter ||
|
||||
$this->pivotTables ||
|
||||
$this->selectUnlockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,8 +191,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSheet() {
|
||||
return $this->_sheet;
|
||||
public function getSheet()
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,9 +202,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSheet($pValue = false) {
|
||||
$this->_sheet = $pValue;
|
||||
return $this;
|
||||
public function setSheet($pValue = false)
|
||||
{
|
||||
$this->sheet = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,8 +213,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getObjects() {
|
||||
return $this->_objects;
|
||||
public function getObjects()
|
||||
{
|
||||
return $this->objects;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,9 +224,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setObjects($pValue = false) {
|
||||
$this->_objects = $pValue;
|
||||
return $this;
|
||||
public function setObjects($pValue = false)
|
||||
{
|
||||
$this->objects = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,8 +235,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getScenarios() {
|
||||
return $this->_scenarios;
|
||||
public function getScenarios()
|
||||
{
|
||||
return $this->scenarios;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,9 +246,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setScenarios($pValue = false) {
|
||||
$this->_scenarios = $pValue;
|
||||
return $this;
|
||||
public function setScenarios($pValue = false)
|
||||
{
|
||||
$this->scenarios = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,8 +257,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatCells() {
|
||||
return $this->_formatCells;
|
||||
public function getFormatCells()
|
||||
{
|
||||
return $this->formatCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,9 +268,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatCells($pValue = false) {
|
||||
$this->_formatCells = $pValue;
|
||||
return $this;
|
||||
public function setFormatCells($pValue = false)
|
||||
{
|
||||
$this->formatCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,8 +279,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatColumns() {
|
||||
return $this->_formatColumns;
|
||||
public function getFormatColumns()
|
||||
{
|
||||
return $this->formatColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +290,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatColumns($pValue = false) {
|
||||
$this->_formatColumns = $pValue;
|
||||
return $this;
|
||||
public function setFormatColumns($pValue = false)
|
||||
{
|
||||
$this->formatColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,8 +301,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatRows() {
|
||||
return $this->_formatRows;
|
||||
public function getFormatRows()
|
||||
{
|
||||
return $this->formatRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,9 +312,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatRows($pValue = false) {
|
||||
$this->_formatRows = $pValue;
|
||||
return $this;
|
||||
public function setFormatRows($pValue = false)
|
||||
{
|
||||
$this->formatRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,8 +323,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertColumns() {
|
||||
return $this->_insertColumns;
|
||||
public function getInsertColumns()
|
||||
{
|
||||
return $this->insertColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,9 +334,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertColumns($pValue = false) {
|
||||
$this->_insertColumns = $pValue;
|
||||
return $this;
|
||||
public function setInsertColumns($pValue = false)
|
||||
{
|
||||
$this->insertColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,8 +345,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertRows() {
|
||||
return $this->_insertRows;
|
||||
public function getInsertRows()
|
||||
{
|
||||
return $this->insertRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,9 +356,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertRows($pValue = false) {
|
||||
$this->_insertRows = $pValue;
|
||||
return $this;
|
||||
public function setInsertRows($pValue = false)
|
||||
{
|
||||
$this->insertRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,8 +367,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertHyperlinks() {
|
||||
return $this->_insertHyperlinks;
|
||||
public function getInsertHyperlinks()
|
||||
{
|
||||
return $this->insertHyperlinks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -360,9 +378,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertHyperlinks($pValue = false) {
|
||||
$this->_insertHyperlinks = $pValue;
|
||||
return $this;
|
||||
public function setInsertHyperlinks($pValue = false)
|
||||
{
|
||||
$this->insertHyperlinks = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,8 +389,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getDeleteColumns() {
|
||||
return $this->_deleteColumns;
|
||||
public function getDeleteColumns()
|
||||
{
|
||||
return $this->deleteColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,9 +400,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setDeleteColumns($pValue = false) {
|
||||
$this->_deleteColumns = $pValue;
|
||||
return $this;
|
||||
public function setDeleteColumns($pValue = false)
|
||||
{
|
||||
$this->deleteColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,8 +411,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getDeleteRows() {
|
||||
return $this->_deleteRows;
|
||||
public function getDeleteRows()
|
||||
{
|
||||
return $this->deleteRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,9 +422,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setDeleteRows($pValue = false) {
|
||||
$this->_deleteRows = $pValue;
|
||||
return $this;
|
||||
public function setDeleteRows($pValue = false)
|
||||
{
|
||||
$this->deleteRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,8 +433,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSelectLockedCells() {
|
||||
return $this->_selectLockedCells;
|
||||
public function getSelectLockedCells()
|
||||
{
|
||||
return $this->selectLockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,9 +444,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSelectLockedCells($pValue = false) {
|
||||
$this->_selectLockedCells = $pValue;
|
||||
return $this;
|
||||
public function setSelectLockedCells($pValue = false)
|
||||
{
|
||||
$this->selectLockedCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,8 +455,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSort() {
|
||||
return $this->_sort;
|
||||
public function getSort()
|
||||
{
|
||||
return $this->sort;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,9 +466,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSort($pValue = false) {
|
||||
$this->_sort = $pValue;
|
||||
return $this;
|
||||
public function setSort($pValue = false)
|
||||
{
|
||||
$this->sort = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,8 +477,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getAutoFilter() {
|
||||
return $this->_autoFilter;
|
||||
public function getAutoFilter()
|
||||
{
|
||||
return $this->autoFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -460,9 +488,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setAutoFilter($pValue = false) {
|
||||
$this->_autoFilter = $pValue;
|
||||
return $this;
|
||||
public function setAutoFilter($pValue = false)
|
||||
{
|
||||
$this->autoFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,8 +499,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getPivotTables() {
|
||||
return $this->_pivotTables;
|
||||
public function getPivotTables()
|
||||
{
|
||||
return $this->pivotTables;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,9 +510,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setPivotTables($pValue = false) {
|
||||
$this->_pivotTables = $pValue;
|
||||
return $this;
|
||||
public function setPivotTables($pValue = false)
|
||||
{
|
||||
$this->pivotTables = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,8 +521,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSelectUnlockedCells() {
|
||||
return $this->_selectUnlockedCells;
|
||||
public function getSelectUnlockedCells()
|
||||
{
|
||||
return $this->selectUnlockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,9 +532,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSelectUnlockedCells($pValue = false) {
|
||||
$this->_selectUnlockedCells = $pValue;
|
||||
return $this;
|
||||
public function setSelectUnlockedCells($pValue = false)
|
||||
{
|
||||
$this->selectUnlockedCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,36 +543,39 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getPassword() {
|
||||
return $this->_password;
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Password
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setPassword($pValue = '', $pAlreadyHashed = false) {
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_password = $pValue;
|
||||
return $this;
|
||||
public function setPassword($pValue = '', $pAlreadyHashed = false)
|
||||
{
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->password = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_Row
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,73 +21,66 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_Row
|
||||
*
|
||||
* Represents a row in PHPExcel_Worksheet, used by PHPExcel_Worksheet_RowIterator
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Row
|
||||
{
|
||||
/**
|
||||
* PHPExcel_Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_parent;
|
||||
/**
|
||||
* PHPExcel_Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_rowIndex = 0;
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $rowIndex = 0;
|
||||
|
||||
/**
|
||||
* Create a new row
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent
|
||||
* @param int $rowIndex
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1) {
|
||||
// Set parent and row index
|
||||
$this->_parent = $parent;
|
||||
$this->_rowIndex = $rowIndex;
|
||||
}
|
||||
/**
|
||||
* Create a new row
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent
|
||||
* @param int $rowIndex
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1)
|
||||
{
|
||||
// Set parent and row index
|
||||
$this->parent = $parent;
|
||||
$this->rowIndex = $rowIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_parent);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get row index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRowIndex() {
|
||||
return $this->_rowIndex;
|
||||
}
|
||||
/**
|
||||
* Get row index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRowIndex()
|
||||
{
|
||||
return $this->rowIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell iterator
|
||||
*
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_CellIterator
|
||||
*/
|
||||
public function getCellIterator($startColumn = 'A', $endColumn = null) {
|
||||
return new PHPExcel_Worksheet_RowCellIterator($this->_parent, $this->_rowIndex, $startColumn, $endColumn);
|
||||
}
|
||||
/**
|
||||
* Get cell iterator
|
||||
*
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_CellIterator
|
||||
*/
|
||||
public function getCellIterator($startColumn = 'A', $endColumn = null)
|
||||
{
|
||||
return new PHPExcel_Worksheet_RowCellIterator($this->parent, $this->rowIndex, $startColumn, $endColumn);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_RowCellIterator
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,206 +20,206 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_RowCellIterator
|
||||
*
|
||||
* Used to iterate columns in a PHPExcel_Worksheet
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_RowCellIterator extends PHPExcel_Worksheet_CellIterator implements Iterator
|
||||
{
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_rowIndex;
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $rowIndex;
|
||||
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_startColumn = 0;
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $startColumn = 0;
|
||||
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_endColumn = 0;
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $endColumn = 0;
|
||||
|
||||
/**
|
||||
* Create a new column iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
/**
|
||||
* Create a new column iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param integer $rowIndex The row that we want to iterate
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) {
|
||||
// Set subject and row index
|
||||
$this->_subject = $subject;
|
||||
$this->_rowIndex = $rowIndex;
|
||||
$this->resetEnd($endColumn);
|
||||
$this->resetStart($startColumn);
|
||||
}
|
||||
* @param string $startColumn The column address at which to start iterating
|
||||
* @param string $endColumn Optionally, the column address at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null)
|
||||
{
|
||||
// Set subject and row index
|
||||
$this->subject = $subject;
|
||||
$this->rowIndex = $rowIndex;
|
||||
$this->resetEnd($endColumn);
|
||||
$this->resetStart($startColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_subject);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the start column and the current column pointer
|
||||
*
|
||||
* @param integer $startColumn The column address at which to start iterating
|
||||
/**
|
||||
* (Re)Set the start column and the current column pointer
|
||||
*
|
||||
* @param integer $startColumn The column address at which to start iterating
|
||||
* @return PHPExcel_Worksheet_RowCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function resetStart($startColumn = 'A') {
|
||||
*/
|
||||
public function resetStart($startColumn = 'A')
|
||||
{
|
||||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
|
||||
$this->_startColumn = $startColumnIndex;
|
||||
$this->startColumn = $startColumnIndex;
|
||||
$this->adjustForExistingOnlyRange();
|
||||
$this->seek(PHPExcel_Cell::stringFromColumnIndex($this->_startColumn));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the end column
|
||||
*
|
||||
* @param string $endColumn The column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_RowCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function resetEnd($endColumn = null) {
|
||||
$endColumn = ($endColumn) ? $endColumn : $this->_subject->getHighestColumn();
|
||||
$this->_endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
|
||||
$this->adjustForExistingOnlyRange();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the column pointer to the selected column
|
||||
*
|
||||
* @param string $column The column address to set the current pointer at
|
||||
* @return PHPExcel_Worksheet_RowCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($column = 'A') {
|
||||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
if (($column < $this->_startColumn) || ($column > $this->_endColumn)) {
|
||||
throw new PHPExcel_Exception("Column $column is out of range ({$this->_startColumn} - {$this->_endColumn})");
|
||||
} elseif ($this->_onlyExistingCells && !($this->_subject->cellExistsByColumnAndRow($column, $this->_rowIndex))) {
|
||||
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
|
||||
}
|
||||
$this->_position = $column;
|
||||
$this->seek(PHPExcel_Cell::stringFromColumnIndex($this->startColumn));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting column
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = $this->_startColumn;
|
||||
}
|
||||
/**
|
||||
* (Re)Set the end column
|
||||
*
|
||||
* @param string $endColumn The column address at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_RowCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function resetEnd($endColumn = null)
|
||||
{
|
||||
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
|
||||
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
|
||||
$this->adjustForExistingOnlyRange();
|
||||
|
||||
/**
|
||||
* Return the current cell in this worksheet row
|
||||
*
|
||||
* @return PHPExcel_Cell
|
||||
*/
|
||||
public function current() {
|
||||
return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function key() {
|
||||
return PHPExcel_Cell::stringFromColumnIndex($this->_position);
|
||||
}
|
||||
/**
|
||||
* Set the column pointer to the selected column
|
||||
*
|
||||
* @param string $column The column address to set the current pointer at
|
||||
* @return PHPExcel_Worksheet_RowCellIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($column = 'A')
|
||||
{
|
||||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
if (($column < $this->startColumn) || ($column > $this->endColumn)) {
|
||||
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
|
||||
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) {
|
||||
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
|
||||
}
|
||||
$this->position = $column;
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting column
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = $this->startColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current cell in this worksheet row
|
||||
*
|
||||
* @return PHPExcel_Cell
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->subject->getCellByColumnAndRow($this->position, $this->rowIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return PHPExcel_Cell::stringFromColumnIndex($this->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
do {
|
||||
++$this->_position;
|
||||
} while (($this->_onlyExistingCells) &&
|
||||
(!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) &&
|
||||
($this->_position <= $this->_endColumn));
|
||||
}
|
||||
++$this->position;
|
||||
} while (($this->onlyExistingCells) &&
|
||||
(!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) &&
|
||||
($this->position <= $this->endColumn));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function prev() {
|
||||
if ($this->_position <= $this->_startColumn) {
|
||||
*/
|
||||
public function prev()
|
||||
{
|
||||
if ($this->position <= $this->startColumn) {
|
||||
throw new PHPExcel_Exception(
|
||||
"Column is already at the beginning of range (" .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . " - " .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . ")"
|
||||
"Column is already at the beginning of range (" .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " .
|
||||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")"
|
||||
);
|
||||
}
|
||||
|
||||
do {
|
||||
--$this->_position;
|
||||
} while (($this->_onlyExistingCells) &&
|
||||
(!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) &&
|
||||
($this->_position >= $this->_startColumn));
|
||||
}
|
||||
--$this->position;
|
||||
} while (($this->onlyExistingCells) &&
|
||||
(!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) &&
|
||||
($this->position >= $this->startColumn));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if more columns exist in the worksheet range of columns that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->_position <= $this->_endColumn;
|
||||
}
|
||||
/**
|
||||
* Indicate if more columns exist in the worksheet range of columns that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return $this->position <= $this->endColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
/**
|
||||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function adjustForExistingOnlyRange() {
|
||||
if ($this->_onlyExistingCells) {
|
||||
while ((!$this->_subject->cellExistsByColumnAndRow($this->_startColumn, $this->_rowIndex)) &&
|
||||
($this->_startColumn <= $this->_endColumn)) {
|
||||
++$this->_startColumn;
|
||||
*/
|
||||
protected function adjustForExistingOnlyRange()
|
||||
{
|
||||
if ($this->onlyExistingCells) {
|
||||
while ((!$this->subject->cellExistsByColumnAndRow($this->startColumn, $this->rowIndex)) &&
|
||||
($this->startColumn <= $this->endColumn)) {
|
||||
++$this->startColumn;
|
||||
}
|
||||
if ($this->_startColumn > $this->_endColumn) {
|
||||
if ($this->startColumn > $this->endColumn) {
|
||||
throw new PHPExcel_Exception('No cells exist within the specified range');
|
||||
}
|
||||
while ((!$this->_subject->cellExistsByColumnAndRow($this->_endColumn, $this->_rowIndex)) &&
|
||||
($this->_endColumn >= $this->_startColumn)) {
|
||||
--$this->_endColumn;
|
||||
while ((!$this->subject->cellExistsByColumnAndRow($this->endColumn, $this->rowIndex)) &&
|
||||
($this->endColumn >= $this->startColumn)) {
|
||||
--$this->endColumn;
|
||||
}
|
||||
if ($this->_endColumn < $this->_startColumn) {
|
||||
if ($this->endColumn < $this->startColumn) {
|
||||
throw new PHPExcel_Exception('No cells exist within the specified range');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_RowDimension
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,71 +21,34 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_RowDimension
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_RowDimension
|
||||
class PHPExcel_Worksheet_RowDimension extends PHPExcel_Worksheet_Dimension
|
||||
{
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_rowIndex;
|
||||
/**
|
||||
* Row index
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $rowIndex;
|
||||
|
||||
/**
|
||||
* Row height (in pt)
|
||||
*
|
||||
* When this is set to a negative value, the row height should be ignored by IWriter
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $_rowHeight = -1;
|
||||
/**
|
||||
* Row height (in pt)
|
||||
*
|
||||
* When this is set to a negative value, the row height should be ignored by IWriter
|
||||
*
|
||||
* @var double
|
||||
*/
|
||||
private $height = -1;
|
||||
|
||||
/**
|
||||
* ZeroHeight for Row?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_zeroHeight = false;
|
||||
|
||||
/**
|
||||
* Visible?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_visible = true;
|
||||
|
||||
/**
|
||||
* Outline level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_outlineLevel = 0;
|
||||
|
||||
/**
|
||||
* Collapsed
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_collapsed = false;
|
||||
|
||||
/**
|
||||
* Index to cellXf. Null value means row has no explicit cellXf format.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
private $_xfIndex;
|
||||
/**
|
||||
* ZeroHeight for Row?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $zeroHeight = false;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_RowDimension
|
||||
@@ -93,11 +57,11 @@ class PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function __construct($pIndex = 0)
|
||||
{
|
||||
// Initialise values
|
||||
$this->_rowIndex = $pIndex;
|
||||
// Initialise values
|
||||
$this->rowIndex = $pIndex;
|
||||
|
||||
// set row dimension as unformatted by default
|
||||
$this->_xfIndex = null;
|
||||
// set dimension as unformatted by default
|
||||
parent::__construct(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,8 +69,9 @@ class PHPExcel_Worksheet_RowDimension
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRowIndex() {
|
||||
return $this->_rowIndex;
|
||||
public function getRowIndex()
|
||||
{
|
||||
return $this->rowIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +80,10 @@ class PHPExcel_Worksheet_RowDimension
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setRowIndex($pValue) {
|
||||
$this->_rowIndex = $pValue;
|
||||
return $this;
|
||||
public function setRowIndex($pValue)
|
||||
{
|
||||
$this->rowIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,8 +91,9 @@ class PHPExcel_Worksheet_RowDimension
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getRowHeight() {
|
||||
return $this->_rowHeight;
|
||||
public function getRowHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,131 +102,31 @@ class PHPExcel_Worksheet_RowDimension
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setRowHeight($pValue = -1) {
|
||||
$this->_rowHeight = $pValue;
|
||||
return $this;
|
||||
public function setRowHeight($pValue = -1)
|
||||
{
|
||||
$this->height = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ZeroHeight
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getZeroHeight() {
|
||||
return $this->_zeroHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ZeroHeight
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setZeroHeight($pValue = false) {
|
||||
$this->_zeroHeight = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Visible
|
||||
* Get ZeroHeight
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible() {
|
||||
return $this->_visible;
|
||||
public function getZeroHeight()
|
||||
{
|
||||
return $this->zeroHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Visible
|
||||
* Set ZeroHeight
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setVisible($pValue = true) {
|
||||
$this->_visible = $pValue;
|
||||
return $this;
|
||||
public function setZeroHeight($pValue = false)
|
||||
{
|
||||
$this->zeroHeight = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Outline Level
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOutlineLevel() {
|
||||
return $this->_outlineLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Outline Level
|
||||
*
|
||||
* Value must be between 0 and 7
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setOutlineLevel($pValue) {
|
||||
if ($pValue < 0 || $pValue > 7) {
|
||||
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
|
||||
}
|
||||
|
||||
$this->_outlineLevel = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Collapsed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getCollapsed() {
|
||||
return $this->_collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Collapsed
|
||||
*
|
||||
* @param bool $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setCollapsed($pValue = true) {
|
||||
$this->_collapsed = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index to cellXf
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getXfIndex()
|
||||
{
|
||||
return $this->_xfIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set index to cellXf
|
||||
*
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_RowDimension
|
||||
*/
|
||||
public function setXfIndex($pValue = 0)
|
||||
{
|
||||
$this->_xfIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_RowIterator
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,165 +20,173 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_RowIterator
|
||||
*
|
||||
* Used to iterate rows in a PHPExcel_Worksheet
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Worksheet
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Worksheet_RowIterator implements Iterator
|
||||
{
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_subject;
|
||||
/**
|
||||
* PHPExcel_Worksheet to iterate
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $subject;
|
||||
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_position = 1;
|
||||
/**
|
||||
* Current iterator position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $position = 1;
|
||||
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_startRow = 1;
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $startRow = 1;
|
||||
|
||||
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_endRow = 1;
|
||||
/**
|
||||
* End position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $endRow = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new row iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1, $endRow = null) {
|
||||
// Set subject
|
||||
$this->_subject = $subject;
|
||||
$this->resetEnd($endRow);
|
||||
$this->resetStart($startRow);
|
||||
}
|
||||
/**
|
||||
* Create a new row iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @param integer $endRow Optionally, the row number at which to stop iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject, $startRow = 1, $endRow = null)
|
||||
{
|
||||
// Set subject
|
||||
$this->subject = $subject;
|
||||
$this->resetEnd($endRow);
|
||||
$this->resetStart($startRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->_subject);
|
||||
}
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the start row and the current row pointer
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @return PHPExcel_Worksheet_RowIterator
|
||||
*/
|
||||
public function resetStart($startRow = 1) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->seek($startRow);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)Set the end row
|
||||
*
|
||||
* @param integer $endRow The row number at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_RowIterator
|
||||
*/
|
||||
public function resetEnd($endRow = null) {
|
||||
$this->_endRow = ($endRow) ? $endRow : $this->_subject->getHighestRow();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the row pointer to the selected row
|
||||
*
|
||||
* @param integer $row The row number to set the current pointer at
|
||||
/**
|
||||
* (Re)Set the start row and the current row pointer
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
* @return PHPExcel_Worksheet_RowIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($row = 1) {
|
||||
if (($row < $this->_startRow) || ($row > $this->_endRow)) {
|
||||
throw new PHPExcel_Exception("Row $row is out of range ({$this->_startRow} - {$this->_endRow})");
|
||||
*/
|
||||
public function resetStart($startRow = 1)
|
||||
{
|
||||
if ($startRow > $this->subject->getHighestRow()) {
|
||||
throw new PHPExcel_Exception("Start row ({$startRow}) is beyond highest row ({$this->subject->getHighestRow()})");
|
||||
}
|
||||
$this->_position = $row;
|
||||
|
||||
$this->startRow = $startRow;
|
||||
if ($this->endRow < $this->startRow) {
|
||||
$this->endRow = $this->startRow;
|
||||
}
|
||||
$this->seek($startRow);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting row
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = $this->_startRow;
|
||||
}
|
||||
/**
|
||||
* (Re)Set the end row
|
||||
*
|
||||
* @param integer $endRow The row number at which to stop iterating
|
||||
* @return PHPExcel_Worksheet_RowIterator
|
||||
*/
|
||||
public function resetEnd($endRow = null)
|
||||
{
|
||||
$this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow();
|
||||
|
||||
/**
|
||||
* Return the current row in this worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Row
|
||||
*/
|
||||
public function current() {
|
||||
return new PHPExcel_Worksheet_Row($this->_subject, $this->_position);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function key() {
|
||||
return $this->_position;
|
||||
}
|
||||
/**
|
||||
* Set the row pointer to the selected row
|
||||
*
|
||||
* @param integer $row The row number to set the current pointer at
|
||||
* @return PHPExcel_Worksheet_RowIterator
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function seek($row = 1)
|
||||
{
|
||||
if (($row < $this->startRow) || ($row > $this->endRow)) {
|
||||
throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
|
||||
}
|
||||
$this->position = $row;
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next() {
|
||||
++$this->_position;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*/
|
||||
public function prev() {
|
||||
if ($this->_position <= $this->_startRow) {
|
||||
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->_startRow} - {$this->_endRow})");
|
||||
/**
|
||||
* Rewind the iterator to the starting row
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = $this->startRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current row in this worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Row
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return new PHPExcel_Worksheet_Row($this->subject, $this->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
++$this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the iterator to its previous value
|
||||
*/
|
||||
public function prev()
|
||||
{
|
||||
if ($this->position <= $this->startRow) {
|
||||
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
|
||||
}
|
||||
|
||||
--$this->_position;
|
||||
}
|
||||
--$this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if more rows exist in the worksheet range of rows that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->_position <= $this->_endRow;
|
||||
}
|
||||
/**
|
||||
* Indicate if more rows exist in the worksheet range of rows that we're iterating
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return $this->position <= $this->endRow;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Worksheet_SheetView
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,59 +21,50 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @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 ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Worksheet_SheetView
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_SheetView
|
||||
{
|
||||
|
||||
/* Sheet View types */
|
||||
const SHEETVIEW_NORMAL = 'normal';
|
||||
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
|
||||
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
|
||||
/* Sheet View types */
|
||||
const SHEETVIEW_NORMAL = 'normal';
|
||||
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
|
||||
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
|
||||
|
||||
private static $_sheetViewTypes = array(
|
||||
self::SHEETVIEW_NORMAL,
|
||||
self::SHEETVIEW_PAGE_LAYOUT,
|
||||
self::SHEETVIEW_PAGE_BREAK_PREVIEW,
|
||||
);
|
||||
private static $sheetViewTypes = array(
|
||||
self::SHEETVIEW_NORMAL,
|
||||
self::SHEETVIEW_PAGE_LAYOUT,
|
||||
self::SHEETVIEW_PAGE_BREAK_PREVIEW,
|
||||
);
|
||||
|
||||
/**
|
||||
* ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_zoomScale = 100;
|
||||
/**
|
||||
* ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $zoomScale = 100;
|
||||
|
||||
/**
|
||||
* ZoomScaleNormal
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_zoomScaleNormal = 100;
|
||||
/**
|
||||
* ZoomScaleNormal
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $zoomScaleNormal = 100;
|
||||
|
||||
/**
|
||||
* View
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sheetviewType = self::SHEETVIEW_NORMAL;
|
||||
/**
|
||||
* View
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $sheetviewType = self::SHEETVIEW_NORMAL;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_SheetView
|
||||
@@ -81,108 +73,115 @@ class PHPExcel_Worksheet_SheetView
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ZoomScale
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScale() {
|
||||
return $this->_zoomScale;
|
||||
}
|
||||
/**
|
||||
* Get ZoomScale
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScale()
|
||||
{
|
||||
return $this->zoomScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScale($pValue = 100) {
|
||||
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
|
||||
// but it is apparently still able to handle any scale >= 1
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
$this->_zoomScale = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScale($pValue = 100)
|
||||
{
|
||||
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
|
||||
// but it is apparently still able to handle any scale >= 1
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
$this->zoomScale = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ZoomScaleNormal
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScaleNormal() {
|
||||
return $this->_zoomScaleNormal;
|
||||
}
|
||||
/**
|
||||
* Get ZoomScaleNormal
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScaleNormal()
|
||||
{
|
||||
return $this->zoomScaleNormal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScaleNormal($pValue = 100) {
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
$this->_zoomScaleNormal = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set ZoomScale
|
||||
*
|
||||
* Valid values range from 10 to 400.
|
||||
*
|
||||
* @param int $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScaleNormal($pValue = 100)
|
||||
{
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
$this->zoomScaleNormal = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get View
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getView() {
|
||||
return $this->_sheetviewType;
|
||||
}
|
||||
/**
|
||||
* Get View
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getView()
|
||||
{
|
||||
return $this->sheetviewType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set View
|
||||
*
|
||||
* Valid values are
|
||||
* 'normal' self::SHEETVIEW_NORMAL
|
||||
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
|
||||
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
|
||||
*
|
||||
* @param string $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setView($pValue = NULL) {
|
||||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
|
||||
// via the user interface
|
||||
if ($pValue === NULL)
|
||||
$pValue = self::SHEETVIEW_NORMAL;
|
||||
if (in_array($pValue, self::$_sheetViewTypes)) {
|
||||
$this->_sheetviewType = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Invalid sheetview layout type.");
|
||||
}
|
||||
/**
|
||||
* Set View
|
||||
*
|
||||
* Valid values are
|
||||
* 'normal' self::SHEETVIEW_NORMAL
|
||||
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
|
||||
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
|
||||
*
|
||||
* @param string $pValue
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setView($pValue = null)
|
||||
{
|
||||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
|
||||
if ($pValue === null) {
|
||||
$pValue = self::SHEETVIEW_NORMAL;
|
||||
}
|
||||
if (in_array($pValue, self::$sheetViewTypes)) {
|
||||
$this->sheetviewType = $pValue;
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Invalid sheetview layout type.");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user