ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Style_Alignment Class Reference
+ Inheritance diagram for PHPExcel_Style_Alignment:
+ Collaboration diagram for PHPExcel_Style_Alignment:

Public Member Functions

 __construct ($isSupervisor=FALSE, $isConditional=FALSE)
 Create a new PHPExcel_Style_Alignment. More...
 
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet. More...
 
 getStyleArray ($array)
 Build style array from subcomponents. More...
 
 applyFromArray ($pStyles=NULL)
 Apply styles from array. More...
 
 getHorizontal ()
 Get Horizontal. More...
 
 setHorizontal ($pValue=PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
 Set Horizontal. More...
 
 getVertical ()
 Get Vertical. More...
 
 setVertical ($pValue=PHPExcel_Style_Alignment::VERTICAL_BOTTOM)
 Set Vertical. More...
 
 getTextRotation ()
 Get TextRotation. More...
 
 setTextRotation ($pValue=0)
 Set TextRotation. More...
 
 getWrapText ()
 Get Wrap Text. More...
 
 setWrapText ($pValue=FALSE)
 Set Wrap Text. More...
 
 getShrinkToFit ()
 Get Shrink to fit. More...
 
 setShrinkToFit ($pValue=FALSE)
 Set Shrink to fit. More...
 
 getIndent ()
 Get indent. More...
 
 setIndent ($pValue=0)
 Set indent. More...
 
 getReadorder ()
 Get read order. More...
 
 setReadorder ($pValue=0)
 Set read order. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PHPExcel_Style_Supervisor
 __construct ($isSupervisor=FALSE)
 Create a new PHPExcel_Style_Alignment. More...
 
 bindParent ($parent, $parentPropertyName=NULL)
 Bind parent. More...
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component? More...
 
 getActiveSheet ()
 Get the currently active sheet. More...
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 
 getHashCode ()
 Get hash code. More...
 

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 HORIZONTAL_FILL = 'fill'
 
const HORIZONTAL_DISTRIBUTED = 'distributed'
 
const VERTICAL_BOTTOM = 'bottom'
 
const VERTICAL_TOP = 'top'
 
const VERTICAL_CENTER = 'center'
 
const VERTICAL_JUSTIFY = 'justify'
 
const VERTICAL_DISTRIBUTED = 'distributed'
 
const READORDER_CONTEXT = 0
 
const READORDER_LTR = 1
 
const READORDER_RTL = 2
 

Protected Attributes

 $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
 
 $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM
 
 $_textRotation = 0
 
 $_wrapText = FALSE
 
 $_shrinkToFit = FALSE
 
 $_indent = 0
 
 $_readorder = 0
 
- Protected Attributes inherited from PHPExcel_Style_Supervisor
 $_isSupervisor
 
 $_parent
 

Detailed Description

Definition at line 36 of file Alignment.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Style_Alignment::__construct (   $isSupervisor = FALSE,
  $isConditional = FALSE 
)

Create a new PHPExcel_Style_Alignment.

Parameters
boolean$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
boolean$isConditionalFlag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

Definition at line 119 of file Alignment.php.

120 {
121 // Supervisor?
122 parent::__construct($isSupervisor);
123
124 if ($isConditional) {
125 $this->_horizontal = NULL;
126 $this->_vertical = NULL;
127 $this->_textRotation = NULL;
128 }
129 }

Member Function Documentation

◆ applyFromArray()

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
PHPExcel_Exception
Returns
PHPExcel_Style_Alignment

Definition at line 171 of file Alignment.php.

171 {
172 if (is_array($pStyles)) {
173 if ($this->_isSupervisor) {
174 $this->getActiveSheet()->getStyle($this->getSelectedCells())
175 ->applyFromArray($this->getStyleArray($pStyles));
176 } else {
177 if (isset($pStyles['horizontal'])) {
178 $this->setHorizontal($pStyles['horizontal']);
179 }
180 if (isset($pStyles['vertical'])) {
181 $this->setVertical($pStyles['vertical']);
182 }
183 if (isset($pStyles['rotation'])) {
184 $this->setTextRotation($pStyles['rotation']);
185 }
186 if (isset($pStyles['wrap'])) {
187 $this->setWrapText($pStyles['wrap']);
188 }
189 if (isset($pStyles['shrinkToFit'])) {
190 $this->setShrinkToFit($pStyles['shrinkToFit']);
191 }
192 if (isset($pStyles['indent'])) {
193 $this->setIndent($pStyles['indent']);
194 }
195 if (isset($pStyles['readorder'])) {
196 $this->setReadorder($pStyles['readorder']);
197 }
198 }
199 } else {
200 throw new PHPExcel_Exception("Invalid style array passed.");
201 }
202 return $this;
203 }
setWrapText($pValue=FALSE)
Set Wrap Text.
Definition: Alignment.php:328
setVertical($pValue=PHPExcel_Style_Alignment::VERTICAL_BOTTOM)
Set Vertical.
Definition: Alignment.php:256
setReadorder($pValue=0)
Set read order.
Definition: Alignment.php:425
setIndent($pValue=0)
Set indent.
Definition: Alignment.php:390
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:148
setHorizontal($pValue=PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
Set Horizontal.
Definition: Alignment.php:223
setShrinkToFit($pValue=FALSE)
Set Shrink to fit.
Definition: Alignment.php:359
setTextRotation($pValue=0)
Set TextRotation.
Definition: Alignment.php:289
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), getStyleArray(), setHorizontal(), setIndent(), setReadorder(), setShrinkToFit(), setTextRotation(), setVertical(), and setWrapText().

+ Here is the call graph for this function:

◆ getHashCode()

PHPExcel_Style_Alignment::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 443 of file Alignment.php.

443 {
444 if ($this->_isSupervisor) {
445 return $this->getSharedComponent()->getHashCode();
446 }
447 return md5(
448 $this->_horizontal
449 . $this->_vertical
450 . $this->_textRotation
451 . ($this->_wrapText ? 't' : 'f')
452 . ($this->_shrinkToFit ? 't' : 'f')
453 . $this->_indent
454 . $this->_readorder
455 . __CLASS__
456 );
457 }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:137

References getSharedComponent().

+ Here is the call graph for this function:

◆ getHorizontal()

PHPExcel_Style_Alignment::getHorizontal ( )

Get Horizontal.

Returns
string

Definition at line 210 of file Alignment.php.

210 {
211 if ($this->_isSupervisor) {
212 return $this->getSharedComponent()->getHorizontal();
213 }
214 return $this->_horizontal;
215 }

References $_horizontal, and getSharedComponent().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIndent()

PHPExcel_Style_Alignment::getIndent ( )

Get indent.

Returns
int

Definition at line 377 of file Alignment.php.

377 {
378 if ($this->_isSupervisor) {
379 return $this->getSharedComponent()->getIndent();
380 }
381 return $this->_indent;
382 }

References $_indent, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleAlignment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReadorder()

PHPExcel_Style_Alignment::getReadorder ( )

Get read order.

Returns
integer

Definition at line 412 of file Alignment.php.

412 {
413 if ($this->_isSupervisor) {
414 return $this->getSharedComponent()->getReadorder();
415 }
416 return $this->_readorder;
417 }

References $_readorder, and getSharedComponent().

+ Here is the call graph for this function:

◆ getSharedComponent()

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 137 of file Alignment.php.

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

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

+ Here is the caller graph for this function:

◆ getShrinkToFit()

PHPExcel_Style_Alignment::getShrinkToFit ( )

Get Shrink to fit.

Returns
boolean

Definition at line 346 of file Alignment.php.

346 {
347 if ($this->_isSupervisor) {
348 return $this->getSharedComponent()->getShrinkToFit();
349 }
350 return $this->_shrinkToFit;
351 }

References $_shrinkToFit, and getSharedComponent().

+ Here is the call graph for this function:

◆ getStyleArray()

PHPExcel_Style_Alignment::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 148 of file Alignment.php.

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

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

+ Here is the caller graph for this function:

◆ getTextRotation()

PHPExcel_Style_Alignment::getTextRotation ( )

Get TextRotation.

Returns
int

Definition at line 275 of file Alignment.php.

275 {
276 if ($this->_isSupervisor) {
277 return $this->getSharedComponent()->getTextRotation();
278 }
280 }

References $_textRotation, and getSharedComponent().

+ Here is the call graph for this function:

◆ getVertical()

PHPExcel_Style_Alignment::getVertical ( )

Get Vertical.

Returns
string

Definition at line 243 of file Alignment.php.

243 {
244 if ($this->_isSupervisor) {
245 return $this->getSharedComponent()->getVertical();
246 }
247 return $this->_vertical;
248 }

References $_vertical, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleAlignment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWrapText()

PHPExcel_Style_Alignment::getWrapText ( )

Get Wrap Text.

Returns
boolean

Definition at line 315 of file Alignment.php.

315 {
316 if ($this->_isSupervisor) {
317 return $this->getSharedComponent()->getWrapText();
318 }
319 return $this->_wrapText;
320 }

References $_wrapText, and getSharedComponent().

+ Here is the call graph for this function:

◆ setHorizontal()

PHPExcel_Style_Alignment::setHorizontal (   $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)

Set Horizontal.

Parameters
string$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 223 of file Alignment.php.

223 {
224 if ($pValue == '') {
226 }
227
228 if ($this->_isSupervisor) {
229 $styleArray = $this->getStyleArray(array('horizontal' => $pValue));
230 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
231 }
232 else {
233 $this->_horizontal = $pValue;
234 }
235 return $this;
236 }

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), getStyleArray(), and HORIZONTAL_GENERAL.

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIndent()

PHPExcel_Style_Alignment::setIndent (   $pValue = 0)

Set indent.

Parameters
int$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 390 of file Alignment.php.

390 {
391 if ($pValue > 0) {
392 if ($this->getHorizontal() != self::HORIZONTAL_GENERAL &&
393 $this->getHorizontal() != self::HORIZONTAL_LEFT &&
394 $this->getHorizontal() != self::HORIZONTAL_RIGHT) {
395 $pValue = 0; // indent not supported
396 }
397 }
398 if ($this->_isSupervisor) {
399 $styleArray = $this->getStyleArray(array('indent' => $pValue));
400 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
401 } else {
402 $this->_indent = $pValue;
403 }
404 return $this;
405 }
getHorizontal()
Get Horizontal.
Definition: Alignment.php:210

References PHPExcel_Style_Supervisor\getActiveSheet(), getHorizontal(), PHPExcel_Style_Supervisor\getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setReadorder()

PHPExcel_Style_Alignment::setReadorder (   $pValue = 0)

Set read order.

Parameters
int$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 425 of file Alignment.php.

425 {
426 if ($pValue < 0 || $pValue > 2) {
427 $pValue = 0;
428 }
429 if ($this->_isSupervisor) {
430 $styleArray = $this->getStyleArray(array('readorder' => $pValue));
431 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
432 } else {
433 $this->_readorder = $pValue;
434 }
435 return $this;
436 }

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

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShrinkToFit()

PHPExcel_Style_Alignment::setShrinkToFit (   $pValue = FALSE)

Set Shrink to fit.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 359 of file Alignment.php.

359 {
360 if ($pValue == '') {
361 $pValue = FALSE;
362 }
363 if ($this->_isSupervisor) {
364 $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
365 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
366 } else {
367 $this->_shrinkToFit = $pValue;
368 }
369 return $this;
370 }

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

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTextRotation()

PHPExcel_Style_Alignment::setTextRotation (   $pValue = 0)

Set TextRotation.

Parameters
int$pValue
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Alignment

Definition at line 289 of file Alignment.php.

289 {
290 // Excel2007 value 255 => PHPExcel value -165
291 if ($pValue == 255) {
292 $pValue = -165;
293 }
294
295 // Set rotation
296 if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) {
297 if ($this->_isSupervisor) {
298 $styleArray = $this->getStyleArray(array('rotation' => $pValue));
299 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
300 } else {
301 $this->_textRotation = $pValue;
302 }
303 } else {
304 throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90.");
305 }
306
307 return $this;
308 }

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

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setVertical()

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

Set Vertical.

Parameters
string$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 256 of file Alignment.php.

256 {
257 if ($pValue == '') {
259 }
260
261 if ($this->_isSupervisor) {
262 $styleArray = $this->getStyleArray(array('vertical' => $pValue));
263 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
264 } else {
265 $this->_vertical = $pValue;
266 }
267 return $this;
268 }

References PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), getStyleArray(), and VERTICAL_BOTTOM.

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWrapText()

PHPExcel_Style_Alignment::setWrapText (   $pValue = FALSE)

Set Wrap Text.

Parameters
boolean$pValue
Returns
PHPExcel_Style_Alignment

Definition at line 328 of file Alignment.php.

328 {
329 if ($pValue == '') {
330 $pValue = FALSE;
331 }
332 if ($this->_isSupervisor) {
333 $styleArray = $this->getStyleArray(array('wrap' => $pValue));
334 $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
335 } else {
336 $this->_wrapText = $pValue;
337 }
338 return $this;
339 }

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

Referenced by applyFromArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_horizontal

PHPExcel_Style_Alignment::$_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
protected

Definition at line 65 of file Alignment.php.

Referenced by getHorizontal().

◆ $_indent

PHPExcel_Style_Alignment::$_indent = 0
protected

Definition at line 100 of file Alignment.php.

Referenced by getIndent().

◆ $_readorder

PHPExcel_Style_Alignment::$_readorder = 0
protected

Definition at line 107 of file Alignment.php.

Referenced by getReadorder().

◆ $_shrinkToFit

PHPExcel_Style_Alignment::$_shrinkToFit = FALSE
protected

Definition at line 93 of file Alignment.php.

Referenced by getShrinkToFit().

◆ $_textRotation

PHPExcel_Style_Alignment::$_textRotation = 0
protected

Definition at line 79 of file Alignment.php.

Referenced by getTextRotation().

◆ $_vertical

PHPExcel_Style_Alignment::$_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM
protected

Definition at line 72 of file Alignment.php.

Referenced by getVertical().

◆ $_wrapText

PHPExcel_Style_Alignment::$_wrapText = FALSE
protected

Definition at line 86 of file Alignment.php.

Referenced by getWrapText().

◆ HORIZONTAL_CENTER

const PHPExcel_Style_Alignment::HORIZONTAL_CENTER = 'center'

◆ HORIZONTAL_CENTER_CONTINUOUS

const PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'

◆ HORIZONTAL_DISTRIBUTED

const PHPExcel_Style_Alignment::HORIZONTAL_DISTRIBUTED = 'distributed'

Definition at line 46 of file Alignment.php.

◆ HORIZONTAL_FILL

const PHPExcel_Style_Alignment::HORIZONTAL_FILL = 'fill'

Definition at line 45 of file Alignment.php.

Referenced by PHPExcel_Reader_Excel5\_readXf().

◆ HORIZONTAL_GENERAL

◆ HORIZONTAL_JUSTIFY

const PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY = 'justify'

◆ HORIZONTAL_LEFT

◆ HORIZONTAL_RIGHT

const PHPExcel_Style_Alignment::HORIZONTAL_RIGHT = 'right'

◆ READORDER_CONTEXT

const PHPExcel_Style_Alignment::READORDER_CONTEXT = 0

Definition at line 56 of file Alignment.php.

◆ READORDER_LTR

const PHPExcel_Style_Alignment::READORDER_LTR = 1

Definition at line 57 of file Alignment.php.

◆ READORDER_RTL

const PHPExcel_Style_Alignment::READORDER_RTL = 2

Definition at line 58 of file Alignment.php.

◆ VERTICAL_BOTTOM

◆ VERTICAL_CENTER

const PHPExcel_Style_Alignment::VERTICAL_CENTER = 'center'

◆ VERTICAL_DISTRIBUTED

const PHPExcel_Style_Alignment::VERTICAL_DISTRIBUTED = 'distributed'

Definition at line 53 of file Alignment.php.

◆ VERTICAL_JUSTIFY

const PHPExcel_Style_Alignment::VERTICAL_JUSTIFY = 'justify'

◆ VERTICAL_TOP


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