Source for file Font.php
Documentation is available at Font.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.7.0, 2009-08-10
/** PHPExcel root directory */
define('PHPEXCEL_ROOT', dirname(__FILE__ ) . '/../../');
/** PHPExcel_Style_Color */
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php';
/** PHPExcel_IComparable */
require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
const UNDERLINE_NONE = 'none';
const UNDERLINE_DOUBLE = 'double';
const UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting';
const UNDERLINE_SINGLE = 'single';
const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting';
* @var PHPExcel_Style_Color
* @var _parentPropertyName string
* Parent. Only used for supervisor
* Create a new PHPExcel_Style_Font
$this->_name = 'Calibri';
// bind parent if we are a supervisor
* Bind parent. Only used for supervisor
* @param PHPExcel_Style $parent
* @return PHPExcel_Style_Font
* Is this a supervisor or a real style component?
* Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor
* @return PHPExcel_Style_Font
* 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('font' => $array);
* Apply styles from array
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
* 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE,
* @param array $pStyles Array containing style information
* @return PHPExcel_Style_Font
$this->getColor()->applyFromArray($pStyles['color']);
throw new Exception("Invalid style array passed.");
* @return PHPExcel_Style_Font
public function setName($pValue = 'Calibri') {
* @return PHPExcel_Style_Font
public function setSize($pValue = 10) {
* @return PHPExcel_Style_Font
public function setBold($pValue = false) {
* @return PHPExcel_Style_Font
* @return PHPExcel_Style_Font
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
* @return PHPExcel_Style_Font
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
* @param string $pValue PHPExcel_Style_Font underline type
* @return PHPExcel_Style_Font
public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) {
$styleArray = $this->getStyleArray(array('underline' => $pValue));
* @deprecated Use getStrikethrough() instead.
* @deprecated Use setStrikethrough() instead.
* @return PHPExcel_Style_Font
* @return PHPExcel_Style_Font
* @return PHPExcel_Style_Color
* @param PHPExcel_Style_Color $pValue
* @return PHPExcel_Style_Font
public function setColor(PHPExcel_Style_Color $pValue = null) {
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
* @return string Hash code
. ($this->_bold ? 't' : 'f')
* 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;
|