Source for file Borders.php
Documentation is available at Borders.php
* Copyright (c) 2006 - 2011 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 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.6, 2011-02-27
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
/* Diagonal directions */
* @var PHPExcel_Style_Border
* @var PHPExcel_Style_Border
* @var PHPExcel_Style_Border
* @var PHPExcel_Style_Border
* @var PHPExcel_Style_Border
private $_diagonalDirection;
* All borders psedo-border. Only applies to supervisor.
* @var PHPExcel_Style_Border
* Outline psedo-border. Only applies to supervisor.
* @var PHPExcel_Style_Border
* Inside psedo-border. Only applies to supervisor.
* @var PHPExcel_Style_Border
* Vertical pseudo-border. Only applies to supervisor.
* @var PHPExcel_Style_Border
* Horizontal pseudo-border. Only applies to supervisor.
* @var PHPExcel_Style_Border
* @var _parentPropertyName string
private $_parentPropertyName;
* Parent. Only used for supervisor
* Create a new PHPExcel_Style_Borders
$this->_isSupervisor = $isSupervisor;
// Specially for supervisor
// Initialize pseudo-borders
// bind parent if we are a supervisor
$this->_allBorders->bindParent($this, '_allBorders');
$this->_horizontal->bindParent($this, '_horizontal');
* Bind parent. Only used for supervisor
* @param PHPExcel_Style $parent
* @return PHPExcel_Style_Borders
$this->_parent = $parent;
* Is this a supervisor or a real style component?
return $this->_isSupervisor;
* Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor
* @return PHPExcel_Style_Borders
* Get the currently active sheet. Only used for supervisor
* @return PHPExcel_Worksheet
* Get the currently active cell coordinate in currently active sheet.
* Only used for supervisor
* @return string E.g. 'A1'
* Get the currently active cell coordinate in currently active sheet.
* Only used for supervisor
* @return string E.g. 'A1'
* Build style array from subcomponents
return array('borders' => $array);
* Apply styles from array
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
* @param array $pStyles Array containing style information
* @return PHPExcel_Style_Borders
if ($this->_isSupervisor) {
$this->getLeft()->applyFromArray($pStyles['left']);
$this->getRight()->applyFromArray($pStyles['right']);
$this->getTop()->applyFromArray($pStyles['top']);
$this->getBottom()->applyFromArray($pStyles['bottom']);
$this->getDiagonal()->applyFromArray($pStyles['diagonal']);
$this->getLeft()->applyFromArray($pStyles['allborders']);
$this->getRight()->applyFromArray($pStyles['allborders']);
$this->getTop()->applyFromArray($pStyles['allborders']);
$this->getBottom()->applyFromArray($pStyles['allborders']);
throw new Exception("Invalid style array passed.");
* @return PHPExcel_Style_Border
* @return PHPExcel_Style_Border
* @return PHPExcel_Style_Border
* @return PHPExcel_Style_Border
* @return PHPExcel_Style_Border
* Get AllBorders (pseudo-border). Only applies to supervisor.
* @return PHPExcel_Style_Border
if (!$this->_isSupervisor) {
throw new Exception('Can only get pseudo-border for supervisor.');
return $this->_allBorders;
* Get Outline (pseudo-border). Only applies to supervisor.
if (!$this->_isSupervisor) {
throw new Exception('Can only get pseudo-border for supervisor.');
* Get Inside (pseudo-border). Only applies to supervisor.
if (!$this->_isSupervisor) {
throw new Exception('Can only get pseudo-border for supervisor.');
* Get Vertical (pseudo-border). Only applies to supervisor.
* @return PHPExcel_Style_Border
if (!$this->_isSupervisor) {
throw new Exception('Can only get pseudo-border for supervisor.');
* Get Horizontal (pseudo-border). Only applies to supervisor.
* @return PHPExcel_Style_Border
if (!$this->_isSupervisor) {
throw new Exception('Can only get pseudo-border for supervisor.');
return $this->_horizontal;
if ($this->_isSupervisor) {
return $this->_diagonalDirection;
* @return PHPExcel_Style_Borders
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
$this->_diagonalDirection = $pValue;
* @return string Hash code
if ($this->_isSupervisor) {
. $this->getTop()->getHashCode()
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$this->$key = clone $value;
|