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

Public Member Functions

 __construct ($isSupervisor=false)
 Create a new PHPExcel_Style_Alignment.
 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.
 getHorizontal ()
 Get Horizontal.
 setHorizontal ($pValue=PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
 Set Horizontal.
 getVertical ()
 Get Vertical.
 setVertical ($pValue=PHPExcel_Style_Alignment::VERTICAL_BOTTOM)
 Set Vertical.
 getTextRotation ()
 Get TextRotation.
 setTextRotation ($pValue=0)
 Set TextRotation.
 getWrapText ()
 Get Wrap Text.
 setWrapText ($pValue=false)
 Set Wrap Text.
 getShrinkToFit ()
 Get Shrink to fit.
 setShrinkToFit ($pValue=false)
 Set Shrink to fit.
 getIndent ()
 Get indent.
 setIndent ($pValue=0)
 Set indent.
 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 HORIZONTAL_GENERAL = 'general'
const HORIZONTAL_LEFT = 'left'
const HORIZONTAL_RIGHT = 'right'
const HORIZONTAL_CENTER = 'center'
const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'
const HORIZONTAL_JUSTIFY = 'justify'
const VERTICAL_BOTTOM = 'bottom'
const VERTICAL_TOP = 'top'
const VERTICAL_CENTER = 'center'
const VERTICAL_JUSTIFY = 'justify'

Private Attributes

 $_horizontal
 $_vertical
 $_textRotation
 $_wrapText
 $_shrinkToFit
 $_indent
 $_parentPropertyName
 $_isSupervisor
 $_parent
 $_hashIndex

Detailed Description

Definition at line 48 of file Alignment.php.

Constructor & Destructor Documentation

PHPExcel_Style_Alignment::__construct (   $isSupervisor = false)

Create a new PHPExcel_Style_Alignment.

Definition at line 130 of file Alignment.php.

References HORIZONTAL_GENERAL, and VERTICAL_BOTTOM.

{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_textRotation = 0;
$this->_wrapText = false;
$this->_shrinkToFit = false;
$this->_indent = 0;
}

Member Function Documentation

PHPExcel_Style_Alignment::__clone ( )

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

Definition at line 522 of file Alignment.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_Alignment::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( array( 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, 'rotation' => 0, 'wrap' => true ) );

Parameters
array$pStylesArray containing style information
Exceptions
Exception
Returns
PHPExcel_Style_Alignment

Definition at line 238 of file Alignment.php.

References getActiveSheet(), getStyleArray(), getXSelectedCells(), setHorizontal(), setIndent(), setShrinkToFit(), setTextRotation(), setVertical(), and setWrapText().

{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('horizontal', $pStyles)) {
$this->setHorizontal($pStyles['horizontal']);
}
if (array_key_exists('vertical', $pStyles)) {
$this->setVertical($pStyles['vertical']);
}
if (array_key_exists('rotation', $pStyles)) {
$this->setTextRotation($pStyles['rotation']);
}
if (array_key_exists('wrap', $pStyles)) {
$this->setWrapText($pStyles['wrap']);
}
if (array_key_exists('shrinkToFit', $pStyles)) {
$this->setShrinkToFit($pStyles['shrinkToFit']);
}
if (array_key_exists('indent', $pStyles)) {
$this->setIndent($pStyles['indent']);
}
}
} else {
throw new Exception("Invalid style array passed.");
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::bindParent (   $parent)

Bind parent.

Only used for supervisor

Parameters
PHPExcel$parent
Returns
PHPExcel_Style_Alignment

Definition at line 150 of file Alignment.php.

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

Get the currently active sheet.

Only used for supervisor

Returns
PHPExcel_Worksheet

Definition at line 182 of file Alignment.php.

Referenced by applyFromArray(), getXActiveCell(), getXSelectedCells(), setHorizontal(), setIndent(), setShrinkToFit(), setTextRotation(), setVertical(), and setWrapText().

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

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 473 of file Alignment.php.

References getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_horizontal
. $this->_vertical
. $this->_textRotation
. ($this->_wrapText ? 't' : 'f')
. ($this->_shrinkToFit ? 't' : 'f')
. $this->_indent
. __CLASS__
);
}

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::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 503 of file Alignment.php.

References $_hashIndex.

{
}
PHPExcel_Style_Alignment::getHorizontal ( )

Get Horizontal.

Returns
string

Definition at line 273 of file Alignment.php.

References $_horizontal, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleAlignment(), and setIndent().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::getIndent ( )

Get indent.

Returns
int

Definition at line 440 of file Alignment.php.

References $_indent, and getSharedComponent().

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

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::getIsSupervisor ( )

Is this a supervisor or a real style component?

Returns
boolean

Definition at line 161 of file Alignment.php.

References $_isSupervisor.

{
}
PHPExcel_Style_Alignment::getSharedComponent ( )

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

Only used for style supervisor

Returns
PHPExcel_Style_Alignment

Definition at line 172 of file Alignment.php.

Referenced by getHashCode(), getHorizontal(), getIndent(), getShrinkToFit(), getTextRotation(), getVertical(), and getWrapText().

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

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::getShrinkToFit ( )

Get Shrink to fit.

Returns
boolean

Definition at line 409 of file Alignment.php.

References $_shrinkToFit, and getSharedComponent().

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

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 215 of file Alignment.php.

Referenced by applyFromArray(), setHorizontal(), setIndent(), setShrinkToFit(), setTextRotation(), setVertical(), and setWrapText().

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

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::getTextRotation ( )

Get TextRotation.

Returns
int

Definition at line 338 of file Alignment.php.

References $_textRotation, and getSharedComponent().

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

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::getVertical ( )

Get Vertical.

Returns
string

Definition at line 306 of file Alignment.php.

References $_vertical, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleAlignment().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::getWrapText ( )

Get Wrap Text.

Returns
boolean

Definition at line 378 of file Alignment.php.

References $_wrapText, and getSharedComponent().

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

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::getXActiveCell ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 204 of file Alignment.php.

References getActiveSheet().

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

+ Here is the call graph for this function:

PHPExcel_Style_Alignment::getXSelectedCells ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 193 of file Alignment.php.

References getActiveSheet().

Referenced by applyFromArray(), setHorizontal(), setIndent(), setShrinkToFit(), setTextRotation(), setVertical(), and setWrapText().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::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 515 of file Alignment.php.

{
$this->_hashIndex = $value;
}
PHPExcel_Style_Alignment::setHorizontal (   $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)

Set Horizontal.

Parameters
string$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 286 of file Alignment.php.

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

Referenced by applyFromArray().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::setIndent (   $pValue = 0)

Set indent.

Parameters
int$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 453 of file Alignment.php.

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

Referenced by applyFromArray().

{
if ($pValue > 0) {
if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) {
$pValue = 0; // indent not supported
}
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('indent' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_indent = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::setShrinkToFit (   $pValue = false)

Set Shrink to fit.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 422 of file Alignment.php.

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

Referenced by applyFromArray().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::setTextRotation (   $pValue = 0)

Set TextRotation.

Parameters
int$pValue
Exceptions
Exception
Returns
PHPExcel_Style_Alignment

Definition at line 352 of file Alignment.php.

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

Referenced by applyFromArray().

{
// Excel2007 value 255 => PHPExcel value -165
if ($pValue == 255) {
$pValue = -165;
}
// Set rotation
if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) {
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
} else {
$this->_textRotation = $pValue;
}
} else {
throw new Exception("Text rotation should be a value between -90 and 90.");
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::setVertical (   $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM)

Set Vertical.

Parameters
string$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 319 of file Alignment.php.

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

Referenced by applyFromArray().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Alignment::setWrapText (   $pValue = false)

Set Wrap Text.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 391 of file Alignment.php.

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

Referenced by applyFromArray().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Style_Alignment::$_hashIndex
private

Definition at line 493 of file Alignment.php.

Referenced by getHashIndex().

PHPExcel_Style_Alignment::$_horizontal
private

Definition at line 69 of file Alignment.php.

Referenced by getHorizontal().

PHPExcel_Style_Alignment::$_indent
private

Definition at line 104 of file Alignment.php.

Referenced by getIndent().

PHPExcel_Style_Alignment::$_isSupervisor
private

Definition at line 118 of file Alignment.php.

Referenced by getIsSupervisor().

PHPExcel_Style_Alignment::$_parent
private

Definition at line 125 of file Alignment.php.

PHPExcel_Style_Alignment::$_parentPropertyName
private

Definition at line 111 of file Alignment.php.

PHPExcel_Style_Alignment::$_shrinkToFit
private

Definition at line 97 of file Alignment.php.

Referenced by getShrinkToFit().

PHPExcel_Style_Alignment::$_textRotation
private

Definition at line 83 of file Alignment.php.

Referenced by getTextRotation().

PHPExcel_Style_Alignment::$_vertical
private

Definition at line 76 of file Alignment.php.

Referenced by getVertical().

PHPExcel_Style_Alignment::$_wrapText
private

Definition at line 90 of file Alignment.php.

Referenced by getWrapText().

const PHPExcel_Style_Alignment::HORIZONTAL_CENTER = 'center'
const PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'
const PHPExcel_Style_Alignment::HORIZONTAL_GENERAL = 'general'
const PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY = 'justify'
const PHPExcel_Style_Alignment::HORIZONTAL_LEFT = 'left'
const PHPExcel_Style_Alignment::HORIZONTAL_RIGHT = 'right'
const PHPExcel_Style_Alignment::VERTICAL_BOTTOM = 'bottom'
const PHPExcel_Style_Alignment::VERTICAL_CENTER = 'center'
const PHPExcel_Style_Alignment::VERTICAL_JUSTIFY = 'justify'
const PHPExcel_Style_Alignment::VERTICAL_TOP = 'top'

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