ILIAS  eassessment Revision 61809
 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.
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 getActiveCell ()
 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.
 __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 = 'Calibri'
 $_size = 11
 $_bold = false
 $_italic = false
 $_superScript = false
 $_subScript = false
 $_underline = PHPExcel_Style_Font::UNDERLINE_NONE
 $_strikethrough = false
 $_color
 $_parentPropertyName
 $_isSupervisor
 $_parent

Detailed Description

Definition at line 36 of file Font.php.

Constructor & Destructor Documentation

PHPExcel_Style_Font::__construct (   $isSupervisor = false)

Create a new PHPExcel_Style_Font.

Definition at line 132 of file Font.php.

References PHPExcel_Style_Color\COLOR_BLACK.

{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$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 608 of file Font.php.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$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 243 of file Font.php.

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

{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 152 of file Font.php.

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

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 205 of file Font.php.

References getActiveSheet().

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

+ Here is the call graph for this function:

PHPExcel_Style_Font::getActiveSheet ( )

Get the currently active sheet.

Only used for supervisor

Returns
PHPExcel_Worksheet

Definition at line 183 of file Font.php.

Referenced by applyFromArray(), getActiveCell(), getSelectedCells(), 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 349 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 558 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 587 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::getIsSupervisor ( )

Is this a supervisor or a real style component?

Returns
boolean

Definition at line 162 of file Font.php.

References $_isSupervisor.

{
}
PHPExcel_Style_Font::getItalic ( )

Get Italic.

Returns
boolean

Definition at line 380 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 287 of file Font.php.

References $_name, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont(), PHPExcel_Shared_Drawing\cellDimensionToPixels(), PHPExcel_Shared_Font\getDefaultColumnWidthByFont(), PHPExcel_Shared_Font\getDefaultRowHeightByFont(), and PHPExcel_Shared_Drawing\pixelsToCellDimension().

{
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::getSelectedCells ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 194 of file Font.php.

References getActiveSheet().

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

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

+ 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 173 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 318 of file Font.php.

References $_size, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleFont(), PHPExcel_Shared_Drawing\cellDimensionToPixels(), PHPExcel_Shared_Font\getDefaultColumnWidthByFont(), PHPExcel_Shared_Font\getDefaultRowHeightByFont(), PHPExcel_Shared_Font\getTextWidthPixelsExact(), and PHPExcel_Shared_Drawing\pixelsToCellDimension().

{
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 527 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 507 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 216 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 443 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 411 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 475 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::setBold (   $pValue = false)

Set Bold.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 362 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('bold' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 569 of file Font.php.

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

{
// 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->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_color = $color;
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Font::setItalic (   $pValue = false)

Set Italic.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Font

Definition at line 393 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('italic' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 300 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = 'Calibri';
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('name' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 331 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = 10;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('size' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 540 of file Font.php.

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

Referenced by applyFromArray(), and setStriketrough().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('strike' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 518 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 456 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 424 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
$pValue = false;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 488 of file Font.php.

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

Referenced by applyFromArray().

{
if ($pValue == '') {
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('underline' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->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 = false
private

Definition at line 64 of file Font.php.

Referenced by getBold().

PHPExcel_Style_Font::$_color
private

Definition at line 106 of file Font.php.

Referenced by getColor().

PHPExcel_Style_Font::$_isSupervisor
private

Definition at line 120 of file Font.php.

Referenced by getIsSupervisor().

PHPExcel_Style_Font::$_italic = false
private

Definition at line 71 of file Font.php.

Referenced by getItalic().

PHPExcel_Style_Font::$_name = 'Calibri'
private

Definition at line 50 of file Font.php.

Referenced by getName().

PHPExcel_Style_Font::$_parent
private

Definition at line 127 of file Font.php.

PHPExcel_Style_Font::$_parentPropertyName
private

Definition at line 113 of file Font.php.

PHPExcel_Style_Font::$_size = 11
private

Definition at line 57 of file Font.php.

Referenced by getSize().

PHPExcel_Style_Font::$_strikethrough = false
private

Definition at line 99 of file Font.php.

Referenced by getStrikethrough().

PHPExcel_Style_Font::$_subScript = false
private

Definition at line 85 of file Font.php.

Referenced by getSubScript().

PHPExcel_Style_Font::$_superScript = false
private

Definition at line 78 of file Font.php.

Referenced by getSuperScript().

PHPExcel_Style_Font::$_underline = PHPExcel_Style_Font::UNDERLINE_NONE
private

Definition at line 92 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_SINGLEACCOUNTING = 'singleAccounting'

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