diff --git a/Classes/PHPExcel/Chart/DataSeries.php b/Classes/PHPExcel/Chart/DataSeries.php index 711f16ce..c5ddc095 100644 --- a/Classes/PHPExcel/Chart/DataSeries.php +++ b/Classes/PHPExcel/Chart/DataSeries.php @@ -166,7 +166,8 @@ class PHPExcel_Chart_DataSeries * * @return string */ - public function getPlotType() { + public function getPlotType() + { return $this->_plotType; } @@ -176,7 +177,8 @@ class PHPExcel_Chart_DataSeries * @param string $plotType * @return PHPExcel_Chart_DataSeries */ - public function setPlotType($plotType = '') { + public function setPlotType($plotType = '') + { $this->_plotType = $plotType; return $this; } @@ -186,7 +188,8 @@ class PHPExcel_Chart_DataSeries * * @return string */ - public function getPlotGrouping() { + public function getPlotGrouping() + { return $this->_plotGrouping; } @@ -196,7 +199,8 @@ class PHPExcel_Chart_DataSeries * @param string $groupingType * @return PHPExcel_Chart_DataSeries */ - public function setPlotGrouping($groupingType = null) { + public function setPlotGrouping($groupingType = null) + { $this->_plotGrouping = $groupingType; return $this; } @@ -206,7 +210,8 @@ class PHPExcel_Chart_DataSeries * * @return string */ - public function getPlotDirection() { + public function getPlotDirection() + { return $this->_plotDirection; } @@ -216,7 +221,8 @@ class PHPExcel_Chart_DataSeries * @param string $plotDirection * @return PHPExcel_Chart_DataSeries */ - public function setPlotDirection($plotDirection = null) { + public function setPlotDirection($plotDirection = null) + { $this->_plotDirection = $plotDirection; return $this; } @@ -226,7 +232,8 @@ class PHPExcel_Chart_DataSeries * * @return string */ - public function getPlotOrder() { + public function getPlotOrder() + { return $this->_plotOrder; } @@ -235,7 +242,8 @@ class PHPExcel_Chart_DataSeries * * @return array of PHPExcel_Chart_DataSeriesValues */ - public function getPlotLabels() { + public function getPlotLabels() + { return $this->_plotLabel; } @@ -244,11 +252,12 @@ class PHPExcel_Chart_DataSeries * * @return PHPExcel_Chart_DataSeriesValues */ - public function getPlotLabelByIndex($index) { + public function getPlotLabelByIndex($index) + { $keys = array_keys($this->_plotLabel); - if (in_array($index,$keys)) { + if (in_array($index, $keys)) { return $this->_plotLabel[$index]; - } elseif(isset($keys[$index])) { + } elseif (isset($keys[$index])) { return $this->_plotLabel[$keys[$index]]; } return false; @@ -259,7 +268,8 @@ class PHPExcel_Chart_DataSeries * * @return array of PHPExcel_Chart_DataSeriesValues */ - public function getPlotCategories() { + public function getPlotCategories() + { return $this->_plotCategory; } @@ -268,11 +278,12 @@ class PHPExcel_Chart_DataSeries * * @return PHPExcel_Chart_DataSeriesValues */ - public function getPlotCategoryByIndex($index) { + public function getPlotCategoryByIndex($index) + { $keys = array_keys($this->_plotCategory); - if (in_array($index,$keys)) { + if (in_array($index, $keys)) { return $this->_plotCategory[$index]; - } elseif(isset($keys[$index])) { + } elseif (isset($keys[$index])) { return $this->_plotCategory[$keys[$index]]; } return false; @@ -283,7 +294,8 @@ class PHPExcel_Chart_DataSeries * * @return string */ - public function getPlotStyle() { + public function getPlotStyle() + { return $this->_plotStyle; } @@ -293,7 +305,8 @@ class PHPExcel_Chart_DataSeries * @param string $plotStyle * @return PHPExcel_Chart_DataSeries */ - public function setPlotStyle($plotStyle = null) { + public function setPlotStyle($plotStyle = null) + { $this->_plotStyle = $plotStyle; return $this; } @@ -303,7 +316,8 @@ class PHPExcel_Chart_DataSeries * * @return array of PHPExcel_Chart_DataSeriesValues */ - public function getPlotValues() { + public function getPlotValues() + { return $this->_plotValues; } @@ -312,11 +326,12 @@ class PHPExcel_Chart_DataSeries * * @return PHPExcel_Chart_DataSeriesValues */ - public function getPlotValuesByIndex($index) { + public function getPlotValuesByIndex($index) + { $keys = array_keys($this->_plotValues); - if (in_array($index,$keys)) { + if (in_array($index, $keys)) { return $this->_plotValues[$index]; - } elseif(isset($keys[$index])) { + } elseif (isset($keys[$index])) { return $this->_plotValues[$keys[$index]]; } return false; @@ -327,7 +342,8 @@ class PHPExcel_Chart_DataSeries * * @return integer */ - public function getPlotSeriesCount() { + public function getPlotSeriesCount() + { return count($this->_plotValues); } @@ -336,7 +352,8 @@ class PHPExcel_Chart_DataSeries * * @return boolean */ - public function getSmoothLine() { + public function getSmoothLine() + { return $this->_smoothLine; } @@ -346,23 +363,28 @@ class PHPExcel_Chart_DataSeries * @param boolean $smoothLine * @return PHPExcel_Chart_DataSeries */ - public function setSmoothLine($smoothLine = TRUE) { + public function setSmoothLine($smoothLine = true) + { $this->_smoothLine = $smoothLine; return $this; } - public function refresh(PHPExcel_Worksheet $worksheet) { + public function refresh(PHPExcel_Worksheet $worksheet) + { foreach($this->_plotValues as $plotValues) { - if ($plotValues !== NULL) - $plotValues->refresh($worksheet, TRUE); + if ($plotValues !== null) { + $plotValues->refresh($worksheet, true); + } } foreach($this->_plotLabel as $plotValues) { - if ($plotValues !== NULL) - $plotValues->refresh($worksheet, TRUE); + if ($plotValues !== null) { + $plotValues->refresh($worksheet, true); + } } foreach($this->_plotCategory as $plotValues) { - if ($plotValues !== NULL) - $plotValues->refresh($worksheet, FALSE); + if ($plotValues !== null) { + $plotValues->refresh($worksheet, false); + } } } diff --git a/Classes/PHPExcel/Chart/Layout.php b/Classes/PHPExcel/Chart/Layout.php index d524e224..53a447c9 100644 --- a/Classes/PHPExcel/Chart/Layout.php +++ b/Classes/PHPExcel/Chart/Layout.php @@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout * * @var string */ - private $_layoutTarget = NULL; + private $_layoutTarget = null; /** * X Mode * * @var string */ - private $_xMode = NULL; + private $_xMode = null; /** * Y Mode * * @var string */ - private $_yMode = NULL; + private $_yMode = null; /** * X-Position * * @var float */ - private $_xPos = NULL; + private $_xPos = null; /** * Y-Position * * @var float */ - private $_yPos = NULL; + private $_yPos = null; /** * width * * @var float */ - private $_width = NULL; + private $_width = null; /** * height * * @var float */ - private $_height = NULL; + private $_height = null; /** * show legend key @@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showLegendKey = NULL; + private $_showLegendKey = null; /** * show value @@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showVal = NULL; + private $_showVal = null; /** * show category name @@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showCatName = NULL; + private $_showCatName = null; /** * show data series name @@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showSerName = NULL; + private $_showSerName = null; /** * show percentage @@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showPercent = NULL; + private $_showPercent = null; /** * show bubble size * * @var boolean */ - private $_showBubbleSize = NULL; + private $_showBubbleSize = null; /** * show leader lines @@ -137,21 +137,35 @@ class PHPExcel_Chart_Layout * * @var boolean */ - private $_showLeaderLines = NULL; + private $_showLeaderLines = null; /** * Create a new PHPExcel_Chart_Layout */ - public function __construct($layout=array()) + public function __construct($layout = array()) { - if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; } - if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; } - if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; } - if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; } - if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; } - if (isset($layout['w'])) { $this->_width = (float) $layout['w']; } - if (isset($layout['h'])) { $this->_height = (float) $layout['h']; } + if (isset($layout['layoutTarget'])) { + $this->_layoutTarget = $layout['layoutTarget']; + } + if (isset($layout['xMode'])) { + $this->_xMode = $layout['xMode']; + } + if (isset($layout['yMode'])) { + $this->_yMode = $layout['yMode']; + } + if (isset($layout['x'])) { + $this->_xPos = (float) $layout['x']; + } + if (isset($layout['y'])) { + $this->_yPos = (float) $layout['y']; + } + if (isset($layout['w'])) { + $this->_width = (float) $layout['w']; + } + if (isset($layout['h'])) { + $this->_height = (float) $layout['h']; + } } /** @@ -159,7 +173,8 @@ class PHPExcel_Chart_Layout * * @return string */ - public function getLayoutTarget() { + public function getLayoutTarget() + { return $this->_layoutTarget; } @@ -169,7 +184,8 @@ class PHPExcel_Chart_Layout * @param Layout Target $value * @return PHPExcel_Chart_Layout */ - public function setLayoutTarget($value) { + public function setLayoutTarget($value) + { $this->_layoutTarget = $value; return $this; } @@ -179,7 +195,8 @@ class PHPExcel_Chart_Layout * * @return string */ - public function getXMode() { + public function getXMode() + { return $this->_xMode; } @@ -189,7 +206,8 @@ class PHPExcel_Chart_Layout * @param X-Mode $value * @return PHPExcel_Chart_Layout */ - public function setXMode($value) { + public function setXMode($value) + { $this->_xMode = $value; return $this; } @@ -199,7 +217,8 @@ class PHPExcel_Chart_Layout * * @return string */ - public function getYMode() { + public function getYMode() + { return $this->_yMode; } @@ -209,7 +228,8 @@ class PHPExcel_Chart_Layout * @param Y-Mode $value * @return PHPExcel_Chart_Layout */ - public function setYMode($value) { + public function setYMode($value) + { $this->_yMode = $value; return $this; } @@ -219,7 +239,8 @@ class PHPExcel_Chart_Layout * * @return number */ - public function getXPosition() { + public function getXPosition() + { return $this->_xPos; } @@ -229,7 +250,8 @@ class PHPExcel_Chart_Layout * @param X-Position $value * @return PHPExcel_Chart_Layout */ - public function setXPosition($value) { + public function setXPosition($value) + { $this->_xPos = $value; return $this; } @@ -239,7 +261,8 @@ class PHPExcel_Chart_Layout * * @return number */ - public function getYPosition() { + public function getYPosition() + { return $this->_yPos; } @@ -249,7 +272,8 @@ class PHPExcel_Chart_Layout * @param Y-Position $value * @return PHPExcel_Chart_Layout */ - public function setYPosition($value) { + public function setYPosition($value) + { $this->_yPos = $value; return $this; } @@ -259,7 +283,8 @@ class PHPExcel_Chart_Layout * * @return number */ - public function getWidth() { + public function getWidth() + { return $this->_width; } @@ -269,7 +294,8 @@ class PHPExcel_Chart_Layout * @param Width $value * @return PHPExcel_Chart_Layout */ - public function setWidth($value) { + public function setWidth($value) + { $this->_width = $value; return $this; } @@ -279,7 +305,8 @@ class PHPExcel_Chart_Layout * * @return number */ - public function getHeight() { + public function getHeight() + { return $this->_height; } @@ -289,7 +316,8 @@ class PHPExcel_Chart_Layout * @param Height $value * @return PHPExcel_Chart_Layout */ - public function setHeight($value) { + public function setHeight($value) + { $this->_height = $value; return $this; } @@ -300,7 +328,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowLegendKey() { + public function getShowLegendKey() + { return $this->_showLegendKey; } @@ -311,7 +340,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show legend key * @return PHPExcel_Chart_Layout */ - public function setShowLegendKey($value) { + public function setShowLegendKey($value) + { $this->_showLegendKey = $value; return $this; } @@ -321,7 +351,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowVal() { + public function getShowVal() + { return $this->_showVal; } @@ -332,7 +363,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show val * @return PHPExcel_Chart_Layout */ - public function setShowVal($value) { + public function setShowVal($value) + { $this->_showVal = $value; return $this; } @@ -342,7 +374,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowCatName() { + public function getShowCatName() + { return $this->_showCatName; } @@ -353,7 +386,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show cat name * @return PHPExcel_Chart_Layout */ - public function setShowCatName($value) { + public function setShowCatName($value) + { $this->_showCatName = $value; return $this; } @@ -363,7 +397,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowSerName() { + public function getShowSerName() + { return $this->_showSerName; } @@ -374,7 +409,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show series name * @return PHPExcel_Chart_Layout */ - public function setShowSerName($value) { + public function setShowSerName($value) + { $this->_showSerName = $value; return $this; } @@ -384,7 +420,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowPercent() { + public function getShowPercent() + { return $this->_showPercent; } @@ -395,7 +432,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show percentage * @return PHPExcel_Chart_Layout */ - public function setShowPercent($value) { + public function setShowPercent($value) + { $this->_showPercent = $value; return $this; } @@ -405,7 +443,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowBubbleSize() { + public function getShowBubbleSize() + { return $this->_showBubbleSize; } @@ -416,7 +455,8 @@ class PHPExcel_Chart_Layout * @param boolean $value Show bubble size * @return PHPExcel_Chart_Layout */ - public function setShowBubbleSize($value) { + public function setShowBubbleSize($value) + { $this->_showBubbleSize = $value; return $this; } @@ -426,7 +466,8 @@ class PHPExcel_Chart_Layout * * @return boolean */ - public function getShowLeaderLines() { + public function getShowLeaderLines() + { return $this->_showLeaderLines; } @@ -437,9 +478,9 @@ class PHPExcel_Chart_Layout * @param boolean $value Show leader lines * @return PHPExcel_Chart_Layout */ - public function setShowLeaderLines($value) { + public function setShowLeaderLines($value) + { $this->_showLeaderLines = $value; return $this; } - } diff --git a/Classes/PHPExcel/Chart/PlotArea.php b/Classes/PHPExcel/Chart/PlotArea.php index 657fe981..c2ff157e 100644 --- a/Classes/PHPExcel/Chart/PlotArea.php +++ b/Classes/PHPExcel/Chart/PlotArea.php @@ -55,7 +55,8 @@ class PHPExcel_Chart_PlotArea * * @return PHPExcel_Chart_Layout */ - public function getLayout() { + public function getLayout() + { return $this->_layout; } @@ -64,7 +65,8 @@ class PHPExcel_Chart_PlotArea * * @return array of PHPExcel_Chart_DataSeries */ - public function getPlotGroupCount() { + public function getPlotGroupCount() + { return count($this->_plotSeries); } @@ -73,9 +75,10 @@ class PHPExcel_Chart_PlotArea * * @return integer */ - public function getPlotSeriesCount() { + public function getPlotSeriesCount() + { $seriesCount = 0; - foreach($this->_plotSeries as $plot) { + foreach ($this->_plotSeries as $plot) { $seriesCount += $plot->getPlotSeriesCount(); } return $seriesCount; @@ -86,7 +89,8 @@ class PHPExcel_Chart_PlotArea * * @return array of PHPExcel_Chart_DataSeries */ - public function getPlotGroup() { + public function getPlotGroup() + { return $this->_plotSeries; } @@ -95,7 +99,8 @@ class PHPExcel_Chart_PlotArea * * @return PHPExcel_Chart_DataSeries */ - public function getPlotGroupByIndex($index) { + public function getPlotGroupByIndex($index) + { return $this->_plotSeries[$index]; } @@ -105,16 +110,17 @@ class PHPExcel_Chart_PlotArea * @param [PHPExcel_Chart_DataSeries] * @return PHPExcel_Chart_PlotArea */ - public function setPlotSeries($plotSeries = array()) { + public function setPlotSeries($plotSeries = array()) + { $this->_plotSeries = $plotSeries; return $this; } - public function refresh(PHPExcel_Worksheet $worksheet) { - foreach($this->_plotSeries as $plotSeries) { + public function refresh(PHPExcel_Worksheet $worksheet) + { + foreach ($this->_plotSeries as $plotSeries) { $plotSeries->refresh($worksheet); } } - } diff --git a/Classes/PHPExcel/Chart/Properties.php b/Classes/PHPExcel/Chart/Properties.php index e0bbb56a..3181f654 100644 --- a/Classes/PHPExcel/Chart/Properties.php +++ b/Classes/PHPExcel/Chart/Properties.php @@ -8,353 +8,353 @@ abstract class PHPExcel_Chart_Properties { + const + EXCEL_COLOR_TYPE_STANDARD = 'prstClr', + EXCEL_COLOR_TYPE_SCHEME = 'schemeClr', + EXCEL_COLOR_TYPE_ARGB = 'srgbClr'; - const - EXCEL_COLOR_TYPE_STANDARD = 'prstClr', - EXCEL_COLOR_TYPE_SCHEME = 'schemeClr', - EXCEL_COLOR_TYPE_ARGB = 'srgbClr'; + const + AXIS_LABELS_LOW = 'low', + AXIS_LABELS_HIGH = 'high', + AXIS_LABELS_NEXT_TO = 'nextTo', + AXIS_LABELS_NONE = 'none'; - const - AXIS_LABELS_LOW = 'low', - AXIS_LABELS_HIGH = 'high', - AXIS_LABELS_NEXT_TO = 'nextTo', - AXIS_LABELS_NONE = 'none'; + const + TICK_MARK_NONE = 'none', + TICK_MARK_INSIDE = 'in', + TICK_MARK_OUTSIDE = 'out', + TICK_MARK_CROSS = 'cross'; - const - TICK_MARK_NONE = 'none', - TICK_MARK_INSIDE = 'in', - TICK_MARK_OUTSIDE = 'out', - TICK_MARK_CROSS = 'cross'; + const + HORIZONTAL_CROSSES_AUTOZERO = 'autoZero', + HORIZONTAL_CROSSES_MAXIMUM = 'max'; - const - HORIZONTAL_CROSSES_AUTOZERO = 'autoZero', - HORIZONTAL_CROSSES_MAXIMUM = 'max'; + const + FORMAT_CODE_GENERAL = 'General', + FORMAT_CODE_NUMBER = '#,##0.00', + FORMAT_CODE_CURRENCY = '$#,##0.00', + FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)', + FORMAT_CODE_DATE = 'm/d/yyyy', + FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM', + FORMAT_CODE_PERCENTAGE = '0.00%', + FORMAT_CODE_FRACTION = '# ?/?', + FORMAT_CODE_SCIENTIFIC = '0.00E+00', + FORMAT_CODE_TEXT = '@', + FORMAT_CODE_SPECIAL = '00000'; - const - FORMAT_CODE_GENERAL = 'General', - FORMAT_CODE_NUMBER = '#,##0.00', - FORMAT_CODE_CURRENCY = '$#,##0.00', - FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)', - FORMAT_CODE_DATE = 'm/d/yyyy', - FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM', - FORMAT_CODE_PERCENTAGE = '0.00%', - FORMAT_CODE_FRACTION = '# ?/?', - FORMAT_CODE_SCIENTIFIC = '0.00E+00', - FORMAT_CODE_TEXT = '@', - FORMAT_CODE_SPECIAL = '00000'; + const + ORIENTATION_NORMAL = 'minMax', + ORIENTATION_REVERSED = 'maxMin'; - const - ORIENTATION_NORMAL = 'minMax', - ORIENTATION_REVERSED = 'maxMin'; + const + LINE_STYLE_COMPOUND_SIMPLE = 'sng', + LINE_STYLE_COMPOUND_DOUBLE = 'dbl', + LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin', + LINE_STYLE_COMPOUND_THINTHICK = 'thinThick', + LINE_STYLE_COMPOUND_TRIPLE = 'tri', - const - LINE_STYLE_COMPOUND_SIMPLE = 'sng', - LINE_STYLE_COMPOUND_DOUBLE = 'dbl', - LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin', - LINE_STYLE_COMPOUND_THINTHICK = 'thinThick', - LINE_STYLE_COMPOUND_TRIPLE = 'tri', + LINE_STYLE_DASH_SOLID = 'solid', + LINE_STYLE_DASH_ROUND_DOT = 'sysDot', + LINE_STYLE_DASH_SQUERE_DOT = 'sysDash', + LINE_STYPE_DASH_DASH = 'dash', + LINE_STYLE_DASH_DASH_DOT = 'dashDot', + LINE_STYLE_DASH_LONG_DASH = 'lgDash', + LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot', + LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot', - LINE_STYLE_DASH_SOLID = 'solid', - LINE_STYLE_DASH_ROUND_DOT = 'sysDot', - LINE_STYLE_DASH_SQUERE_DOT = 'sysDash', - LINE_STYPE_DASH_DASH = 'dash', - LINE_STYLE_DASH_DASH_DOT = 'dashDot', - LINE_STYLE_DASH_LONG_DASH = 'lgDash', - LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot', - LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot', + LINE_STYLE_CAP_SQUARE = 'sq', + LINE_STYLE_CAP_ROUND = 'rnd', + LINE_STYLE_CAP_FLAT = 'flat', - LINE_STYLE_CAP_SQUARE = 'sq', - LINE_STYLE_CAP_ROUND = 'rnd', - LINE_STYLE_CAP_FLAT = 'flat', + LINE_STYLE_JOIN_ROUND = 'bevel', + LINE_STYLE_JOIN_MITER = 'miter', + LINE_STYLE_JOIN_BEVEL = 'bevel', - LINE_STYLE_JOIN_ROUND = 'bevel', - LINE_STYLE_JOIN_MITER = 'miter', - LINE_STYLE_JOIN_BEVEL = 'bevel', + LINE_STYLE_ARROW_TYPE_NOARROW = NULL, + LINE_STYLE_ARROW_TYPE_ARROW = 'triangle', + LINE_STYLE_ARROW_TYPE_OPEN = 'arrow', + LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth', + LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond', + LINE_STYLE_ARROW_TYPE_OVAL = 'oval', - LINE_STYLE_ARROW_TYPE_NOARROW = NULL, - LINE_STYLE_ARROW_TYPE_ARROW = 'triangle', - LINE_STYLE_ARROW_TYPE_OPEN = 'arrow', - LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth', - LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond', - LINE_STYLE_ARROW_TYPE_OVAL = 'oval', + LINE_STYLE_ARROW_SIZE_1 = 1, + LINE_STYLE_ARROW_SIZE_2 = 2, + LINE_STYLE_ARROW_SIZE_3 = 3, + LINE_STYLE_ARROW_SIZE_4 = 4, + LINE_STYLE_ARROW_SIZE_5 = 5, + LINE_STYLE_ARROW_SIZE_6 = 6, + LINE_STYLE_ARROW_SIZE_7 = 7, + LINE_STYLE_ARROW_SIZE_8 = 8, + LINE_STYLE_ARROW_SIZE_9 = 9; - LINE_STYLE_ARROW_SIZE_1 = 1, - LINE_STYLE_ARROW_SIZE_2 = 2, - LINE_STYLE_ARROW_SIZE_3 = 3, - LINE_STYLE_ARROW_SIZE_4 = 4, - LINE_STYLE_ARROW_SIZE_5 = 5, - LINE_STYLE_ARROW_SIZE_6 = 6, - LINE_STYLE_ARROW_SIZE_7 = 7, - LINE_STYLE_ARROW_SIZE_8 = 8, - LINE_STYLE_ARROW_SIZE_9 = 9; + const + SHADOW_PRESETS_NOSHADOW = NULL, + SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1, + SHADOW_PRESETS_OUTER_BOTTOM = 2, + SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3, + SHADOW_PRESETS_OUTER_RIGHT = 4, + SHADOW_PRESETS_OUTER_CENTER = 5, + SHADOW_PRESETS_OUTER_LEFT = 6, + SHADOW_PRESETS_OUTER_TOP_RIGHT = 7, + SHADOW_PRESETS_OUTER_TOP = 8, + SHADOW_PRESETS_OUTER_TOP_LEFT = 9, + SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10, + SHADOW_PRESETS_INNER_BOTTOM = 11, + SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12, + SHADOW_PRESETS_INNER_RIGHT = 13, + SHADOW_PRESETS_INNER_CENTER = 14, + SHADOW_PRESETS_INNER_LEFT = 15, + SHADOW_PRESETS_INNER_TOP_RIGHT = 16, + SHADOW_PRESETS_INNER_TOP = 17, + SHADOW_PRESETS_INNER_TOP_LEFT = 18, + SHADOW_PRESETS_PERSPECTIVE_BELOW = 19, + SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20, + SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21, + SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22, + SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; - const - SHADOW_PRESETS_NOSHADOW = NULL, - SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1, - SHADOW_PRESETS_OUTER_BOTTOM = 2, - SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3, - SHADOW_PRESETS_OUTER_RIGHT = 4, - SHADOW_PRESETS_OUTER_CENTER = 5, - SHADOW_PRESETS_OUTER_LEFT = 6, - SHADOW_PRESETS_OUTER_TOP_RIGHT = 7, - SHADOW_PRESETS_OUTER_TOP = 8, - SHADOW_PRESETS_OUTER_TOP_LEFT = 9, - SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10, - SHADOW_PRESETS_INNER_BOTTOM = 11, - SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12, - SHADOW_PRESETS_INNER_RIGHT = 13, - SHADOW_PRESETS_INNER_CENTER = 14, - SHADOW_PRESETS_INNER_LEFT = 15, - SHADOW_PRESETS_INNER_TOP_RIGHT = 16, - SHADOW_PRESETS_INNER_TOP = 17, - SHADOW_PRESETS_INNER_TOP_LEFT = 18, - SHADOW_PRESETS_PERSPECTIVE_BELOW = 19, - SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20, - SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21, - SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22, - SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; - - protected function getExcelPointsWidth($width) { - return $width * 12700; - } - - protected function getExcelPointsAngle($angle) { - return $angle * 60000; - } - - protected function getTrueAlpha($alpha) { - return (string) 100 - $alpha . '000'; - } - - protected function setColorProperties($color, $alpha, $type) { - return array( - 'type' => (string) $type, - 'value' => (string) $color, - 'alpha' => (string) $this->getTrueAlpha($alpha) - ); - } - - protected function getLineStyleArrowSize($array_selector, $array_kay_selector) { - $sizes = array( - 1 => array('w' => 'sm', 'len' => 'sm'), - 2 => array('w' => 'sm', 'len' => 'med'), - 3 => array('w' => 'sm', 'len' => 'lg'), - 4 => array('w' => 'med', 'len' => 'sm'), - 5 => array('w' => 'med', 'len' => 'med'), - 6 => array('w' => 'med', 'len' => 'lg'), - 7 => array('w' => 'lg', 'len' => 'sm'), - 8 => array('w' => 'lg', 'len' => 'med'), - 9 => array('w' => 'lg', 'len' => 'lg') - ); - - return $sizes[$array_selector][$array_kay_selector]; - } - - protected function getShadowPresetsMap($shadow_presets_option) { - $presets_options = array( - //OUTER - 1 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '2700000', - 'algn' => 'tl', - 'rotWithShape' => '0' - ), - 2 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '5400000', - 'algn' => 't', - 'rotWithShape' => '0' - ), - 3 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '8100000', - 'algn' => 'tr', - 'rotWithShape' => '0' - ), - 4 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'algn' => 'l', - 'rotWithShape' => '0' - ), - 5 => array( - 'effect' => 'outerShdw', - 'size' => array( - 'sx' => '102000', - 'sy' => '102000' - ) - , - 'blur' => '63500', - 'distance' => '38100', - 'algn' => 'ctr', - 'rotWithShape' => '0' - ), - 6 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '10800000', - 'algn' => 'r', - 'rotWithShape' => '0' - ), - 7 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '18900000', - 'algn' => 'bl', - 'rotWithShape' => '0' - ), - 8 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '16200000', - 'rotWithShape' => '0' - ), - 9 => array( - 'effect' => 'outerShdw', - 'blur' => '50800', - 'distance' => '38100', - 'direction' => '13500000', - 'algn' => 'br', - 'rotWithShape' => '0' - ), - //INNER - 10 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '2700000', - ), - 11 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '5400000', - ), - 12 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '8100000', - ), - 13 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - ), - 14 => array( - 'effect' => 'innerShdw', - 'blur' => '114300', - ), - 15 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '10800000', - ), - 16 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '18900000', - ), - 17 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '16200000', - ), - 18 => array( - 'effect' => 'innerShdw', - 'blur' => '63500', - 'distance' => '50800', - 'direction' => '13500000', - ), - //perspective - 19 => array( - 'effect' => 'outerShdw', - 'blur' => '152400', - 'distance' => '317500', - 'size' => array( - 'sx' => '90000', - 'sy' => '-19000', - ), - 'direction' => '5400000', - 'rotWithShape' => '0', - ), - 20 => array( - 'effect' => 'outerShdw', - 'blur' => '76200', - 'direction' => '18900000', - 'size' => array( - 'sy' => '23000', - 'kx' => '-1200000', - ), - 'algn' => 'bl', - 'rotWithShape' => '0', - ), - 21 => array( - 'effect' => 'outerShdw', - 'blur' => '76200', - 'direction' => '13500000', - 'size' => array( - 'sy' => '23000', - 'kx' => '1200000', - ), - 'algn' => 'br', - 'rotWithShape' => '0', - ), - 22 => array( - 'effect' => 'outerShdw', - 'blur' => '76200', - 'distance' => '12700', - 'direction' => '2700000', - 'size' => array( - 'sy' => '-23000', - 'kx' => '-800400', - ), - 'algn' => 'bl', - 'rotWithShape' => '0', - ), - 23 => array( - 'effect' => 'outerShdw', - 'blur' => '76200', - 'distance' => '12700', - 'direction' => '8100000', - 'size' => array( - 'sy' => '-23000', - 'kx' => '800400', - ), - 'algn' => 'br', - 'rotWithShape' => '0', - ), - ); - - return $presets_options[$shadow_presets_option]; - } - - protected function getArrayElementsValue($properties, $elements) { - $reference = & $properties; - if (!is_array($elements)) { - return $reference[$elements]; - } else { - foreach ($elements as $keys) { - $reference = & $reference[$keys]; - } - - return $reference; + protected function getExcelPointsWidth($width) + { + return $width * 12700; } - return $this; - } + protected function getExcelPointsAngle($angle) + { + return $angle * 60000; + } + protected function getTrueAlpha($alpha) + { + return (string) 100 - $alpha . '000'; + } + + protected function setColorProperties($color, $alpha, $type) + { + return array( + 'type' => (string) $type, + 'value' => (string) $color, + 'alpha' => (string) $this->getTrueAlpha($alpha) + ); + } + + protected function getLineStyleArrowSize($array_selector, $array_kay_selector) { + $sizes = array( + 1 => array('w' => 'sm', 'len' => 'sm'), + 2 => array('w' => 'sm', 'len' => 'med'), + 3 => array('w' => 'sm', 'len' => 'lg'), + 4 => array('w' => 'med', 'len' => 'sm'), + 5 => array('w' => 'med', 'len' => 'med'), + 6 => array('w' => 'med', 'len' => 'lg'), + 7 => array('w' => 'lg', 'len' => 'sm'), + 8 => array('w' => 'lg', 'len' => 'med'), + 9 => array('w' => 'lg', 'len' => 'lg') + ); + + return $sizes[$array_selector][$array_kay_selector]; + } + + protected function getShadowPresetsMap($shadow_presets_option) { + $presets_options = array( + //OUTER + 1 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '2700000', + 'algn' => 'tl', + 'rotWithShape' => '0' + ), + 2 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '5400000', + 'algn' => 't', + 'rotWithShape' => '0' + ), + 3 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '8100000', + 'algn' => 'tr', + 'rotWithShape' => '0' + ), + 4 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'algn' => 'l', + 'rotWithShape' => '0' + ), + 5 => array( + 'effect' => 'outerShdw', + 'size' => array( + 'sx' => '102000', + 'sy' => '102000' + ) + , + 'blur' => '63500', + 'distance' => '38100', + 'algn' => 'ctr', + 'rotWithShape' => '0' + ), + 6 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '10800000', + 'algn' => 'r', + 'rotWithShape' => '0' + ), + 7 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '18900000', + 'algn' => 'bl', + 'rotWithShape' => '0' + ), + 8 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '16200000', + 'rotWithShape' => '0' + ), + 9 => array( + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '13500000', + 'algn' => 'br', + 'rotWithShape' => '0' + ), + //INNER + 10 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '2700000', + ), + 11 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '5400000', + ), + 12 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '8100000', + ), + 13 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + ), + 14 => array( + 'effect' => 'innerShdw', + 'blur' => '114300', + ), + 15 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '10800000', + ), + 16 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '18900000', + ), + 17 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '16200000', + ), + 18 => array( + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '13500000', + ), + //perspective + 19 => array( + 'effect' => 'outerShdw', + 'blur' => '152400', + 'distance' => '317500', + 'size' => array( + 'sx' => '90000', + 'sy' => '-19000', + ), + 'direction' => '5400000', + 'rotWithShape' => '0', + ), + 20 => array( + 'effect' => 'outerShdw', + 'blur' => '76200', + 'direction' => '18900000', + 'size' => array( + 'sy' => '23000', + 'kx' => '-1200000', + ), + 'algn' => 'bl', + 'rotWithShape' => '0', + ), + 21 => array( + 'effect' => 'outerShdw', + 'blur' => '76200', + 'direction' => '13500000', + 'size' => array( + 'sy' => '23000', + 'kx' => '1200000', + ), + 'algn' => 'br', + 'rotWithShape' => '0', + ), + 22 => array( + 'effect' => 'outerShdw', + 'blur' => '76200', + 'distance' => '12700', + 'direction' => '2700000', + 'size' => array( + 'sy' => '-23000', + 'kx' => '-800400', + ), + 'algn' => 'bl', + 'rotWithShape' => '0', + ), + 23 => array( + 'effect' => 'outerShdw', + 'blur' => '76200', + 'distance' => '12700', + 'direction' => '8100000', + 'size' => array( + 'sy' => '-23000', + 'kx' => '800400', + ), + 'algn' => 'br', + 'rotWithShape' => '0', + ), + ); + + return $presets_options[$shadow_presets_option]; + } + + protected function getArrayElementsValue($properties, $elements) { + $reference = & $properties; + if (!is_array($elements)) { + return $reference[$elements]; + } else { + foreach ($elements as $keys) { + $reference = & $reference[$keys]; + } + return $reference; + } + return $this; + } } \ No newline at end of file diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index f869abde..a06d489a 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -211,8 +211,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $phpSheet The worksheet to write * @param PHPExcel_Worksheet $phpSheet */ - public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, - $parser, $preCalculateFormulas, $phpSheet) + public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) { // It needs to call its parent's constructor explicitly parent::__construct(); @@ -261,7 +260,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC); // if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255; - if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255; + if ($this->_lastColumnIndex > 255) { + $this->_lastColumnIndex = 255; + } $this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection()); } @@ -273,7 +274,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @access public * @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook() */ - function close() + public function close() { $_phpSheet = $this->_phpSheet; @@ -402,7 +403,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Row dimensions foreach ($_phpSheet->getRowDimensions() as $rowDimension) { $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs - $this->_writeRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() ); + $this->_writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel()); } // Write Cells @@ -500,11 +501,11 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $url = $hyperlink->getUrl(); - if ( strpos($url, 'sheet://') !== false ) { + if (strpos($url, 'sheet://') !== false) { // internal to current workbook $url = str_replace('sheet://', 'internal:', $url); - } else if ( preg_match('/^(http:|https:|ftp:|mailto:)/', $url) ) { + } else if (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) { // URL // $url = $url; @@ -524,7 +525,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_writeRangeProtection(); $arrConditionalStyles = $_phpSheet->getConditionalStylesCollection(); - if(!empty($arrConditionalStyles)){ + if (!empty($arrConditionalStyles)) { $arrConditional = array(); // @todo CFRule & CFHeader // Write CFHEADER record @@ -532,9 +533,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Write ConditionalFormattingTable records foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ - if(!in_array($conditional->getHashCode(), $arrConditional)){ + if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + if (!in_array($conditional->getHashCode(), $arrConditional)) { $arrConditional[] = $conditional->getHashCode(); // Write CFRULE record $this->_writeCFRule($conditional); @@ -586,7 +587,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * * @return string The data */ - function getData() + public function getData() { $buffer = 4096; @@ -606,7 +607,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @access public * @param integer $print Whether to print the headers or not. Defaults to 1 (print). */ - function printRowColHeaders($print = 1) + public function printRowColHeaders($print = 1) { $this->_print_headers = $print; } @@ -620,7 +621,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param bool $symbols_right * @param bool $auto_style */ - function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) + public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) { $this->_outline_on = $visible; $this->_outline_below = $symbols_below; @@ -652,9 +653,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x0203; // Record identifier $length = 0x000E; // Number of bytes to follow - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", $row, $col, $xfIndex); - $xl_double = pack("d", $num); + $xl_double = pack("d", $num); if (self::getByteOrder()) { // if it's Big Endian $xl_double = strrev($xl_double); } @@ -685,7 +686,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param mixed $xfIndex The XF format index for the cell * @param array $arrcRun Index to Font record and characters beginning */ - private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){ + private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) + { $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun); @@ -696,7 +698,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $this->_str_total++; - $header = pack('vv', $record, $length); + $header = pack('vv', $record, $length); $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); $this->_append($header.$data); } @@ -731,7 +733,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $str_error = -3; } - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvv", $row, $col, $xfIndex, $strlen); $this->_append($header . $data . $str); return($str_error); @@ -765,7 +767,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $this->_str_total++; - $header = pack('vv', $record, $length); + $header = pack('vv', $record, $length); $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); $this->_append($header.$data); } @@ -786,14 +788,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Length for this record is no more than 2048 + 6 $length = 0x0006 + min($note_length, 2048); - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", $row, $col, $note_length); $this->_append($header . $data . substr($note, 0, 2048)); for ($i = $max_length; $i < $note_length; $i += $max_length) { $chunk = substr($note, $i, $max_length); $length = 0x0006 + strlen($chunk); - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", -1, 0, strlen($chunk)); $this->_append($header.$data.$chunk); } @@ -816,12 +818,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param integer $col Zero indexed column * @param mixed $xfIndex The XF format index */ - function _writeBlank($row, $col, $xfIndex) + public function _writeBlank($row, $col, $xfIndex) { $record = 0x0201; // Record identifier $length = 0x0006; // Number of bytes to follow - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", $row, $col, $xfIndex); $this->_append($header . $data); return 0; @@ -841,7 +843,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x0205; $length = 8; - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError); $this->_append($header . $data); return 0; @@ -920,7 +922,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $formlen = strlen($formula); // Length of the binary string $length = 0x16 + $formlen; // Length of the record data - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", $row, $col, $xfIndex) . $num @@ -997,7 +999,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $url URL string * @return integer */ - function _writeUrlRange($row1, $col1, $row2, $col2, $url) + public function _writeUrlRange($row1, $col1, $row2, $col2, $url) { // Check for internal/external sheet links or default to web link if (preg_match('[^internal:]', $url)) { @@ -1023,7 +1025,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $url URL string * @return integer */ - function _writeUrlWeb($row1, $col1, $row2, $col2, $url) + public function _writeUrlWeb($row1, $col1, $row2, $col2, $url) { $record = 0x01B8; // Record identifier $length = 0x00000; // Bytes to follow @@ -1046,7 +1048,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $length = 0x34 + strlen($url); // Pack the header data - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvv", $row1, $row2, $col1, $col2); // Write the packed data @@ -1068,7 +1070,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $url URL string * @return integer */ - function _writeUrlInternal($row1, $col1, $row2, $col2, $url) + public function _writeUrlInternal($row1, $col1, $row2, $col2, $url) { $record = 0x01B8; // Record identifier $length = 0x00000; // Bytes to follow @@ -1095,7 +1097,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $length = 0x24 + strlen($url); // Pack the header data - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvv", $row1, $row2, $col1, $col2); // Write the packed data @@ -1121,7 +1123,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $url URL string * @return integer */ - function _writeUrlExternal($row1, $col1, $row2, $col2, $url) + public function _writeUrlExternal($row1, $col1, $row2, $col2, $url) { // Network drives are different. We will handle them separately // MS/Novell network drives and shares start with \\ @@ -1143,7 +1145,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // otherwise, absolute $absolute = 0x00; // relative path - if ( preg_match('/^[A-Z]:/', $url) ) { + if (preg_match('/^[A-Z]:/', $url)) { $absolute = 0x02; // absolute path on Windows, e.g. C:\... } $link_type = 0x01 | $absolute; @@ -1179,7 +1181,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' ); $unknown2 = pack("H*",'0303000000000000C000000000000046' ); $unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000'); - $unknown4 = pack("v", 0x03 ); + $unknown4 = pack("v", 0x03 ); // Pack the main data stream $data = pack("vvvv", $row1, $row2, $col1, $col2) . @@ -1228,7 +1230,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $grbit = 0x0000; // Option flags $ixfe = $xfIndex; - if ( $height < 0 ){ + if ($height < 0 ) { $height = null; } @@ -1257,7 +1259,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $grbit |= 0x0100; - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac,$reserved, $grbit, $ixfe); $this->_append($header.$data); @@ -1271,13 +1273,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x0200; // Record identifier $length = 0x000E; - $data = pack('VVvvv' - , $this->_firstRowIndex - , $this->_lastRowIndex + 1 - , $this->_firstColumnIndex - , $this->_lastColumnIndex + 1 - , 0x0000 // reserved - ); + $data = pack('VVvvv', $this->_firstRowIndex, $this->_lastRowIndex + 1, $this->_firstColumnIndex, $this->_lastColumnIndex + 1, 0x0000 // reserved); $header = pack("vv", $record, $length); $this->_append($header.$data); @@ -1324,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $grbit |= $fPaged << 10; $grbit |= $fPageBreakPreview << 11; - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvv", $grbit, $rwTop, $colLeft); // FIXME !!! @@ -1355,7 +1351,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $length = 0x0004; // Number of bytes to follow $header = pack("vv", $record, $length); - $data = pack("vv", 1, $defaultRowHeight); + $data = pack("vv", 1, $defaultRowHeight); $this->_append($header . $data); } @@ -1427,7 +1423,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $level = max(0, min($level, 7)); $grbit |= $level << 8; - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved); $this->_append($header.$data); @@ -1459,10 +1455,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // make sure we are not out of bounds $colFirst = min($colFirst, 255); - $colLast = min($colLast, 255); + $colLast = min($colLast, 255); $rwFirst = min($rwFirst, 65535); - $rwLast = min($rwLast, 65535); + $rwLast = min($rwLast, 65535); $record = 0x001D; // Record identifier $length = 0x000F; // Number of bytes to follow @@ -1489,11 +1485,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter list($colFirst, $colLast) = array($colLast, $colFirst); } - $header = pack("vv", $record, $length); - $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, - $irefAct, $cref, - $rwFirst, $rwLast, - $colFirst, $colLast); + $header = pack("vv", $record, $length); + $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, $irefAct, $cref, $rwFirst, $rwLast, $colFirst, $colLast); $this->_append($header . $data); } @@ -1688,7 +1681,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $length = 0x0002; // Number of bytes to follow $header = pack("vv", $record, $length); - $data = pack("v", $count); + $data = pack("v", $count); $this->_append($header . $data); } @@ -1718,7 +1711,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $rgch = 0x03; // Reference to a sheet in the current workbook } - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("CC", $cch, $rgch); $this->_append($header . $data . $sheetname); } @@ -1801,7 +1794,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_active_pane = $pnnAct; // Used in _writeSelection - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct); $this->_append($header . $data); } @@ -1935,7 +1928,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering $header = pack("vv", $record, $length); - $data = pack("v", $fHCenter); + $data = pack("v", $fHCenter); $this->_append($header.$data); } @@ -1951,7 +1944,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering $header = pack("vv", $record, $length); - $data = pack("v", $fVCenter); + $data = pack("v", $fVCenter); $this->_append($header . $data); } @@ -1965,8 +1958,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches - $header = pack("vv", $record, $length); - $data = pack("d", $margin); + $header = pack("vv", $record, $length); + $data = pack("d", $margin); if (self::getByteOrder()) { // if it's Big Endian $data = strrev($data); } @@ -1984,8 +1977,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches - $header = pack("vv", $record, $length); - $data = pack("d", $margin); + $header = pack("vv", $record, $length); + $data = pack("d", $margin); if (self::getByteOrder()) { // if it's Big Endian $data = strrev($data); } @@ -2003,8 +1996,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches - $header = pack("vv", $record, $length); - $data = pack("d", $margin); + $header = pack("vv", $record, $length); + $data = pack("d", $margin); if (self::getByteOrder()) { // if it's Big Endian $data = strrev($data); } @@ -2022,8 +2015,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches - $header = pack("vv", $record, $length); - $data = pack("d", $margin); + $header = pack("vv", $record, $length); + $data = pack("d", $margin); if (self::getByteOrder()) { // if it's Big Endian $data = strrev($data); } @@ -2073,15 +2066,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fGridSet = !$this->_phpSheet->getPrintGridlines(); // Boolean flag - $header = pack("vv", $record, $length); - $data = pack("v", $fGridSet); + $header = pack("vv", $record, $length); + $data = pack("v", $fGridSet); $this->_append($header . $data); } /** * Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet. */ - private function _writeAutoFilterInfo(){ + private function _writeAutoFilterInfo() + { $record = 0x009D; // Record identifier $length = 0x0002; // Bytes to follow @@ -2089,7 +2083,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0]; $header = pack("vv", $record, $length); - $data = pack("v", $iNumFilters); + $data = pack("v", $iNumFilters); $this->_append($header . $data); } @@ -2134,7 +2128,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter ++$col_level; } - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); $this->_append($header.$data); @@ -2172,7 +2166,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $header = pack("vv", $record, $length); - $data = pack("v", $grbit); + $data = pack("v", $grbit); $this->_append($header . $data); } @@ -2195,12 +2189,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Add to list of vertical breaks $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1; break; - case PHPExcel_Worksheet::BREAK_ROW: // Add to list of horizontal breaks $hbreaks[] = $coordinates[1]; break; - case PHPExcel_Worksheet::BREAK_NONE: default: // Nothing to do @@ -2222,7 +2214,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $length = 2 + 6 * $cbrk; // Bytes to follow $header = pack("vv", $record, $length); - $data = pack("v", $cbrk); + $data = pack("v", $cbrk); // Append each page break foreach ($hbreaks as $hbreak) { @@ -2249,8 +2241,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $cbrk = count($vbreaks); // Number of page breaks $length = 2 + 6 * $cbrk; // Bytes to follow - $header = pack("vv", $record, $length); - $data = pack("v", $cbrk); + $header = pack("vv", $record, $length); + $data = pack("v", $cbrk); // Append each page break foreach ($vbreaks as $vbreak) { @@ -2277,7 +2269,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fLock = 1; // Worksheet is protected $header = pack("vv", $record, $length); - $data = pack("v", $fLock); + $data = pack("v", $fLock); $this->_append($header.$data); } @@ -2346,7 +2338,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password $header = pack("vv", $record, $length); - $data = pack("v", $wPassword); + $data = pack("v", $wPassword); $this->_append($header . $data); } @@ -2363,7 +2355,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param float $scale_x The horizontal scale * @param float $scale_y The vertical scale */ - function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) + public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) { $bitmap_array = (is_resource($bitmap) ? $this->_processBitmapGd($bitmap) : $this->_processBitmap($bitmap)); list($width, $height, $size, $data) = $bitmap_array; //$this->_processBitmap($bitmap); @@ -2437,7 +2429,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param integer $width Width of image frame * @param integer $height Height of image frame */ - function _positionImage($col_start, $row_start, $x1, $y1, $width, $height) + public function _positionImage($col_start, $row_start, $x1, $y1, $width, $height) { // Initialise end cell to the same as the start cell $col_end = $col_start; // Col containing lower right corner of object @@ -2580,12 +2572,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param resource $image The image to process * @return array Array with data and properties of the bitmap */ - function _processBitmapGd($image) { + public function _processBitmapGd($image) + { $width = imagesx($image); $height = imagesy($image); $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); - for ($j=$height; $j--; ) { + for ($j=$height; $j--;) { for ($i=0; $i < $width; ++$i) { $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); foreach (array("red", "green", "blue") as $key) { @@ -2610,7 +2603,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $bitmap The bitmap to process * @return array Array with data and properties of the bitmap */ - function _processBitmap($bitmap) + public function _processBitmap($bitmap) { // Open file. $bmp_fd = @fopen($bitmap,"rb"); @@ -2760,7 +2753,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $objData = ''; // ftCmo - if($spTypes[$i] == 0x00C9){ + if ($spTypes[$i] == 0x00C9) { // Add ftCmo (common object data) subobject $objData .= pack('vvvvvVVV' @@ -2848,23 +2841,45 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // data type $type = $dataValidation->getType(); switch ($type) { - case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break; - case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break; - case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break; - case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break; - case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break; - case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break; - case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break; - case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break; + case PHPExcel_Cell_DataValidation::TYPE_NONE: + $type = 0x00; + break; + case PHPExcel_Cell_DataValidation::TYPE_WHOLE: + $type = 0x01; + break; + case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: + $type = 0x02; + break; + case PHPExcel_Cell_DataValidation::TYPE_LIST: + $type = 0x03; + break; + case PHPExcel_Cell_DataValidation::TYPE_DATE: + $type = 0x04; + break; + case PHPExcel_Cell_DataValidation::TYPE_TIME: + $type = 0x05; + break; + case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: + $type = 0x06; + break; + case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: + $type = 0x07; + break; } $options |= $type << 0; // error style $errorStyle = $dataValidation->getType(); switch ($errorStyle) { - case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break; - case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break; - case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break; + case PHPExcel_Cell_DataValidation::STYLE_STOP: + $errorStyle = 0x00; + break; + case PHPExcel_Cell_DataValidation::STYLE_WARNING: + $errorStyle = 0x01; + break; + case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: + $errorStyle = 0x02; + break; } $options |= $errorStyle << 4; @@ -2888,14 +2903,30 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // condition operator $operator = $dataValidation->getOperator(); switch ($operator) { - case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break; - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break; - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break; + case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: + $operator = 0x00; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: + $operator = 0x01; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: + $operator = 0x02; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: + $operator = 0x03; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: + $operator = 0x04; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: + $operator = 0x05; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: + $operator = 0x06; + break; + case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: + $operator = 0x07; + break; } $options |= $operator << 20; @@ -2973,15 +3004,23 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param string $errorCode * @return int */ - private static function _mapErrorCode($errorCode) { + private static function _mapErrorCode($errorCode) + { switch ($errorCode) { - case '#NULL!': return 0x00; - case '#DIV/0!': return 0x07; - case '#VALUE!': return 0x0F; - case '#REF!': return 0x17; - case '#NAME?': return 0x1D; - case '#NUM!': return 0x24; - case '#N/A': return 0x2A; + case '#NULL!': + return 0x00; + case '#DIV/0!': + return 0x07; + case '#VALUE!': + return 0x0F; + case '#REF!': + return 0x17; + case '#NAME?': + return 0x1D; + case '#NUM!': + return 0x24; + case '#N/A': + return 0x2A; } return 0; @@ -2990,7 +3029,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Write PLV Record */ - private function _writePageLayoutView(){ + private function _writePageLayoutView() + { $record = 0x088B; // Record identifier $length = 0x0010; // Bytes to follow @@ -3000,7 +3040,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $wScalvePLV = $this->_phpSheet->getSheetView()->getZoomScale(); // 2 // The options flags that comprise $grbit - if($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){ + if ($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { $fPageLayoutView = 1; } else { $fPageLayoutView = 0; @@ -3021,18 +3061,19 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * Write CFRule Record * @param PHPExcel_Style_Conditional $conditional */ - private function _writeCFRule(PHPExcel_Style_Conditional $conditional){ + private function _writeCFRule(PHPExcel_Style_Conditional $conditional) + { $record = 0x01B1; // Record identifier // $type : Type of the CF // $operatorType : Comparison operator - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION){ + if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { $type = 0x02; $operatorType = 0x00; - } else if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { $type = 0x01; - switch ($conditional->getOperatorType()){ + switch ($conditional->getOperatorType()) { case PHPExcel_Style_Conditional::OPERATOR_NONE: $operatorType = 0x00; break; @@ -3065,12 +3106,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // $szValue2 : size of the formula data for second value or formula $arrConditions = $conditional->getConditions(); $numConditions = sizeof($arrConditions); - if($numConditions == 1){ + if ($numConditions == 1) { $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue2 = 0x0000; $operand1 = pack('Cv', 0x1E, $arrConditions[0]); $operand2 = null; - } else if($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)){ + } else if ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) { $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); $operand1 = pack('Cv', 0x1E, $arrConditions[0]); @@ -3090,7 +3131,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0); $bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0); $bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0); - if($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0){ + if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) { $bFormatAlign = 1; } else { $bFormatAlign = 0; @@ -3098,7 +3139,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Protection $bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0); $bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0); - if($bProtLocked == 0 || $bProtHidden == 0){ + if ($bProtLocked == 0 || $bProtHidden == 0) { $bFormatProt = 1; } else { $bFormatProt = 0; @@ -3112,7 +3153,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - if($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0){ + if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) { $bFormatBorder = 1; } else { $bFormatBorder = 0; @@ -3121,13 +3162,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1); $bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1); $bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1); - if($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0){ + if ($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0) { $bFormatFill = 1; } else { $bFormatFill = 0; } // Font - if($conditional->getStyle()->getFont()->getName() != null + if ($conditional->getStyle()->getFont()->getName() != null || $conditional->getStyle()->getFont()->getSize() != null || $conditional->getStyle()->getFont()->getBold() != null || $conditional->getStyle()->getFont()->getItalic() != null @@ -3135,7 +3176,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter || $conditional->getStyle()->getFont()->getSubScript() != null || $conditional->getStyle()->getFont()->getUnderline() != null || $conditional->getStyle()->getFont()->getStrikethrough() != null - || $conditional->getStyle()->getFont()->getColor()->getARGB() != null){ + || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) { $bFormatFont = 1; } else { $bFormatFont = 0; @@ -3169,7 +3210,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $flags |= (1 == 1 ? 0x00380000 : 0); // Font $flags |= (1 == $bFormatFont ? 0x04000000 : 0); - // Alignment : + // Alignment: $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); // Border $flags |= (1 == $bFormatBorder ? 0x10000000 : 0); @@ -3181,16 +3222,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $flags |= (1 == 0 ? 0x80000000 : 0); // Data Blocks - if($bFormatFont == 1){ + if ($bFormatFont == 1) { // Font Name - if($conditional->getStyle()->getFont()->getName() == null){ + if ($conditional->getStyle()->getFont()->getName() == null) { $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); } else { $dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); } // Font Size - if($conditional->getStyle()->getFont()->getSize() == null){ + if ($conditional->getStyle()->getFont()->getSize() == null) { $dataBlockFont .= pack('V', 20 * 11); } else { $dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize()); @@ -3198,16 +3239,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Font Options $dataBlockFont .= pack('V', 0); // Font weight - if($conditional->getStyle()->getFont()->getBold() == true){ + if ($conditional->getStyle()->getFont()->getBold() == true) { $dataBlockFont .= pack('v', 0x02BC); } else { $dataBlockFont .= pack('v', 0x0190); } // Escapement type - if($conditional->getStyle()->getFont()->getSubScript() == true){ + if ($conditional->getStyle()->getFont()->getSubScript() == true) { $dataBlockFont .= pack('v', 0x02); $fontEscapement = 0; - } else if($conditional->getStyle()->getFont()->getSuperScript() == true){ + } else if ($conditional->getStyle()->getFont()->getSuperScript() == true) { $dataBlockFont .= pack('v', 0x01); $fontEscapement = 0; } else { @@ -3215,75 +3256,206 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fontEscapement = 1; } // Underline type - switch ($conditional->getStyle()->getFont()->getUnderline()){ - case PHPExcel_Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break; - default : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 1; break; + switch ($conditional->getStyle()->getFont()->getUnderline()) { + case PHPExcel_Style_Font::UNDERLINE_NONE: + $dataBlockFont .= pack('C', 0x00); + $fontUnderline = 0; + break; + case PHPExcel_Style_Font::UNDERLINE_DOUBLE: + $dataBlockFont .= pack('C', 0x02); + $fontUnderline = 0; + break; + case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING: + $dataBlockFont .= pack('C', 0x22); + $fontUnderline = 0; + break; + case PHPExcel_Style_Font::UNDERLINE_SINGLE: + $dataBlockFont .= pack('C', 0x01); + $fontUnderline = 0; + break; + case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING: + $dataBlockFont .= pack('C', 0x21); + $fontUnderline = 0; + break; + default: $dataBlockFont .= pack('C', 0x00); + $fontUnderline = 1; + break; } // Not used (3) $dataBlockFont .= pack('vC', 0x0000, 0x00); // Font color index switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) { - case '000000': $colorIdx = 0x08; break; - case 'FFFFFF': $colorIdx = 0x09; break; - case 'FF0000': $colorIdx = 0x0A; break; - case '00FF00': $colorIdx = 0x0B; break; - case '0000FF': $colorIdx = 0x0C; break; - case 'FFFF00': $colorIdx = 0x0D; break; - case 'FF00FF': $colorIdx = 0x0E; break; - case '00FFFF': $colorIdx = 0x0F; break; - case '800000': $colorIdx = 0x10; break; - case '008000': $colorIdx = 0x11; break; - case '000080': $colorIdx = 0x12; break; - case '808000': $colorIdx = 0x13; break; - case '800080': $colorIdx = 0x14; break; - case '008080': $colorIdx = 0x15; break; - case 'C0C0C0': $colorIdx = 0x16; break; - case '808080': $colorIdx = 0x17; break; - case '9999FF': $colorIdx = 0x18; break; - case '993366': $colorIdx = 0x19; break; - case 'FFFFCC': $colorIdx = 0x1A; break; - case 'CCFFFF': $colorIdx = 0x1B; break; - case '660066': $colorIdx = 0x1C; break; - case 'FF8080': $colorIdx = 0x1D; break; - case '0066CC': $colorIdx = 0x1E; break; - case 'CCCCFF': $colorIdx = 0x1F; break; - case '000080': $colorIdx = 0x20; break; - case 'FF00FF': $colorIdx = 0x21; break; - case 'FFFF00': $colorIdx = 0x22; break; - case '00FFFF': $colorIdx = 0x23; break; - case '800080': $colorIdx = 0x24; break; - case '800000': $colorIdx = 0x25; break; - case '008080': $colorIdx = 0x26; break; - case '0000FF': $colorIdx = 0x27; break; - case '00CCFF': $colorIdx = 0x28; break; - case 'CCFFFF': $colorIdx = 0x29; break; - case 'CCFFCC': $colorIdx = 0x2A; break; - case 'FFFF99': $colorIdx = 0x2B; break; - case '99CCFF': $colorIdx = 0x2C; break; - case 'FF99CC': $colorIdx = 0x2D; break; - case 'CC99FF': $colorIdx = 0x2E; break; - case 'FFCC99': $colorIdx = 0x2F; break; - case '3366FF': $colorIdx = 0x30; break; - case '33CCCC': $colorIdx = 0x31; break; - case '99CC00': $colorIdx = 0x32; break; - case 'FFCC00': $colorIdx = 0x33; break; - case 'FF9900': $colorIdx = 0x34; break; - case 'FF6600': $colorIdx = 0x35; break; - case '666699': $colorIdx = 0x36; break; - case '969696': $colorIdx = 0x37; break; - case '003366': $colorIdx = 0x38; break; - case '339966': $colorIdx = 0x39; break; - case '003300': $colorIdx = 0x3A; break; - case '333300': $colorIdx = 0x3B; break; - case '993300': $colorIdx = 0x3C; break; - case '993366': $colorIdx = 0x3D; break; - case '333399': $colorIdx = 0x3E; break; - case '333333': $colorIdx = 0x3F; break; - default: $colorIdx = 0x00; break; + case '000000': + $colorIdx = 0x08; + break; + case 'FFFFFF': + $colorIdx = 0x09; + break; + case 'FF0000': + $colorIdx = 0x0A; + break; + case '00FF00': + $colorIdx = 0x0B; + break; + case '0000FF': + $colorIdx = 0x0C; + break; + case 'FFFF00': + $colorIdx = 0x0D; + break; + case 'FF00FF': + $colorIdx = 0x0E; + break; + case '00FFFF': + $colorIdx = 0x0F; + break; + case '800000': + $colorIdx = 0x10; + break; + case '008000': + $colorIdx = 0x11; + break; + case '000080': + $colorIdx = 0x12; + break; + case '808000': + $colorIdx = 0x13; + break; + case '800080': + $colorIdx = 0x14; + break; + case '008080': + $colorIdx = 0x15; + break; + case 'C0C0C0': + $colorIdx = 0x16; + break; + case '808080': + $colorIdx = 0x17; + break; + case '9999FF': + $colorIdx = 0x18; + break; + case '993366': + $colorIdx = 0x19; + break; + case 'FFFFCC': + $colorIdx = 0x1A; + break; + case 'CCFFFF': + $colorIdx = 0x1B; + break; + case '660066': + $colorIdx = 0x1C; + break; + case 'FF8080': + $colorIdx = 0x1D; + break; + case '0066CC': + $colorIdx = 0x1E; + break; + case 'CCCCFF': + $colorIdx = 0x1F; + break; + case '000080': + $colorIdx = 0x20; + break; + case 'FF00FF': + $colorIdx = 0x21; + break; + case 'FFFF00': + $colorIdx = 0x22; + break; + case '00FFFF': + $colorIdx = 0x23; + break; + case '800080': + $colorIdx = 0x24; + break; + case '800000': + $colorIdx = 0x25; + break; + case '008080': + $colorIdx = 0x26; + break; + case '0000FF': + $colorIdx = 0x27; + break; + case '00CCFF': + $colorIdx = 0x28; + break; + case 'CCFFFF': + $colorIdx = 0x29; + break; + case 'CCFFCC': + $colorIdx = 0x2A; + break; + case 'FFFF99': + $colorIdx = 0x2B; + break; + case '99CCFF': + $colorIdx = 0x2C; + break; + case 'FF99CC': + $colorIdx = 0x2D; + break; + case 'CC99FF': + $colorIdx = 0x2E; + break; + case 'FFCC99': + $colorIdx = 0x2F; + break; + case '3366FF': + $colorIdx = 0x30; + break; + case '33CCCC': + $colorIdx = 0x31; + break; + case '99CC00': + $colorIdx = 0x32; + break; + case 'FFCC00': + $colorIdx = 0x33; + break; + case 'FF9900': + $colorIdx = 0x34; + break; + case 'FF6600': + $colorIdx = 0x35; + break; + case '666699': + $colorIdx = 0x36; + break; + case '969696': + $colorIdx = 0x37; + break; + case '003366': + $colorIdx = 0x38; + break; + case '339966': + $colorIdx = 0x39; + break; + case '003300': + $colorIdx = 0x3A; + break; + case '333300': + $colorIdx = 0x3B; + break; + case '993300': + $colorIdx = 0x3C; + break; + case '993366': + $colorIdx = 0x3D; + break; + case '333399': + $colorIdx = 0x3E; + break; + case '333333': + $colorIdx = 0x3F; + break; + default: + $colorIdx = 0x00; + break; } $dataBlockFont .= pack('V', $colorIdx); // Not used (4) @@ -3310,27 +3482,47 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Always $dataBlockFont .= pack('v', 0x0001); } - if($bFormatAlign == 1){ + if ($bFormatAlign == 1) { $blockAlign = 0; // Alignment and text break - switch ($conditional->getStyle()->getAlignment()->getHorizontal()){ - case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break; - case PHPExcel_Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break; - case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break; - case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break; + switch ($conditional->getStyle()->getAlignment()->getHorizontal()) { + case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: + $blockAlign = 0; + break; + case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: + $blockAlign = 1; + break; + case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: + $blockAlign = 3; + break; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: + $blockAlign = 2; + break; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: + $blockAlign = 6; + break; + case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: + $blockAlign = 5; + break; } - if($conditional->getStyle()->getAlignment()->getWrapText() == true){ + if ($conditional->getStyle()->getAlignment()->getWrapText() == true) { $blockAlign |= 1 << 3; } else { $blockAlign |= 0 << 3; } - switch ($conditional->getStyle()->getAlignment()->getVertical()){ - case PHPExcel_Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break; + switch ($conditional->getStyle()->getAlignment()->getVertical()) { + case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: + $blockAlign = 2 << 4; + break; + case PHPExcel_Style_Alignment::VERTICAL_TOP: + $blockAlign = 0 << 4; + break; + case PHPExcel_Style_Alignment::VERTICAL_CENTER: + $blockAlign = 1 << 4; + break; + case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: + $blockAlign = 3 << 4; + break; } $blockAlign |= 0 << 7; @@ -3339,7 +3531,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Indentation $blockIndent = $conditional->getStyle()->getAlignment()->getIndent(); - if($conditional->getStyle()->getAlignment()->getShrinkToFit() == true){ + if ($conditional->getStyle()->getAlignment()->getShrinkToFit() == true) { $blockIndent |= 1 << 4; } else { $blockIndent |= 0 << 4; @@ -3351,71 +3543,183 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000); } - if($bFormatBorder == 1){ + if ($bFormatBorder == 1) { $blockLineStyle = 0; - switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break; + switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) { + case PHPExcel_Style_Border::BORDER_NONE: + $blockLineStyle |= 0x00; + break; + case PHPExcel_Style_Border::BORDER_THIN: + $blockLineStyle |= 0x01; + break; + case PHPExcel_Style_Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02; + break; + case PHPExcel_Style_Border::BORDER_DASHED: + $blockLineStyle |= 0x03; + break; + case PHPExcel_Style_Border::BORDER_DOTTED: + $blockLineStyle |= 0x04; + break; + case PHPExcel_Style_Border::BORDER_THICK: + $blockLineStyle |= 0x05; + break; + case PHPExcel_Style_Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06; + break; + case PHPExcel_Style_Border::BORDER_HAIR: + $blockLineStyle |= 0x07; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08; + break; + case PHPExcel_Style_Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A; + break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C; + break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D; + break; } - switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break; + switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) { + case PHPExcel_Style_Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 4; + break; + case PHPExcel_Style_Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 4; + break; + case PHPExcel_Style_Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 4; + break; + case PHPExcel_Style_Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 4; + break; + case PHPExcel_Style_Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 4; + break; + case PHPExcel_Style_Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 4; + break; + case PHPExcel_Style_Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 4; + break; + case PHPExcel_Style_Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 4; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 4; + break; + case PHPExcel_Style_Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 4; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 4; + break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 4; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 4; + break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 4; + break; } - switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break; + switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) { + case PHPExcel_Style_Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 8; + break; + case PHPExcel_Style_Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 8; + break; + case PHPExcel_Style_Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 8; + break; + case PHPExcel_Style_Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 8; + break; + case PHPExcel_Style_Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 8; + break; + case PHPExcel_Style_Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 8; + break; + case PHPExcel_Style_Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 8; + break; + case PHPExcel_Style_Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 8; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 8; + break; + case PHPExcel_Style_Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 8; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 8; + break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 8; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 8; + break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 8; + break; } - switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break; + switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) { + case PHPExcel_Style_Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 12; + break; + case PHPExcel_Style_Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 12; + break; + case PHPExcel_Style_Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 12; + break; + case PHPExcel_Style_Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 12; + break; + case PHPExcel_Style_Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 12; + break; + case PHPExcel_Style_Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 12; + break; + case PHPExcel_Style_Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 12; + break; + case PHPExcel_Style_Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 12; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 12; + break; + case PHPExcel_Style_Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 12; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 12; + break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 12; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 12; + break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 12; + break; } //@todo _writeCFRule() => $blockLineStyle => Index Color for left line //@todo _writeCFRule() => $blockLineStyle => Index Color for right line @@ -3425,204 +3729,504 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //@todo _writeCFRule() => $blockColor => Index Color for top line //@todo _writeCFRule() => $blockColor => Index Color for bottom line //@todo _writeCFRule() => $blockColor => Index Color for diagonal line - switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()){ - case PHPExcel_Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break; - case PHPExcel_Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break; - case PHPExcel_Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break; - case PHPExcel_Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break; - case PHPExcel_Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break; - case PHPExcel_Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break; + switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) { + case PHPExcel_Style_Border::BORDER_NONE: + $blockColor |= 0x00 << 21; + break; + case PHPExcel_Style_Border::BORDER_THIN: + $blockColor |= 0x01 << 21; + break; + case PHPExcel_Style_Border::BORDER_MEDIUM: + $blockColor |= 0x02 << 21; + break; + case PHPExcel_Style_Border::BORDER_DASHED: + $blockColor |= 0x03 << 21; + break; + case PHPExcel_Style_Border::BORDER_DOTTED: + $blockColor |= 0x04 << 21; + break; + case PHPExcel_Style_Border::BORDER_THICK: + $blockColor |= 0x05 << 21; + break; + case PHPExcel_Style_Border::BORDER_DOUBLE: + $blockColor |= 0x06 << 21; + break; + case PHPExcel_Style_Border::BORDER_HAIR: + $blockColor |= 0x07 << 21; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + $blockColor |= 0x08 << 21; + break; + case PHPExcel_Style_Border::BORDER_DASHDOT: + $blockColor |= 0x09 << 21; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + $blockColor |= 0x0A << 21; + break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + $blockColor |= 0x0B << 21; + break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + $blockColor |= 0x0C << 21; + break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + $blockColor |= 0x0D << 21; + break; } $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor); } - if($bFormatFill == 1){ + if ($bFormatFill == 1) { // Fill Patern Style $blockFillPatternStyle = 0; - switch ($conditional->getStyle()->getFill()->getFillType()){ - case PHPExcel_Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break; - case PHPExcel_Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break; - case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break; - case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 - case PHPExcel_Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 - default : $blockFillPatternStyle = 0x00; break; + switch ($conditional->getStyle()->getFill()->getFillType()) { + case PHPExcel_Style_Fill::FILL_NONE: + $blockFillPatternStyle = 0x00; + break; + case PHPExcel_Style_Fill::FILL_SOLID: + $blockFillPatternStyle = 0x01; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY: + $blockFillPatternStyle = 0x02; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY: + $blockFillPatternStyle = 0x03; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY: + $blockFillPatternStyle = 0x04; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL: + $blockFillPatternStyle = 0x05; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL: + $blockFillPatternStyle = 0x06; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN: + $blockFillPatternStyle = 0x07; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP: + $blockFillPatternStyle = 0x08; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID: + $blockFillPatternStyle = 0x09; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS: + $blockFillPatternStyle = 0x0A; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL: + $blockFillPatternStyle = 0x0B; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL: + $blockFillPatternStyle = 0x0C; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN: + $blockFillPatternStyle = 0x0D; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP: + $blockFillPatternStyle = 0x0E; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID: + $blockFillPatternStyle = 0x0F; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS: + $blockFillPatternStyle = 0x10; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125: + $blockFillPatternStyle = 0x11; + break; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625: + $blockFillPatternStyle = 0x12; + break; + case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR: + $blockFillPatternStyle = 0x00; + break; // does not exist in BIFF8 + case PHPExcel_Style_Fill::FILL_GRADIENT_PATH: + $blockFillPatternStyle = 0x00; + break; // does not exist in BIFF8 + default: + $blockFillPatternStyle = 0x00; + break; } // Color switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) { - case '000000': $colorIdxBg = 0x08; break; - case 'FFFFFF': $colorIdxBg = 0x09; break; - case 'FF0000': $colorIdxBg = 0x0A; break; - case '00FF00': $colorIdxBg = 0x0B; break; - case '0000FF': $colorIdxBg = 0x0C; break; - case 'FFFF00': $colorIdxBg = 0x0D; break; - case 'FF00FF': $colorIdxBg = 0x0E; break; - case '00FFFF': $colorIdxBg = 0x0F; break; - case '800000': $colorIdxBg = 0x10; break; - case '008000': $colorIdxBg = 0x11; break; - case '000080': $colorIdxBg = 0x12; break; - case '808000': $colorIdxBg = 0x13; break; - case '800080': $colorIdxBg = 0x14; break; - case '008080': $colorIdxBg = 0x15; break; - case 'C0C0C0': $colorIdxBg = 0x16; break; - case '808080': $colorIdxBg = 0x17; break; - case '9999FF': $colorIdxBg = 0x18; break; - case '993366': $colorIdxBg = 0x19; break; - case 'FFFFCC': $colorIdxBg = 0x1A; break; - case 'CCFFFF': $colorIdxBg = 0x1B; break; - case '660066': $colorIdxBg = 0x1C; break; - case 'FF8080': $colorIdxBg = 0x1D; break; - case '0066CC': $colorIdxBg = 0x1E; break; - case 'CCCCFF': $colorIdxBg = 0x1F; break; - case '000080': $colorIdxBg = 0x20; break; - case 'FF00FF': $colorIdxBg = 0x21; break; - case 'FFFF00': $colorIdxBg = 0x22; break; - case '00FFFF': $colorIdxBg = 0x23; break; - case '800080': $colorIdxBg = 0x24; break; - case '800000': $colorIdxBg = 0x25; break; - case '008080': $colorIdxBg = 0x26; break; - case '0000FF': $colorIdxBg = 0x27; break; - case '00CCFF': $colorIdxBg = 0x28; break; - case 'CCFFFF': $colorIdxBg = 0x29; break; - case 'CCFFCC': $colorIdxBg = 0x2A; break; - case 'FFFF99': $colorIdxBg = 0x2B; break; - case '99CCFF': $colorIdxBg = 0x2C; break; - case 'FF99CC': $colorIdxBg = 0x2D; break; - case 'CC99FF': $colorIdxBg = 0x2E; break; - case 'FFCC99': $colorIdxBg = 0x2F; break; - case '3366FF': $colorIdxBg = 0x30; break; - case '33CCCC': $colorIdxBg = 0x31; break; - case '99CC00': $colorIdxBg = 0x32; break; - case 'FFCC00': $colorIdxBg = 0x33; break; - case 'FF9900': $colorIdxBg = 0x34; break; - case 'FF6600': $colorIdxBg = 0x35; break; - case '666699': $colorIdxBg = 0x36; break; - case '969696': $colorIdxBg = 0x37; break; - case '003366': $colorIdxBg = 0x38; break; - case '339966': $colorIdxBg = 0x39; break; - case '003300': $colorIdxBg = 0x3A; break; - case '333300': $colorIdxBg = 0x3B; break; - case '993300': $colorIdxBg = 0x3C; break; - case '993366': $colorIdxBg = 0x3D; break; - case '333399': $colorIdxBg = 0x3E; break; - case '333333': $colorIdxBg = 0x3F; break; - default: $colorIdxBg = 0x41; break; + case '000000': + $colorIdxBg = 0x08; + break; + case 'FFFFFF': + $colorIdxBg = 0x09; + break; + case 'FF0000': + $colorIdxBg = 0x0A; + break; + case '00FF00': + $colorIdxBg = 0x0B; + break; + case '0000FF': + $colorIdxBg = 0x0C; + break; + case 'FFFF00': + $colorIdxBg = 0x0D; + break; + case 'FF00FF': + $colorIdxBg = 0x0E; + break; + case '00FFFF': + $colorIdxBg = 0x0F; + break; + case '800000': + $colorIdxBg = 0x10; + break; + case '008000': + $colorIdxBg = 0x11; + break; + case '000080': + $colorIdxBg = 0x12; + break; + case '808000': + $colorIdxBg = 0x13; + break; + case '800080': + $colorIdxBg = 0x14; + break; + case '008080': + $colorIdxBg = 0x15; + break; + case 'C0C0C0': + $colorIdxBg = 0x16; + break; + case '808080': + $colorIdxBg = 0x17; + break; + case '9999FF': + $colorIdxBg = 0x18; + break; + case '993366': + $colorIdxBg = 0x19; + break; + case 'FFFFCC': + $colorIdxBg = 0x1A; + break; + case 'CCFFFF': + $colorIdxBg = 0x1B; + break; + case '660066': + $colorIdxBg = 0x1C; + break; + case 'FF8080': + $colorIdxBg = 0x1D; + break; + case '0066CC': + $colorIdxBg = 0x1E; + break; + case 'CCCCFF': + $colorIdxBg = 0x1F; + break; + case '000080': + $colorIdxBg = 0x20; + break; + case 'FF00FF': + $colorIdxBg = 0x21; + break; + case 'FFFF00': + $colorIdxBg = 0x22; + break; + case '00FFFF': + $colorIdxBg = 0x23; + break; + case '800080': + $colorIdxBg = 0x24; + break; + case '800000': + $colorIdxBg = 0x25; + break; + case '008080': + $colorIdxBg = 0x26; + break; + case '0000FF': + $colorIdxBg = 0x27; + break; + case '00CCFF': + $colorIdxBg = 0x28; + break; + case 'CCFFFF': + $colorIdxBg = 0x29; + break; + case 'CCFFCC': + $colorIdxBg = 0x2A; + break; + case 'FFFF99': + $colorIdxBg = 0x2B; + break; + case '99CCFF': + $colorIdxBg = 0x2C; + break; + case 'FF99CC': + $colorIdxBg = 0x2D; + break; + case 'CC99FF': + $colorIdxBg = 0x2E; + break; + case 'FFCC99': + $colorIdxBg = 0x2F; + break; + case '3366FF': + $colorIdxBg = 0x30; + break; + case '33CCCC': + $colorIdxBg = 0x31; + break; + case '99CC00': + $colorIdxBg = 0x32; + break; + case 'FFCC00': + $colorIdxBg = 0x33; + break; + case 'FF9900': + $colorIdxBg = 0x34; + break; + case 'FF6600': + $colorIdxBg = 0x35; + break; + case '666699': + $colorIdxBg = 0x36; + break; + case '969696': + $colorIdxBg = 0x37; + break; + case '003366': + $colorIdxBg = 0x38; + break; + case '339966': + $colorIdxBg = 0x39; + break; + case '003300': + $colorIdxBg = 0x3A; + break; + case '333300': + $colorIdxBg = 0x3B; + break; + case '993300': + $colorIdxBg = 0x3C; + break; + case '993366': + $colorIdxBg = 0x3D; + break; + case '333399': + $colorIdxBg = 0x3E; + break; + case '333333': + $colorIdxBg = 0x3F; + break; + default: + $colorIdxBg = 0x41; + break; } // Fg Color switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) { - case '000000': $colorIdxFg = 0x08; break; - case 'FFFFFF': $colorIdxFg = 0x09; break; - case 'FF0000': $colorIdxFg = 0x0A; break; - case '00FF00': $colorIdxFg = 0x0B; break; - case '0000FF': $colorIdxFg = 0x0C; break; - case 'FFFF00': $colorIdxFg = 0x0D; break; - case 'FF00FF': $colorIdxFg = 0x0E; break; - case '00FFFF': $colorIdxFg = 0x0F; break; - case '800000': $colorIdxFg = 0x10; break; - case '008000': $colorIdxFg = 0x11; break; - case '000080': $colorIdxFg = 0x12; break; - case '808000': $colorIdxFg = 0x13; break; - case '800080': $colorIdxFg = 0x14; break; - case '008080': $colorIdxFg = 0x15; break; - case 'C0C0C0': $colorIdxFg = 0x16; break; - case '808080': $colorIdxFg = 0x17; break; - case '9999FF': $colorIdxFg = 0x18; break; - case '993366': $colorIdxFg = 0x19; break; - case 'FFFFCC': $colorIdxFg = 0x1A; break; - case 'CCFFFF': $colorIdxFg = 0x1B; break; - case '660066': $colorIdxFg = 0x1C; break; - case 'FF8080': $colorIdxFg = 0x1D; break; - case '0066CC': $colorIdxFg = 0x1E; break; - case 'CCCCFF': $colorIdxFg = 0x1F; break; - case '000080': $colorIdxFg = 0x20; break; - case 'FF00FF': $colorIdxFg = 0x21; break; - case 'FFFF00': $colorIdxFg = 0x22; break; - case '00FFFF': $colorIdxFg = 0x23; break; - case '800080': $colorIdxFg = 0x24; break; - case '800000': $colorIdxFg = 0x25; break; - case '008080': $colorIdxFg = 0x26; break; - case '0000FF': $colorIdxFg = 0x27; break; - case '00CCFF': $colorIdxFg = 0x28; break; - case 'CCFFFF': $colorIdxFg = 0x29; break; - case 'CCFFCC': $colorIdxFg = 0x2A; break; - case 'FFFF99': $colorIdxFg = 0x2B; break; - case '99CCFF': $colorIdxFg = 0x2C; break; - case 'FF99CC': $colorIdxFg = 0x2D; break; - case 'CC99FF': $colorIdxFg = 0x2E; break; - case 'FFCC99': $colorIdxFg = 0x2F; break; - case '3366FF': $colorIdxFg = 0x30; break; - case '33CCCC': $colorIdxFg = 0x31; break; - case '99CC00': $colorIdxFg = 0x32; break; - case 'FFCC00': $colorIdxFg = 0x33; break; - case 'FF9900': $colorIdxFg = 0x34; break; - case 'FF6600': $colorIdxFg = 0x35; break; - case '666699': $colorIdxFg = 0x36; break; - case '969696': $colorIdxFg = 0x37; break; - case '003366': $colorIdxFg = 0x38; break; - case '339966': $colorIdxFg = 0x39; break; - case '003300': $colorIdxFg = 0x3A; break; - case '333300': $colorIdxFg = 0x3B; break; - case '993300': $colorIdxFg = 0x3C; break; - case '993366': $colorIdxFg = 0x3D; break; - case '333399': $colorIdxFg = 0x3E; break; - case '333333': $colorIdxFg = 0x3F; break; - default: $colorIdxFg = 0x40; break; + case '000000': + $colorIdxFg = 0x08; + break; + case 'FFFFFF': + $colorIdxFg = 0x09; + break; + case 'FF0000': + $colorIdxFg = 0x0A; + break; + case '00FF00': + $colorIdxFg = 0x0B; + break; + case '0000FF': + $colorIdxFg = 0x0C; + break; + case 'FFFF00': + $colorIdxFg = 0x0D; + break; + case 'FF00FF': + $colorIdxFg = 0x0E; + break; + case '00FFFF': + $colorIdxFg = 0x0F; + break; + case '800000': + $colorIdxFg = 0x10; + break; + case '008000': + $colorIdxFg = 0x11; + break; + case '000080': + $colorIdxFg = 0x12; + break; + case '808000': + $colorIdxFg = 0x13; + break; + case '800080': + $colorIdxFg = 0x14; + break; + case '008080': + $colorIdxFg = 0x15; + break; + case 'C0C0C0': + $colorIdxFg = 0x16; + break; + case '808080': + $colorIdxFg = 0x17; + break; + case '9999FF': + $colorIdxFg = 0x18; + break; + case '993366': + $colorIdxFg = 0x19; + break; + case 'FFFFCC': + $colorIdxFg = 0x1A; + break; + case 'CCFFFF': + $colorIdxFg = 0x1B; + break; + case '660066': + $colorIdxFg = 0x1C; + break; + case 'FF8080': + $colorIdxFg = 0x1D; + break; + case '0066CC': + $colorIdxFg = 0x1E; + break; + case 'CCCCFF': + $colorIdxFg = 0x1F; + break; + case '000080': + $colorIdxFg = 0x20; + break; + case 'FF00FF': + $colorIdxFg = 0x21; + break; + case 'FFFF00': + $colorIdxFg = 0x22; + break; + case '00FFFF': + $colorIdxFg = 0x23; + break; + case '800080': + $colorIdxFg = 0x24; + break; + case '800000': + $colorIdxFg = 0x25; + break; + case '008080': + $colorIdxFg = 0x26; + break; + case '0000FF': + $colorIdxFg = 0x27; + break; + case '00CCFF': + $colorIdxFg = 0x28; + break; + case 'CCFFFF': + $colorIdxFg = 0x29; + break; + case 'CCFFCC': + $colorIdxFg = 0x2A; + break; + case 'FFFF99': + $colorIdxFg = 0x2B; + break; + case '99CCFF': + $colorIdxFg = 0x2C; + break; + case 'FF99CC': + $colorIdxFg = 0x2D; + break; + case 'CC99FF': + $colorIdxFg = 0x2E; + break; + case 'FFCC99': + $colorIdxFg = 0x2F; + break; + case '3366FF': + $colorIdxFg = 0x30; + break; + case '33CCCC': + $colorIdxFg = 0x31; + break; + case '99CC00': + $colorIdxFg = 0x32; + break; + case 'FFCC00': + $colorIdxFg = 0x33; + break; + case 'FF9900': + $colorIdxFg = 0x34; + break; + case 'FF6600': + $colorIdxFg = 0x35; + break; + case '666699': + $colorIdxFg = 0x36; + break; + case '969696': + $colorIdxFg = 0x37; + break; + case '003366': + $colorIdxFg = 0x38; + break; + case '339966': + $colorIdxFg = 0x39; + break; + case '003300': + $colorIdxFg = 0x3A; + break; + case '333300': + $colorIdxFg = 0x3B; + break; + case '993300': + $colorIdxFg = 0x3C; + break; + case '993366': + $colorIdxFg = 0x3D; + break; + case '333399': + $colorIdxFg = 0x3E; + break; + case '333333': + $colorIdxFg = 0x3F; + break; + default: + $colorIdxFg = 0x40; + break; } $dataBlockFill = pack('v', $blockFillPatternStyle); $dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7)); } - if($bFormatProt == 1){ + if ($bFormatProt == 1) { $dataBlockProtection = 0; - if($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + if ($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) { $dataBlockProtection = 1; } - if($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + if ($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) { $dataBlockProtection = 1 << 1; } } $data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000); - if($bFormatFont == 1){ // Block Formatting : OK + if ($bFormatFont == 1) { // Block Formatting : OK $data .= $dataBlockFont; } - if($bFormatAlign == 1){ + if ($bFormatAlign == 1) { $data .= $dataBlockAlign; } - if($bFormatBorder == 1){ + if ($bFormatBorder == 1) { $data .= $dataBlockBorder; } - if($bFormatFill == 1){ // Block Formatting : OK + if ($bFormatFill == 1) { // Block Formatting : OK $data .= $dataBlockFill; } - if($bFormatProt == 1){ + if ($bFormatProt == 1) { $data .= $dataBlockProtection; } - if(!is_null($operand1)){ + if (!is_null($operand1)) { $data .= $operand1; } - if(!is_null($operand2)){ + if (!is_null($operand2)) { $data .= $operand2; } $header = pack('vv', $record, strlen($data)); @@ -3632,7 +4236,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Write CFHeader record */ - private function _writeCFHeader(){ + private function _writeCFHeader() + { $record = 0x01B0; // Record identifier $length = 0x0016; // Bytes to follow @@ -3643,26 +4248,26 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $arrConditional = array(); foreach ($this->_phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ - if(!in_array($conditional->getHashCode(), $arrConditional)){ + if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + if (!in_array($conditional->getHashCode(), $arrConditional)) { $arrConditional[] = $conditional->getHashCode(); } // Cells $arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate); - if(!is_numeric($arrCoord[0])){ + if (!is_numeric($arrCoord[0])) { $arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]); } - if(is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])){ + if (is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])) { $numColumnMin = $arrCoord[0]; } - if(is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])){ + if (is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])) { $numColumnMax = $arrCoord[0]; } - if(is_null($numRowMin) || ($numRowMin > $arrCoord[1])){ + if (is_null($numRowMin) || ($numRowMin > $arrCoord[1])) { $numRowMin = $arrCoord[1]; } - if(is_null($numRowMax) || ($numRowMax < $arrCoord[1])){ + if (is_null($numRowMax) || ($numRowMax < $arrCoord[1])) { $numRowMax = $arrCoord[1]; } }