Conflicts:
	Classes/PHPExcel/Calculation.php
	Classes/PHPExcel/Cell.php
This commit is contained in:
MarkBaker 2015-05-13 17:02:34 +01:00
commit 7d9f45c176
74 changed files with 4170 additions and 4237 deletions

View File

@ -304,7 +304,8 @@ class PHPExcel_Chart
* @param PHPExcel_Chart_Title $label
* @return PHPExcel_Chart
*/
public function setYAxisLabel(PHPExcel_Chart_Title $label) {
public function setYAxisLabel(PHPExcel_Chart_Title $label)
{
$this->_yAxisLabel = $label;
return $this;

View File

@ -442,8 +442,7 @@ class PHPExcel_Shared_String
$data = pack('CC', $ln, $opt);
// characters
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
}
else {
} else {
$data = pack('vC', $ln, 0x09);
$data .= pack('v', count($arrcRuns));
// characters

View File

@ -79,7 +79,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @var PHPExcel_Worksheet_AutoFilter
*/
private $_parent = NULL;
private $_parent = null;
/**
@ -128,7 +128,7 @@ class 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)
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = null)
{
$this->_columnIndex = $pColumn;
$this->_parent = $pParent;
@ -139,7 +139,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getColumnIndex() {
public function getColumnIndex()
{
return $this->_columnIndex;
}
@ -150,10 +151,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setColumnIndex($pColumn) {
public function setColumnIndex($pColumn)
{
// Uppercase coordinate
$pColumn = strtoupper($pColumn);
if ($this->_parent !== NULL) {
if ($this->_parent !== null) {
$this->_parent->testColumnInRange($pColumn);
}
@ -167,7 +169,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter
*/
public function getParent() {
public function getParent()
{
return $this->_parent;
}
@ -177,7 +180,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param PHPExcel_Worksheet_AutoFilter
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null)
{
$this->_parent = $pParent;
return $this;
@ -188,7 +192,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getFilterType() {
public function getFilterType()
{
return $this->_filterType;
}
@ -199,7 +204,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
{
if (!in_array($pFilterType, self::$_filterTypes)) {
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
}
@ -225,7 +231,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
{
// Lowercase And/Or
$pJoin = strtolower($pJoin);
if (!in_array($pJoin, self::$_ruleJoins)) {
@ -244,7 +251,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setAttributes($pAttributes = array()) {
public function setAttributes($pAttributes = array())
{
$this->_attributes = $pAttributes;
return $this;
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setAttribute($pName, $pValue) {
public function setAttribute($pName, $pValue)
{
$this->_attributes[$pName] = $pValue;
return $this;
@ -269,7 +278,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getAttributes() {
public function getAttributes()
{
return $this->_attributes;
}
@ -279,10 +289,12 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param string $pName Attribute Name
* @return string
*/
public function getAttribute($pName) {
if (isset($this->_attributes[$pName]))
public function getAttribute($pName)
{
if (isset($this->_attributes[$pName])) {
return $this->_attributes[$pName];
return NULL;
}
return null;
}
/**
@ -291,7 +303,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function getRules() {
public function getRules()
{
return $this->_ruleset;
}
@ -301,7 +314,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function getRule($pIndex) {
public function getRule($pIndex)
{
if (!isset($this->_ruleset[$pIndex])) {
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
}
@ -313,7 +327,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function createRule() {
public function createRule()
{
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
return end($this->_ruleset);
@ -326,7 +341,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @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) {
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true)
{
$pRule->setParent($this);
$this->_ruleset[] = $pRule;
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function deleteRule($pIndex) {
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
@ -357,7 +374,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function clearRules() {
public function clearRules()
{
$this->_ruleset = array();
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
@ -367,13 +385,14 @@ class PHPExcel_Worksheet_AutoFilter_Column
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
if ($key == '_parent') {
// Detach from autofilter parent
$this->$key = NULL;
$this->$key = null;
} else {
$this->$key = clone $value;
}

View File

@ -234,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @var PHPExcel_Worksheet_AutoFilter_Column
*/
private $_parent = NULL;
private $_parent = null;
/**
@ -272,7 +272,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
*/
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
{
$this->_parent = $pParent;
}
@ -282,7 +282,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getRuleType() {
public function getRuleType()
{
return $this->_ruleType;
}
@ -293,7 +294,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
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.');
}
@ -308,7 +310,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getValue() {
public function getValue()
{
return $this->_value;
}
@ -319,7 +322,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setValue($pValue = '') {
public function setValue($pValue = '')
{
if (is_array($pValue)) {
$grouping = -1;
foreach ($pValue as $key => $value) {
@ -348,7 +352,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getOperator() {
public function getOperator()
{
return $this->_operator;
}
@ -359,9 +364,11 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
if (empty($pOperator))
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.');
@ -376,7 +383,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getGrouping() {
public function getGrouping()
{
return $this->_grouping;
}
@ -387,14 +395,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setGrouping($pGrouping = NULL) {
if (($pGrouping !== NULL) &&
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;
return $this;
@ -409,14 +417,16 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
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)
if ($pGrouping !== null) {
$this->setGrouping($pGrouping);
}
return $this;
}
@ -426,7 +436,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getParent() {
public function getParent()
{
return $this->_parent;
}
@ -436,7 +447,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @param PHPExcel_Worksheet_AutoFilter_Column
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
{
$this->_parent = $pParent;
return $this;
@ -445,13 +457,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
if ($key == '_parent') {
// Detach from autofilter column parent
$this->$key = NULL;
$this->$key = null;
} else {
$this->$key = clone $value;
}
@ -460,5 +473,4 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
}
}
}
}

View File

@ -154,7 +154,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getImageIndex() {
public function getImageIndex()
{
return $this->_imageIndex;
}
@ -163,7 +164,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -173,7 +175,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setName($pValue = '') {
public function setName($pValue = '')
{
$this->_name = $pValue;
return $this;
}
@ -183,7 +186,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getDescription() {
public function getDescription()
{
return $this->_description;
}
@ -193,7 +197,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setDescription($pValue = '') {
public function setDescription($pValue = '')
{
$this->_description = $pValue;
return $this;
}
@ -203,7 +208,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
public function getWorksheet()
{
return $this->_worksheet;
}
@ -215,7 +221,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
{
if (is_null($this->_worksheet)) {
// Add drawing to PHPExcel_Worksheet
$this->_worksheet = $pValue;
@ -248,7 +255,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getCoordinates() {
public function getCoordinates()
{
return $this->_coordinates;
}
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setCoordinates($pValue = 'A1') {
public function setCoordinates($pValue = 'A1')
{
$this->_coordinates = $pValue;
return $this;
}
@ -268,7 +277,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getOffsetX() {
public function getOffsetX()
{
return $this->_offsetX;
}
@ -278,7 +288,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setOffsetX($pValue = 0) {
public function setOffsetX($pValue = 0)
{
$this->_offsetX = $pValue;
return $this;
}
@ -288,7 +299,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getOffsetY() {
public function getOffsetY()
{
return $this->_offsetY;
}
@ -298,7 +310,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setOffsetY($pValue = 0) {
public function setOffsetY($pValue = 0)
{
$this->_offsetY = $pValue;
return $this;
}
@ -308,7 +321,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -318,7 +332,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWidth($pValue = 0) {
public function setWidth($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
@ -336,7 +351,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -346,7 +362,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setHeight($pValue = 0) {
public function setHeight($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
@ -372,7 +389,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $height
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWidthAndHeight($width = 0, $height = 0) {
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)) {
@ -396,7 +414,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return boolean
*/
public function getResizeProportional() {
public function getResizeProportional()
{
return $this->_resizeProportional;
}
@ -406,7 +425,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param boolean $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setResizeProportional($pValue = true) {
public function setResizeProportional($pValue = true)
{
$this->_resizeProportional = $pValue;
return $this;
}
@ -416,7 +436,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getRotation() {
public function getRotation()
{
return $this->_rotation;
}
@ -426,7 +447,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setRotation($pValue = 0) {
public function setRotation($pValue = 0)
{
$this->_rotation = $pValue;
return $this;
}
@ -436,7 +458,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function getShadow() {
public function getShadow()
{
return $this->_shadow;
}
@ -447,7 +470,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
{
$this->_shadow = $pValue;
return $this;
}
@ -457,26 +481,16 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @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__
);
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() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -104,7 +104,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -114,7 +115,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setName($pValue = '') {
public function setName($pValue = '')
{
$this->_name = $pValue;
return $this;
}
@ -124,7 +126,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getOffsetX() {
public function getOffsetX()
{
return $this->_offsetX;
}
@ -134,7 +137,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetX($pValue = 0) {
public function setOffsetX($pValue = 0)
{
$this->_offsetX = $pValue;
return $this;
}
@ -144,7 +148,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getOffsetY() {
public function getOffsetY()
{
return $this->_offsetY;
}
@ -154,7 +159,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetY($pValue = 0) {
public function setOffsetY($pValue = 0)
{
$this->_offsetY = $pValue;
return $this;
}
@ -164,7 +170,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -174,7 +181,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setWidth($pValue = 0) {
public function setWidth($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / $this->_height;
@ -192,7 +200,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -202,7 +211,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setHeight($pValue = 0) {
public function setHeight($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / $this->_height;
@ -228,7 +238,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $height
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setWidthAndHeight($width = 0, $height = 0) {
public function setWidthAndHeight($width = 0, $height = 0)
{
$xratio = $width / $this->_width;
$yratio = $height / $this->_height;
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
@ -248,7 +259,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return boolean
*/
public function getResizeProportional() {
public function getResizeProportional()
{
return $this->_resizeProportional;
}
@ -258,7 +270,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setResizeProportional($pValue = true) {
public function setResizeProportional($pValue = true)
{
$this->_resizeProportional = $pValue;
return $this;
}
@ -268,7 +281,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getFilename() {
public function getFilename()
{
return basename($this->_path);
}
@ -277,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getExtension() {
public function getExtension()
{
$parts = explode(".", basename($this->_path));
return end($parts);
}
@ -287,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getPath() {
public function getPath()
{
return $this->_path;
}
@ -299,7 +315,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
@ -322,7 +339,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
. $this->_name
@ -337,7 +355,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -95,7 +95,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return resource
*/
public function getImageResource() {
public function getImageResource()
{
return $this->_imageResource;
}
@ -105,7 +106,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @param $value resource
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setImageResource($value = null) {
public function setImageResource($value = null)
{
$this->_imageResource = $value;
if (!is_null($this->_imageResource)) {
@ -121,7 +123,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getRenderingFunction() {
public function getRenderingFunction()
{
return $this->_renderingFunction;
}
@ -131,7 +134,8 @@ 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) {
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT)
{
$this->_renderingFunction = $value;
return $this;
}
@ -141,7 +145,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getMimeType() {
public function getMimeType()
{
return $this->_mimeType;
}
@ -151,7 +156,8 @@ 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) {
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT)
{
$this->_mimeType = $value;
return $this;
}
@ -161,7 +167,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getIndexedFilename() {
public function getIndexedFilename()
{
$extension = strtolower($this->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
@ -174,7 +181,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_renderingFunction
. $this->_mimeType

View File

@ -89,7 +89,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getLeft() {
public function getLeft()
{
return $this->_left;
}
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setLeft($pValue) {
public function setLeft($pValue)
{
$this->_left = $pValue;
return $this;
}
@ -109,7 +111,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getRight() {
public function getRight()
{
return $this->_right;
}
@ -119,7 +122,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setRight($pValue) {
public function setRight($pValue)
{
$this->_right = $pValue;
return $this;
}
@ -129,7 +133,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getTop() {
public function getTop()
{
return $this->_top;
}
@ -139,7 +144,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setTop($pValue) {
public function setTop($pValue)
{
$this->_top = $pValue;
return $this;
}
@ -149,7 +155,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getBottom() {
public function getBottom()
{
return $this->_bottom;
}
@ -159,7 +166,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setBottom($pValue) {
public function setBottom($pValue)
{
$this->_bottom = $pValue;
return $this;
}
@ -169,7 +177,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getHeader() {
public function getHeader()
{
return $this->_header;
}
@ -179,7 +188,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setHeader($pValue) {
public function setHeader($pValue)
{
$this->_header = $pValue;
return $this;
}
@ -189,7 +199,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getFooter() {
public function getFooter()
{
return $this->_footer;
}
@ -199,7 +210,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setFooter($pValue) {
public function setFooter($pValue)
{
$this->_footer = $pValue;
return $this;
}
@ -207,7 +219,8 @@ class PHPExcel_Worksheet_PageMargins
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -86,7 +86,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return int
*/
public function getZoomScale() {
public function getZoomScale()
{
return $this->_zoomScale;
}
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_SheetView
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_SheetView
*/
public function setZoomScale($pValue = 100) {
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)) {
@ -115,7 +117,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return int
*/
public function getZoomScaleNormal() {
public function getZoomScaleNormal()
{
return $this->_zoomScaleNormal;
}
@ -128,7 +131,8 @@ class PHPExcel_Worksheet_SheetView
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_SheetView
*/
public function setZoomScaleNormal($pValue = 100) {
public function setZoomScaleNormal($pValue = 100)
{
if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScaleNormal = $pValue;
} else {
@ -142,7 +146,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return string
*/
public function getView() {
public function getView()
{
return $this->_sheetviewType;
}
@ -158,11 +163,12 @@ class PHPExcel_Worksheet_SheetView
* @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)
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 {
@ -175,7 +181,8 @@ class PHPExcel_Worksheet_SheetView
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -98,7 +98,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
@ -143,7 +143,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return string
*/
public function getDelimiter() {
public function getDelimiter()
{
return $this->_delimiter;
}
@ -153,7 +154,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Writer_CSV
*/
public function setDelimiter($pValue = ',') {
public function setDelimiter($pValue = ',')
{
$this->_delimiter = $pValue;
return $this;
}
@ -163,7 +165,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return string
*/
public function getEnclosure() {
public function getEnclosure()
{
return $this->_enclosure;
}
@ -173,7 +176,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Writer_CSV
*/
public function setEnclosure($pValue = '"') {
public function setEnclosure($pValue = '"')
{
if ($pValue == '') {
$pValue = null;
}
@ -186,7 +190,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return string
*/
public function getLineEnding() {
public function getLineEnding()
{
return $this->_lineEnding;
}
@ -196,7 +201,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @return PHPExcel_Writer_CSV
*/
public function setLineEnding($pValue = PHP_EOL) {
public function setLineEnding($pValue = PHP_EOL)
{
$this->_lineEnding = $pValue;
return $this;
}
@ -206,7 +212,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return boolean
*/
public function getUseBOM() {
public function getUseBOM()
{
return $this->_useBOM;
}
@ -216,7 +223,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
* @return PHPExcel_Writer_CSV
*/
public function setUseBOM($pValue = false) {
public function setUseBOM($pValue = false)
{
$this->_useBOM = $pValue;
return $this;
}
@ -226,7 +234,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return boolean
*/
public function getExcelCompatibility() {
public function getExcelCompatibility()
{
return $this->_excelCompatibility;
}
@ -237,7 +246,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* Note that this overrides other settings such as useBOM, enclosure and delimiter
* @return PHPExcel_Writer_CSV
*/
public function setExcelCompatibility($pValue = false) {
public function setExcelCompatibility($pValue = false)
{
$this->_excelCompatibility = $pValue;
return $this;
}
@ -247,7 +257,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*
* @return int
*/
public function getSheetIndex() {
public function getSheetIndex()
{
return $this->_sheetIndex;
}
@ -257,7 +268,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param int $pValue Sheet index
* @return PHPExcel_Writer_CSV
*/
public function setSheetIndex($pValue = 0) {
public function setSheetIndex($pValue = 0)
{
$this->_sheetIndex = $pValue;
return $this;
}
@ -269,7 +281,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param array $pValues Array containing values in a row
* @throws PHPExcel_Writer_Exception
*/
private function _writeLine($pFileHandle = null, $pValues = null) {
private function _writeLine($pFileHandle = null, $pValues = null)
{
if (is_array($pValues)) {
// No leading delimiter
$writeDelimiter = false;
@ -301,5 +314,4 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
}
}
}

View File

@ -163,7 +163,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* @param string $pPartName Writer part name
* @return PHPExcel_Writer_Excel2007_WriterPart
*/
public function getWriterPart($pPartName = '') {
public function getWriterPart($pPartName = '')
{
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
return $this->_writerParts[strtolower($pPartName)];
} else {
@ -179,7 +180,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/
public function save($pFilename = null)
{
if ($this->_spreadSheet !== NULL) {
if ($this->_spreadSheet !== null) {
// garbage collect
$this->_spreadSheet->garbageCollect();
@ -193,7 +194,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
}
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE);
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
@ -245,8 +246,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
if ($this->_spreadSheet->hasMacrosCertificate()) {//signed macros ?
// Yes : add the certificate file and the related rels file
$objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate());
$objZip->addFromString('xl/_rels/vbaProject.bin.rels',
$this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
$objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
}
}
}
@ -261,8 +261,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$objZip->addFromString($tmpRootPath.$aPath, $aContent);
}
//the rels for files
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels',
$this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
}
}
@ -274,7 +273,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
if ($customPropertiesPart !== NULL) {
if ($customPropertiesPart !== null) {
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
}
@ -308,7 +307,6 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$chartRef1 = $chartRef2 = 0;
// Add worksheet relationships (drawings, ...)
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
// Add relationships
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
@ -409,7 +407,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* @return PHPExcel
* @throws PHPExcel_Writer_Exception
*/
public function getPHPExcel() {
public function getPHPExcel()
{
if ($this->_spreadSheet !== null) {
return $this->_spreadSheet;
} else {
@ -424,7 +423,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* @throws PHPExcel_Writer_Exception
* @return PHPExcel_Writer_Excel2007
*/
public function setPHPExcel(PHPExcel $pPHPExcel = null) {
public function setPHPExcel(PHPExcel $pPHPExcel = null)
{
$this->_spreadSheet = $pPHPExcel;
return $this;
}
@ -434,7 +434,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return string[]
*/
public function getStringTable() {
public function getStringTable()
{
return $this->_stringTable;
}
@ -443,7 +444,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getStyleHashTable() {
public function getStyleHashTable()
{
return $this->_styleHashTable;
}
@ -452,7 +454,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getStylesConditionalHashTable() {
public function getStylesConditionalHashTable()
{
return $this->_stylesConditionalHashTable;
}
@ -461,7 +464,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getFillHashTable() {
public function getFillHashTable()
{
return $this->_fillHashTable;
}
@ -470,7 +474,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getFontHashTable() {
public function getFontHashTable()
{
return $this->_fontHashTable;
}
@ -479,7 +484,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getBordersHashTable() {
public function getBordersHashTable()
{
return $this->_bordersHashTable;
}
@ -488,7 +494,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getNumFmtHashTable() {
public function getNumFmtHashTable()
{
return $this->_numFmtHashTable;
}
@ -497,7 +504,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return PHPExcel_HashTable
*/
public function getDrawingHashTable() {
public function getDrawingHashTable()
{
return $this->_drawingHashTable;
}
@ -506,7 +514,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*
* @return boolean
*/
public function getOffice2003Compatibility() {
public function getOffice2003Compatibility()
{
return $this->_office2003compatibility;
}
@ -516,9 +525,9 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* @param boolean $pValue Office2003 compatibility?
* @return PHPExcel_Writer_Excel2007
*/
public function setOffice2003Compatibility($pValue = false) {
public function setOffice2003Compatibility($pValue = false)
{
$this->_office2003compatibility = $pValue;
return $this;
}
}

View File

@ -32,9 +32,7 @@
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends
PHPExcel_Writer_Excel2007_WriterPart {
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart {
/**
* Write charts to XML format
*
@ -43,14 +41,11 @@ class PHPExcel_Writer_Excel2007_Chart extends
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeChart(PHPExcel_Chart $pChart = NULL) {
public function writeChart(PHPExcel_Chart $pChart = null) {
// Create XML writer
$objWriter = NULL;
if ($this->getParentWriter()
->getUseDiskCaching()
) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()
->getDiskCachingDirectory());
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
}
@ -86,17 +81,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
$this->_writePlotArea(
$pChart->getPlotArea(),
$pChart->getXAxisLabel(),
$pChart->getYAxisLabel(),
$objWriter,
$pChart->getWorksheet(),
$pChart->getChartAxisX(),
$pChart->getChartAxisY(),
$pChart->getMajorGridlines(),
$pChart->getMinorGridlines()
);
$this->_writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
$this->_writeLegend($pChart->getLegend(), $objWriter);
@ -130,7 +115,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeTitle(PHPExcel_Chart_Title $title = NULL, $objWriter) {
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) {
if (is_null($title)) {
return;
}
@ -151,16 +136,13 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ((is_array($caption)) && (count($caption) > 0)) {
$caption = $caption[0];
}
$this->getParentWriter()
->getWriterPart('stringtable')
->writeRichTextForCharts($objWriter, $caption, 'a');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$layout = $title->getLayout();
$this->_writeLayout($layout, $objWriter);
$this->_writeLayout($title->getLayout(), $objWriter);
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0);
@ -177,7 +159,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLegend(PHPExcel_Chart_Legend $legend = NULL, $objWriter) {
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) {
if (is_null($legend)) {
return;
}
@ -188,8 +170,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $legend->getPosition());
$objWriter->endElement();
$layout = $legend->getLayout();
$this->_writeLayout($layout, $objWriter);
$this->_writeLayout($legend->getLayout(), $objWriter);
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
@ -232,16 +213,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea,
PHPExcel_Chart_Title $xAxisLabel = NULL,
PHPExcel_Chart_Title $yAxisLabel = NULL,
$objWriter,
PHPExcel_Worksheet $pSheet,
PHPExcel_Chart_Axis $xAxis,
PHPExcel_Chart_Axis $yAxis,
PHPExcel_Chart_GridLines $majorGridlines,
PHPExcel_Chart_GridLines $minorGridlines
) {
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines )
{
if (is_null($plotArea)) {
return;
}
@ -255,7 +228,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$this->_writeLayout($layout, $objWriter);
$chartTypes = self::_getChartType($plotArea);
$catIsMultiLevelSeries = $valIsMultiLevelSeries = FALSE;
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
$plotGroupingType = '';
foreach ($chartTypes as $chartType) {
$objWriter->startElement('c:' . $chartType);
@ -265,7 +238,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$plotGroup = $plotArea->getPlotGroupByIndex($i);
$groupType = $plotGroup->getPlotType();
if ($groupType == $chartType) {
$plotStyle = $plotGroup->getPlotStyle();
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
$objWriter->startElement('c:radarStyle');
@ -289,24 +261,17 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->startElement('c:smooth');
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
$objWriter->endElement();
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
) {
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
$objWriter->startElement('c:gapWidth');
$objWriter->writeAttribute('val', 150);
$objWriter->endElement();
if ($plotGroupingType == 'percentStacked' ||
$plotGroupingType == 'stacked'
) {
if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') {
$objWriter->startElement('c:overlap');
$objWriter->writeAttribute('val', 100);
$objWriter->endElement();
}
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:bubbleScale');
$objWriter->writeAttribute('val', 25);
$objWriter->endElement();
@ -315,7 +280,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
$objWriter->startElement('c:hiLowLines');
$objWriter->endElement();
@ -342,11 +306,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$id1 = '75091328';
$id2 = '75089408';
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$objWriter->startElement('c:axId');
$objWriter->writeAttribute('val', $id1);
$objWriter->endElement();
@ -359,7 +319,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
$objWriter->startElement('c:holeSize');
$objWriter->writeAttribute('val', 50);
$objWriter->endElement();
@ -369,11 +328,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeValAx($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
} else {
@ -507,7 +462,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
$objWriter->endElement();
}
$objWriter->startElement('c:numFmt');
@ -820,7 +774,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
if (!is_null($yAxisLabel)) {
$objWriter->startElement('c:title');
$objWriter->startElement('c:tx');
$objWriter->startElement('c:rich');
@ -1030,7 +983,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_unit'));
$objWriter->endElement();
}
}
if ($isMultiLevelSeries) {
@ -1042,7 +994,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
$objWriter->endElement();
}
/**
@ -1053,20 +1004,15 @@ class PHPExcel_Writer_Excel2007_Chart extends
* @return string|array
* @throws PHPExcel_Writer_Exception
*/
private
static function _getChartType($plotArea) {
private static function _getChartType($plotArea) {
$groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) {
$chartType = array(
$plotArea->getPlotGroupByIndex(0)
->getPlotType()
);
$chartType = array($plotArea->getPlotGroupByIndex(0)->getPlotType());
} else {
$chartTypes = array();
for ($i = 0; $i < $groupCount; ++$i) {
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)
->getPlotType();
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType();
}
$chartType = array_unique($chartTypes);
if (count($chartTypes) == 0) {
@ -1090,21 +1036,12 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotGroup($plotGroup,
$groupType,
$objWriter,
&$catIsMultiLevelSeries,
&$valIsMultiLevelSeries,
&$plotGroupingType,
PHPExcel_Worksheet $pSheet
) {
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) {
if (is_null($plotGroup)) {
return;
}
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
$objWriter->startElement('c:barDir');
$objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
$objWriter->endElement();
@ -1121,16 +1058,9 @@ class PHPExcel_Writer_Excel2007_Chart extends
$plotSeriesOrder = $plotGroup->getPlotOrder();
$plotSeriesCount = count($plotSeriesOrder);
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) &&
($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
) {
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) ||
($plotSeriesCount > 1)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
$objWriter->startElement('c:varyColors');
$objWriter->writeAttribute('val', 1);
$objWriter->endElement();
@ -1153,11 +1083,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
$objWriter->endElement();
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$objWriter->startElement('c:dPt');
$objWriter->startElement('c:idx');
$objWriter->writeAttribute('val', 3);
@ -1188,9 +1114,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
// Formatting for the points
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
$objWriter->startElement('c:spPr');
$objWriter->startElement('a:ln');
$objWriter->writeAttribute('w', 12700);
@ -1221,11 +1145,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
}
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
$objWriter->startElement('c:invertIfNegative');
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
@ -1236,11 +1156,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if (!is_null($plotGroup->getPlotStyle())) {
$plotStyle = $plotGroup->getPlotStyle();
if ($plotStyle) {
@ -1251,9 +1167,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
}
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
$objWriter->startElement('c:xVal');
} else {
$objWriter->startElement('c:cat');
@ -1267,9 +1181,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ($plotSeriesValues) {
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
$objWriter->startElement('c:yVal');
} else {
$objWriter->startElement('c:val');
@ -1284,7 +1196,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
$objWriter->endElement();
}
$this->_seriesIndex += $plotSeriesIdx + 1;
@ -1322,7 +1233,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
$objWriter->endElement();
}
/**
@ -1336,12 +1246,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesValues($plotSeriesValues,
$objWriter,
$groupType,
$dataType = 'str',
PHPExcel_Worksheet $pSheet
) {
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) {
if (is_null($plotSeriesValues)) {
return;
}
@ -1391,14 +1296,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->startElement('c:' . $dataType . 'Cache');
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($plotSeriesValues->getFormatCode() !== NULL) &&
($plotSeriesValues->getFormatCode() !== '')
) {
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
$objWriter->startElement('c:formatCode');
$objWriter->writeRawData($plotSeriesValues->getFormatCode());
$objWriter->endElement();
@ -1484,7 +1383,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter) {
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) {
$objWriter->startElement('c:layout');
if (!is_null($layout)) {
@ -1602,5 +1501,4 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
}

View File

@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE)
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -61,80 +61,52 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
// Theme
$this->_writeOverrideContentType(
$objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
// Styles
$this->_writeOverrideContentType(
$objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
// Rels
$this->_writeDefaultContentType(
$objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'
);
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
// XML
$this->_writeDefaultContentType(
$objWriter, 'xml', 'application/xml'
);
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
// VML
$this->_writeDefaultContentType(
$objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'
);
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
// Workbook
if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
// Yes : not standard content but "macroEnabled"
$this->_writeOverrideContentType(
$objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
//... and define a new type for the VBA project
$this->_writeDefaultContentType(
$objWriter, 'bin', 'application/vnd.ms-office.vbaProject'
);
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
// Yes : add needed information
$this->_writeOverrideContentType(
$objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'
);
$this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
}
} else {// no macros in workbook, so standard type
$this->_writeOverrideContentType(
$objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
}
// DocProps
$this->_writeOverrideContentType(
$objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'
);
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
$this->_writeOverrideContentType(
$objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'
);
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) {
$this->_writeOverrideContentType(
$objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'
);
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
}
// Worksheets
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeOverrideContentType(
$objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
}
// Shared strings
$this->_writeOverrideContentType(
$objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types
$chart = 1;
@ -145,17 +117,13 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
// We need a drawing relationship for the worksheet if we have either drawings or charts
if (($drawingCount > 0) || ($chartCount > 0)) {
$this->_writeOverrideContentType(
$objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
}
// If we have charts, then we need a chart relationship for every individual chart
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeOverrideContentType(
$objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
}
}
}
@ -163,9 +131,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
// Comments
for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
$this->_writeOverrideContentType(
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
);
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
}
}
@ -190,9 +156,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if (!isset( $aMediaContentTypes[$extension]) ) {
$aMediaContentTypes[$extension] = $mimeType;
$this->_writeDefaultContentType(
$objWriter, $extension, $mimeType
);
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
}
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
@ -200,9 +164,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$this->_writeDefaultContentType(
$objWriter, $aRibbonType, $mimeType
);
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
}
}
$sheetCount = $pPHPExcel->getSheetCount();
@ -212,9 +174,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath());
$this->_writeDefaultContentType(
$objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]
);
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
}
}
}

View File

@ -268,5 +268,4 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
// Return
return $objWriter->getData();
}
}

View File

@ -199,7 +199,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE)
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -308,7 +308,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;

View File

@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null){
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -71,7 +72,5 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
// Return
return $objWriter->getData();
}
}

View File

@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeVBARelationships(PHPExcel $pPHPExcel = null){
public function writeVBARelationships(PHPExcel $pPHPExcel = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -68,5 +69,4 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
return $objWriter->getData();
}
}

View File

@ -45,14 +45,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
*/
public function createStringTable($pSheet = null, $pExistingTable = null)
{
if ($pSheet !== NULL) {
if ($pSheet !== null) {
// Create string lookup table
$aStringTable = array();
$cellCollection = null;
$aFlippedStringTable = null; // For faster lookup
// Is an existing table given?
if (($pExistingTable !== NULL) && is_array($pExistingTable)) {
if (($pExistingTable !== null) && is_array($pExistingTable)) {
$aStringTable = $pExistingTable;
}
@ -64,14 +64,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$cell = $pSheet->getCell($cellID);
$cellValue = $cell->getValue();
if (!is_object($cellValue) &&
($cellValue !== NULL) &&
($cellValue !== null) &&
$cellValue !== '' &&
!isset($aFlippedStringTable[$cellValue]) &&
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) {
$aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue] = true;
} elseif ($cellValue instanceof PHPExcel_RichText &&
($cellValue !== NULL) &&
($cellValue !== null) &&
!isset($aFlippedStringTable[$cellValue->getHashCode()])) {
$aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue->getHashCode()] = true;
@ -94,7 +94,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
*/
public function writeStringTable($pStringTable = null)
{
if ($pStringTable !== NULL) {
if ($pStringTable !== null) {
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -147,10 +147,12 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param string $prefix Optional Namespace prefix
* @throws PHPExcel_Writer_Exception
*/
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL)
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix = null)
{
if ($prefix !== NULL)
if ($prefix !== null) {
$prefix .= ':';
}
// Loop through rich text elements
$elements = $pRichText->getRichTextElements();
foreach ($elements as $element) {
@ -229,7 +231,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param string $prefix Optional Namespace prefix
* @throws PHPExcel_Writer_Exception
*/
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL)
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix = null)
{
if (!$pRichText instanceof PHPExcel_RichText) {
$textRun = $pRichText;
@ -237,8 +239,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$pRichText->createTextRun($textRun);
}
if ($prefix !== NULL)
if ($prefix !== null) {
$prefix .= ':';
}
// Loop through rich text elements
$elements = $pRichText->getRichTextElements();
foreach ($elements as $element) {

View File

@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
// Gradient fill
$this->_writeGradientFill($objWriter, $pFill);
} elseif($pFill->getFillType() !== NULL) {
} elseif ($pFill->getFillType() !== null) {
// Pattern fill
$this->_writePatternFill($objWriter, $pFill);
}
@ -285,60 +285,60 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
// formatting style dialog
if ($pFont->getBold() !== NULL) {
if ($pFont->getBold() !== null) {
$objWriter->startElement('b');
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
$objWriter->endElement();
}
// Italic
if ($pFont->getItalic() !== NULL) {
if ($pFont->getItalic() !== null) {
$objWriter->startElement('i');
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
$objWriter->endElement();
}
// Strikethrough
if ($pFont->getStrikethrough() !== NULL) {
if ($pFont->getStrikethrough() !== null) {
$objWriter->startElement('strike');
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
$objWriter->endElement();
}
// Underline
if ($pFont->getUnderline() !== NULL) {
if ($pFont->getUnderline() !== null) {
$objWriter->startElement('u');
$objWriter->writeAttribute('val', $pFont->getUnderline());
$objWriter->endElement();
}
// Superscript / subscript
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
$objWriter->startElement('vertAlign');
if ($pFont->getSuperScript() === TRUE) {
if ($pFont->getSuperScript() === true) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($pFont->getSubScript() === TRUE) {
} else if ($pFont->getSubScript() === true) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
}
// Size
if ($pFont->getSize() !== NULL) {
if ($pFont->getSize() !== null) {
$objWriter->startElement('sz');
$objWriter->writeAttribute('val', $pFont->getSize());
$objWriter->endElement();
}
// Foreground color
if ($pFont->getColor()->getARGB() !== NULL) {
if ($pFont->getColor()->getARGB() !== null) {
$objWriter->startElement('color');
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
$objWriter->endElement();
}
// Name
if ($pFont->getName() !== NULL) {
if ($pFont->getName() !== null) {
$objWriter->startElement('name');
$objWriter->writeAttribute('val', $pFont->getName());
$objWriter->endElement();
@ -482,14 +482,14 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// alignment
$objWriter->startElement('alignment');
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
if ($pStyle->getAlignment()->getHorizontal() !== null) {
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
}
if ($pStyle->getAlignment()->getVertical() !== NULL) {
if ($pStyle->getAlignment()->getVertical() !== null) {
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
}
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
if ($pStyle->getAlignment()->getTextRotation() !== null) {
$textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation();
@ -504,16 +504,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$this->_writeBorder($objWriter, $pStyle->getBorders());
// protection
if (($pStyle->getProtection()->getLocked() !== NULL) ||
($pStyle->getProtection()->getHidden() !== NULL)) {
if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
$objWriter->startElement('protection');
if (($pStyle->getProtection()->getLocked() !== NULL) &&
if (($pStyle->getProtection()->getLocked() !== null) &&
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
if (($pStyle->getProtection()->getHidden() !== NULL) &&
if (($pStyle->getProtection()->getHidden() !== null) &&
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
@ -562,7 +561,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$formatCode = $pNumberFormat->getFormatCode();
// numFmt
if ($formatCode !== NULL) {
if ($formatCode !== null) {
$objWriter->startElement('numFmt');
$objWriter->writeAttribute('numFmtId', ($pId + 164));
$objWriter->writeAttribute('formatCode', $formatCode);
@ -579,9 +578,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
*/
public function allStyles(PHPExcel $pPHPExcel = null)
{
$aStyles = $pPHPExcel->getCellXfCollection();
return $aStyles;
return $pPHPExcel->getCellXfCollection();
}
/**

View File

@ -845,7 +845,6 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('typeface', $typeface);
$objWriter->endElement();
}
}
/**
@ -866,6 +865,5 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement();
}
}
}

View File

@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE)
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = false)
{
// Create XML writer
$objWriter = null;
@ -190,7 +190,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
* @throws PHPExcel_Writer_Exception
*/
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE)
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
{
$objWriter->startElement('calcPr');

View File

@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE)
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = false)
{
if (!is_null($pSheet)) {
// Create XML writer
@ -205,16 +205,16 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception
*/
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL)
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// sheetViews
$objWriter->startElement('sheetViews');
// Sheet selected?
$sheetSelected = false;
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex())
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
$sheetSelected = true;
}
// sheetView
$objWriter->startElement('sheetView');
@ -282,8 +282,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (($xSplit > 1) && ($ySplit > 1)) {
// Write additional selections if more than two panes (ie both an X and a Y split)
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement();
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'topRight');
$objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'bottomLeft');
$objWriter->endElement();
}
}
@ -787,11 +791,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Dynamic Filter Rule
$objWriter->writeAttribute('type', $rule->getGrouping());
$val = $column->getAttribute('val');
if ($val !== NULL) {
if ($val !== null) {
$objWriter->writeAttribute('val', $val);
}
$maxVal = $column->getAttribute('maxVal');
if ($maxVal !== NULL) {
if ($maxVal !== null) {
$objWriter->writeAttribute('maxVal', $maxVal);
}
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
@ -984,12 +988,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$rowDimension = $pSheet->getRowDimension($currentRow);
// Write current row?
$writeCurrentRow = isset($cellsByRow[$currentRow]) ||
$rowDimension->getRowHeight() >= 0 ||
$rowDimension->getVisible() == false ||
$rowDimension->getCollapsed() == true ||
$rowDimension->getOutlineLevel() > 0 ||
$rowDimension->getXfIndex() !== null;
$writeCurrentRow = isset($cellsByRow[$currentRow]) || $rowDimension->getRowHeight() >= 0 || $rowDimension->getVisible() == false || $rowDimension->getCollapsed() == true || $rowDimension->getOutlineLevel() > 0 || $rowDimension->getXfIndex() !== null;
if ($writeCurrentRow) {
// Start a new row
@ -1172,7 +1171,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param boolean $includeCharts Flag indicating if we should include drawing details for charts
* @throws PHPExcel_Writer_Exception
*/
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE)
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false)
{
$chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
// If sheet contains drawings, add the relationships

View File

@ -679,21 +679,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
} elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
if ($dataProp['data']['data'] == false) {
$dataSection_Content .= pack('V', 0x0000);
} else {
$dataSection_Content .= pack('V', 0x0001);
}
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@ -705,13 +702,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
}
else {
} else {
// Data Type Not Used at the moment
$dataSection_Content .= $dataProp['data']['data'];
@ -867,13 +862,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@ -885,13 +878,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
}
else {
} else {
// Data Type Not Used at the moment
}
}

View File

@ -105,7 +105,8 @@ class PHPExcel_Writer_Excel5_Escher
// dgg data
$dggData =
pack('VVVV',
pack(
'VVVV',
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
$this->_object->getCSpSaved(),

View File

@ -1130,60 +1130,39 @@ class PHPExcel_Writer_Excel5_Parser
break;
default:
// if it's a reference A1 or $A$1 or $A1 or A$1
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and
($this->_lookahead != '!')) {
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.') and ($this->_lookahead != '!')) {
return $token;
}
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
// if it's a range A1:A2 or $A$1:$A$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
} elseif (is_numeric($token) and (!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and ($this->_lookahead != '!') and ($this->_lookahead != ':')) {
// If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
return $token;
}
} elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
// If it's a string (of maximum 255 characters)
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
return $token;
}
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
// If it's an error code
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $token;
}
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
return $token;
}
} elseif (substr($token, -1) == ')') {
// It's an argument of some description (e.g. a named range),
// precise nature yet to be determined
elseif(substr($token,-1) == ')') {
return $token;
}
return '';
@ -1266,7 +1245,10 @@ class PHPExcel_Writer_Excel5_Parser
// If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
$tmp = str_replace('""', '"', $this->_current_token);
if (($tmp == '"') || ($tmp == '')) $tmp = '""'; // Trap for "" that has been used for an empty string
if (($tmp == '"') || ($tmp == '')) {
// Trap for "" that has been used for an empty string
$tmp = '""';
}
$result = $this->_createTree($tmp, '', '');
$this->_advance();
return $result;
@ -1375,38 +1357,33 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a reference
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
{
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
{
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
@ -1414,8 +1391,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
@ -1423,8 +1399,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's a number or a percent
elseif (is_numeric($this->_current_token))
{
elseif (is_numeric($this->_current_token)) {
if ($this->_lookahead == '%') {
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
@ -1435,8 +1410,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
{
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
$result = $this->_func();
return $result;
}
@ -1462,13 +1436,10 @@ class PHPExcel_Writer_Excel5_Parser
while ($this->_current_token != ')') {
/**/
if ($num_args > 0) {
if ($this->_current_token == "," or
$this->_current_token == ";")
{
if ($this->_current_token == "," || $this->_current_token == ";") {
$this->_advance(); // eat the "," or ";"
} else {
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ".
"function $function, arg #{$num_args}");
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
}
$result2 = $this->_condition();
$result = $this->_createTree('arg', $result, $result2);
@ -1560,8 +1531,7 @@ class PHPExcel_Writer_Excel5_Parser
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']]))
{
!isset($this->ptg[$tree['value']])) {
// left subtree for a function is always an array.
if ($tree['left'] != '') {
$left_tree = $this->toReversePolish($tree['left']);

View File

@ -845,7 +845,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// option flags
$options = ($isHidden ? 0x21 : 0x00);
$extra = pack('Cvvvvv',
$extra = pack(
'Cvvvvv',
0x3B,
$sheetIndex - 1,
$rangeBounds[0][1] - 1,

View File

@ -2736,7 +2736,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($spTypes[$i] == 0x00C9) {
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV',
pack(
'vvvvvVVV',
0x0015, // 0x0015 = ftCmo
0x0012, // length of ftCmo data
0x0014, // object type, 0x0014 = filter
@ -2756,7 +2757,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
} else {
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV',
pack(
'vvvvvVVV',
0x0015, // 0x0015 = ftCmo
0x0012, // length of ftCmo data
0x0008, // object type, 0x0008 = picture
@ -2770,7 +2772,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// ftEnd
$objData .=
pack('vv',
pack(
'vv',
0x0000, // 0x0000 = ftEnd
0x0000 // length of ftEnd data
);