Source for file Fill.php
Documentation is available at Fill.php
* Copyright (c) 2006 - 2009 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.6.5, 2009-01-05
/** PHPExcel_Style_Color */
require_once 'PHPExcel/Style/Color.php';
/** PHPExcel_IComparable */
require_once 'PHPExcel/IComparable.php';
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
const FILL_NONE = 'none';
const FILL_SOLID = 'solid';
const FILL_GRADIENT_LINEAR = 'linear';
const FILL_GRADIENT_PATH = 'path';
const FILL_PATTERN_DARKDOWN = 'darkDown';
const FILL_PATTERN_DARKGRAY = 'darkGray';
const FILL_PATTERN_DARKGRID = 'darkGrid';
const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal';
const FILL_PATTERN_DARKTRELLIS = 'darkTrellis';
const FILL_PATTERN_DARKUP = 'darkUp';
const FILL_PATTERN_DARKVERTICAL = 'darkVertical';
const FILL_PATTERN_GRAY0625 = 'gray0625';
const FILL_PATTERN_GRAY125 = 'gray125';
const FILL_PATTERN_LIGHTDOWN = 'lightDown';
const FILL_PATTERN_LIGHTGRAY = 'lightGray';
const FILL_PATTERN_LIGHTGRID = 'lightGrid';
const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal';
const FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis';
const FILL_PATTERN_LIGHTUP = 'lightUp';
const FILL_PATTERN_LIGHTVERTICAL = 'lightVertical';
const FILL_PATTERN_MEDIUMGRAY = 'mediumGray';
* @var PHPExcel_Style_Color
* @var PHPExcel_Style_Color
* @var _parentPropertyName string
* Create a new PHPExcel_Style_Fill
* Configures this object for late binding as a property of a parent object
* @param $parentPropertyName
// Initialize parent PHPExcel_Style for late binding. This relationship purposely ends immediately when this object
// is bound to the PHPExcel_Style object pointed to so as to prevent circular references.
* Returns the PHPExcel_Style_Fill that is actual bound to PHPExcel_Style
* @return PHPExcel_Style_Fill
return $this; // I am bound
return $this; // No one is bound yet
* If no PHPExcel_Style_Fill has been bound to PHPExcel_Style then bind this one. Return the actual bound one.
* @return PHPExcel_Style_Fill
return $this; // I am already bound
* Apply styles from array
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
* 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
* @param array $pStyles Array containing style information
$this->getEndColor()->applyFromArray($pStyles['endcolor']);
throw new Exception("Invalid style array passed.");
if ($property->_fillType == '') {
$property->_fillType = self::FILL_NONE;
return $property->_fillType;
* @param string $pValue PHPExcel_Style_Fill fill type
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) {
* @return PHPExcel_Style_Color
// It's a get but it may lead to a modified color which we won't detect but in which case we must bind.
// So bind as an assurance.
* @param PHPExcel_Style_Color $pValue
public function setStartColor(PHPExcel_Style_Color $pValue = null) {
* @return PHPExcel_Style_Color
// It's a get but it may lead to a modified color which we won't detect but in which case we must bind.
// So bind as an assurance.
* @param PHPExcel_Style_Color $pValue
public function setEndColor(PHPExcel_Style_Color $pValue = null) {
* @return string Hash code
. $property->getRotation()
. $property->getStartColor()->getHashCode()
. $property->getEndColor()->getHashCode()
* Note that this index may vary during script execution! Only reliable moment is
* while doing a write of a workbook and when changes are not allowed.
* @return string Hash index
* Note that this index may vary during script execution! Only reliable moment is
* while doing a write of a workbook and when changes are not allowed.
* @param string $value Hash index
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
$this->$key = clone $value;
|