ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Style_Font Class Reference
+ Inheritance diagram for PHPExcel_Style_Font:
+ Collaboration diagram for PHPExcel_Style_Font:

Public Member Functions

 __construct ($isSupervisor=false)
 Create a new PHPExcel_Style_Font.
 bindParent ($parent)
 Bind parent.
 getIsSupervisor ()
 Is this a supervisor or a real style component?
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet.
 getActiveSheet ()
 Get the currently active sheet.
 getXSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 getXActiveCell ()
 Get the currently active cell coordinate in currently active sheet.
 getStyleArray ($array)
 Build style array from subcomponents.
 applyFromArray ($pStyles=null)
 Apply styles from array.
 getName ()
 Get Name.
 setName ($pValue= 'Calibri')
 Set Name.
 getSize ()
 Get Size.
 setSize ($pValue=10)
 Set Size.
 getBold ()
 Get Bold.
 setBold ($pValue=false)
 Set Bold.
 getItalic ()
 Get Italic.
 setItalic ($pValue=false)
 Set Italic.
 getSuperScript ()
 Get SuperScript.
 setSuperScript ($pValue=false)
 Set SuperScript.
 getSubScript ()
 Get SubScript.
 setSubScript ($pValue=false)
 Set SubScript.
 getUnderline ()
 Get Underline.
 setUnderline ($pValue=PHPExcel_Style_Font::UNDERLINE_NONE)
 Set Underline.
 getStriketrough ()
 Get Striketrough.
 setStriketrough ($pValue=false)
 Set Striketrough.
 getStrikethrough ()
 Get Strikethrough.
 setStrikethrough ($pValue=false)
 Set Strikethrough.
 getColor ()
 Get Color.
 setColor (PHPExcel_Style_Color $pValue=null)
 Set Color.
 getHashCode ()
 Get hash code.
 getHashIndex ()
 Get hash index.
 setHashIndex ($value)
 Set hash index.
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.

Data Fields

const UNDERLINE_NONE = 'none'
const UNDERLINE_DOUBLE = 'double'
const UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'
const UNDERLINE_SINGLE = 'single'
const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'

Private Attributes

 $_name
 $_bold
 $_italic
 $_superScript
 $_subScript
 $_underline
 $_strikethrough
 $_color
 $_parentPropertyName
 $_isSupervisor
 $_parent
 $_hashIndex

Detailed Description

Definition at line 51 of file Font.php.

Constructor & Destructor Documentation

PHPExcel_Style_Font::__construct (   $isSupervisor = false)

Create a new PHPExcel_Style_Font.

Definition at line 140 of file Font.php.

References PHPExcel_Style_Color\COLOR_BLACK, and UNDERLINE_NONE.

{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_name = 'Calibri';
$this->_size = 11;
$this->_bold = false;
$this->_italic = false;
$this->_superScript = false;
$this->_subScript = false;
$this->_strikethrough = false;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
// bind parent if we are a supervisor
if ($isSupervisor) {
$this->_color->bindParent($this, '_color');
}
}

Member Function Documentation

PHPExcel_Style_Font::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 655 of file Font.php.

References $key.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
PHPExcel_Style_Font::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( array( 'name' => 'Arial', 'bold' => true, 'italic' => false, 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, 'strike' => false, 'color' => array( 'rgb' => '808080' ) ) );

Parameters
array$pStylesArray containing style information
Exceptions
Exception
Returns
PHPExcel_Style_Font

Definition at line 259 of file Font.php.

References getActiveSheet(), getColor(), getStyleArray(), getXSelectedCells(), setBold(), setItalic(), setName(), setSize(), setStrikethrough(), setSubScript(), setSuperScript(), and setUnderline().

{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('name', $pStyles)) {
$this->setName($pStyles['name']);
}
if (array_key_exists('bold', $pStyles)) {
$this->setBold($pStyles['bold']);
}
if (array_key_exists('italic', $pStyles)) {
$this->setItalic($pStyles['italic']);
}
if (array_key_exists('superScript', $pStyles)) {
$this->setSuperScript($pStyles['superScript']);
}
if (array_key_exists('subScript', $pStyles)) {
$this->setSubScript($pStyles['subScript']);
}
if (array_key_exists('underline', $pStyles)) {
$this->setUnderline($pStyles['underline']);
}
if (array_key_exists('strike', $pStyles)) {
$this->setStrikethrough($pStyles['strike']);
}
if (array_key_exists('color', $pStyles)) {
$this->getColor()->applyFromArray($pStyles['color']);
}
if (array_key_exists('size', $pStyles)) {
$this->setSize($pStyles['size']);
}
}
} else {
throw new Exception("Invalid style array passed.");
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::bindParent (   $parent)

Bind parent.

Only used for supervisor

Parameters
PHPExcel_Style$parent
Returns
PHPExcel_Style_Font

Definition at line 168 of file Font.php.

{
$this->_parent = $parent;
}
PHPExcel_Style_Font::getActiveSheet ( )

Get the currently active sheet.

Only used for supervisor

Returns
PHPExcel_Worksheet

Definition at line 199 of file Font.php.

Referenced by applyFromArray(), getXActiveCell(), getXSelectedCells(), setBold(), setColor(), setItalic(), setName(), setSize(), setStrikethrough(), setSubScript(), setSuperScript(), and setUnderline().

{
return $this->_parent->getActiveSheet();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getBold ( )

Get Bold.

Returns
boolean

Definition at line 365 of file Font.php.

References $_bold, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getBold();
}
return $this->_bold;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getColor ( )

Get Color.

Returns
PHPExcel_Style_Color

Definition at line 574 of file Font.php.

References $_color.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont(), applyFromArray(), and setColor().

{
return $this->_color;
}

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 603 of file Font.php.

References getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_name
. $this->_size
. ($this->_bold ? 't' : 'f')
. ($this->_italic ? 't' : 'f')
. ($this->_superScript ? 't' : 'f')
. ($this->_subScript ? 't' : 'f')
. $this->_underline
. ($this->_strikethrough ? 't' : 'f')
. $this->_color->getHashCode()
. __CLASS__
);
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::getHashIndex ( )

Get 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.

Returns
string Hash index

Implements PHPExcel_IComparable.

Definition at line 636 of file Font.php.

References $_hashIndex.

{
}
PHPExcel_Style_Font::getIsSupervisor ( )

Is this a supervisor or a real style component?

Returns
boolean

Definition at line 178 of file Font.php.

References $_isSupervisor.

{
}
PHPExcel_Style_Font::getItalic ( )

Get Italic.

Returns
boolean

Definition at line 396 of file Font.php.

References $_italic, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getItalic();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getName ( )

Get Name.

Returns
string

Definition at line 303 of file Font.php.

References $_name, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getName();
}
return $this->_name;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns
PHPExcel_Style_Font

Definition at line 189 of file Font.php.

Referenced by getBold(), getHashCode(), getItalic(), getName(), getSize(), getStrikethrough(), getSubScript(), getSuperScript(), and getUnderline().

{
return $this->_parent->getSharedComponent()->getFont();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getSize ( )

Get Size.

Returns
double

Definition at line 334 of file Font.php.

References getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSize();
}
return $this->_size;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getStrikethrough ( )

Get Strikethrough.

Returns
boolean

Definition at line 543 of file Font.php.

References $_strikethrough, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont(), and getStriketrough().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getStrikethrough();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getStriketrough ( )

Get Striketrough.

Deprecated:
Use getStrikethrough() instead.
Returns
boolean

Definition at line 523 of file Font.php.

References getStrikethrough().

{
return $this->getStrikethrough();
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 232 of file Font.php.

Referenced by applyFromArray(), setBold(), setItalic(), setName(), setSize(), setStrikethrough(), setSubScript(), setSuperScript(), and setUnderline().

{
return array('font' => $array);
}

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getSubScript ( )

Get SubScript.

Returns
boolean

Definition at line 459 of file Font.php.

References $_subScript, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSubScript();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::getSuperScript ( )

Get SuperScript.

Returns
boolean

Definition at line 427 of file Font.php.

References $_superScript, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSuperScript();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::getUnderline ( )

Get Underline.

Returns
string

Definition at line 491 of file Font.php.

References $_underline, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getUnderline();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::getXActiveCell ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 221 of file Font.php.

References getActiveSheet().

{
return $this->getActiveSheet()->getXActiveCell();
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::getXSelectedCells ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 210 of file Font.php.

References getActiveSheet().

Referenced by applyFromArray(), setBold(), setColor(), setItalic(), setName(), setSize(), setStrikethrough(), setSubScript(), setSuperScript(), and setUnderline().

{
return $this->getActiveSheet()->getXSelectedCells();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setBold (   $pValue = false)

Set Bold.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 378 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('bold' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_bold = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setColor ( PHPExcel_Style_Color  $pValue = null)

Set Color.

Parameters
PHPExcel_Style_Color$pValue
Exceptions
Exception
Returns
PHPExcel_Style_Font

Definition at line 585 of file Font.php.

References getActiveSheet(), getColor(), and getXSelectedCells().

{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
if ($this->_isSupervisor) {
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_color = $color;
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::setHashIndex (   $value)

Set 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.

Parameters
string$valueHash index

Implements PHPExcel_IComparable.

Definition at line 648 of file Font.php.

{
$this->_hashIndex = $value;
}
PHPExcel_Style_Font::setItalic (   $pValue = false)

Set Italic.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 409 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('italic' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_italic = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setName (   $pValue = 'Calibri')

Set Name.

Parameters
string$pValue
Returns
PHPExcel_Style_Font

Definition at line 316 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = 'Calibri';
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('name' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_name = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setSize (   $pValue = 10)

Set Size.

Parameters
double$pValue
Returns
PHPExcel_Style_Font

Definition at line 347 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = 10;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('size' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_size = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setStrikethrough (   $pValue = false)

Set Strikethrough.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 556 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray(), and setStriketrough().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('strike' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_strikethrough = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setStriketrough (   $pValue = false)

Set Striketrough.

Deprecated:
Use setStrikethrough() instead.
Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 534 of file Font.php.

References setStrikethrough().

{
return $this->setStrikethrough($pValue);
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::setSubScript (   $pValue = false)

Set SubScript.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 472 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_subScript = $pValue;
$this->_superScript = !$pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setSuperScript (   $pValue = false)

Set SuperScript.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 440 of file Font.php.

References getActiveSheet(), getStyleArray(), and getXSelectedCells().

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_superScript = $pValue;
$this->_subScript = !$pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Font::setUnderline (   $pValue = PHPExcel_Style_Font::UNDERLINE_NONE)

Set Underline.

Parameters
string$pValuePHPExcel_Style_Font underline type
Returns
PHPExcel_Style_Font

Definition at line 504 of file Font.php.

References getActiveSheet(), getStyleArray(), getXSelectedCells(), and UNDERLINE_NONE.

Referenced by applyFromArray().

{
if ($pValue == '') {
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('underline' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_underline = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Style_Font::$_bold
private

Definition at line 72 of file Font.php.

Referenced by getBold().

PHPExcel_Style_Font::$_color
private

Definition at line 114 of file Font.php.

Referenced by getColor().

PHPExcel_Style_Font::$_hashIndex
private

Definition at line 626 of file Font.php.

Referenced by getHashIndex().

PHPExcel_Style_Font::$_isSupervisor
private

Definition at line 128 of file Font.php.

Referenced by getIsSupervisor().

PHPExcel_Style_Font::$_italic
private

Definition at line 79 of file Font.php.

Referenced by getItalic().

PHPExcel_Style_Font::$_name
private

Definition at line 65 of file Font.php.

Referenced by getName().

PHPExcel_Style_Font::$_parent
private

Definition at line 135 of file Font.php.

PHPExcel_Style_Font::$_parentPropertyName
private

Definition at line 121 of file Font.php.

PHPExcel_Style_Font::$_strikethrough
private

Definition at line 107 of file Font.php.

Referenced by getStrikethrough().

PHPExcel_Style_Font::$_subScript
private

Definition at line 93 of file Font.php.

Referenced by getSubScript().

PHPExcel_Style_Font::$_superScript
private

Definition at line 86 of file Font.php.

Referenced by getSuperScript().

PHPExcel_Style_Font::$_underline
private

Definition at line 100 of file Font.php.

Referenced by getUnderline().

const PHPExcel_Style_Font::UNDERLINE_DOUBLE = 'double'
const PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'
const PHPExcel_Style_Font::UNDERLINE_NONE = 'none'
const PHPExcel_Style_Font::UNDERLINE_SINGLE = 'single'
const PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'

The documentation for this class was generated from the following file: