ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Style\Alignment Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Style\Alignment:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Style\Alignment:

Public Member Functions

 __construct ($isSupervisor=false, $isConditional=false)
 Create a new 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 (array $pStyles)
 Apply styles from array. More...
 
 getHorizontal ()
 Get Horizontal. More...
 
 setHorizontal ($pValue)
 Set Horizontal. More...
 
 getVertical ()
 Get Vertical. More...
 
 setVertical ($pValue)
 Set Vertical. More...
 
 getTextRotation ()
 Get TextRotation. More...
 
 setTextRotation ($pValue)
 Set TextRotation. More...
 
 getWrapText ()
 Get Wrap Text. More...
 
 setWrapText ($pValue)
 Set Wrap Text. More...
 
 getShrinkToFit ()
 Get Shrink to fit. More...
 
 setShrinkToFit ($pValue)
 Set Shrink to fit. More...
 
 getIndent ()
 Get indent. More...
 
 setIndent ($pValue)
 Set indent. More...
 
 getReadOrder ()
 Get read order. More...
 
 setReadOrder ($pValue)
 Set read order. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 __construct ($isSupervisor=false)
 Create a new Supervisor. 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...
 
 exportArray ()
 Export style as array. 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
 
const TEXTROTATION_STACK_EXCEL = 255
 
const TEXTROTATION_STACK_PHPSPREADSHEET = -165
 

Protected Member Functions

 exportArray1 ()
 
- Protected Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 exportArray1 ()
 Abstract method to be implemented in anything which extends this class. More...
 
 exportArray2 (array &$exportedArray, string $index, $objOrValue)
 Populate array from exportArray1. More...
 

Protected Attributes

 $horizontal = self::HORIZONTAL_GENERAL
 
 $vertical = self::VERTICAL_BOTTOM
 
 $textRotation = 0
 
 $wrapText = false
 
 $shrinkToFit = false
 
 $indent = 0
 
 $readOrder = 0
 
- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 $isSupervisor
 
 $parent
 
 $parentPropertyName
 

Detailed Description

Definition at line 7 of file Alignment.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Style\Alignment::__construct (   $isSupervisor = false,
  $isConditional = false 
)

Create a new Alignment.

Parameters
bool$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
bool$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 94 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\$isSupervisor.

95  {
96  // Supervisor?
97  parent::__construct($isSupervisor);
98 
99  if ($isConditional) {
100  $this->horizontal = null;
101  $this->vertical = null;
102  $this->textRotation = null;
103  }
104  }

Member Function Documentation

◆ applyFromArray()

PhpOffice\PhpSpreadsheet\Style\Alignment::applyFromArray ( array  $pStyles)

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( [ 'horizontal' => ::HORIZONTAL_CENTER, 'vertical' => ::VERTICAL_CENTER, 'textRotation' => 0, 'wrapText' => TRUE ] );

Parameters
array$pStylesArray containing style information
Returns
$this

Definition at line 147 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray(), PhpOffice\PhpSpreadsheet\Style\Alignment\setHorizontal(), PhpOffice\PhpSpreadsheet\Style\Alignment\setIndent(), PhpOffice\PhpSpreadsheet\Style\Alignment\setReadOrder(), PhpOffice\PhpSpreadsheet\Style\Alignment\setShrinkToFit(), PhpOffice\PhpSpreadsheet\Style\Alignment\setTextRotation(), PhpOffice\PhpSpreadsheet\Style\Alignment\setVertical(), and PhpOffice\PhpSpreadsheet\Style\Alignment\setWrapText().

148  {
149  if ($this->isSupervisor) {
150  $this->getActiveSheet()->getStyle($this->getSelectedCells())
151  ->applyFromArray($this->getStyleArray($pStyles));
152  } else {
153  if (isset($pStyles['horizontal'])) {
154  $this->setHorizontal($pStyles['horizontal']);
155  }
156  if (isset($pStyles['vertical'])) {
157  $this->setVertical($pStyles['vertical']);
158  }
159  if (isset($pStyles['textRotation'])) {
160  $this->setTextRotation($pStyles['textRotation']);
161  }
162  if (isset($pStyles['wrapText'])) {
163  $this->setWrapText($pStyles['wrapText']);
164  }
165  if (isset($pStyles['shrinkToFit'])) {
166  $this->setShrinkToFit($pStyles['shrinkToFit']);
167  }
168  if (isset($pStyles['indent'])) {
169  $this->setIndent($pStyles['indent']);
170  }
171  if (isset($pStyles['readOrder'])) {
172  $this->setReadOrder($pStyles['readOrder']);
173  }
174  }
175 
176  return $this;
177  }
setTextRotation($pValue)
Set TextRotation.
Definition: Alignment.php:274
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
setWrapText($pValue)
Set Wrap Text.
Definition: Alignment.php:317
setShrinkToFit($pValue)
Set Shrink to fit.
Definition: Alignment.php:353
setReadOrder($pValue)
Set read order.
Definition: Alignment.php:432
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
setVertical($pValue)
Set Vertical.
Definition: Alignment.php:237
setHorizontal($pValue)
Set Horizontal.
Definition: Alignment.php:200
+ Here is the call graph for this function:

◆ exportArray1()

PhpOffice\PhpSpreadsheet\Style\Alignment::exportArray1 ( )
protected

Definition at line 470 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\exportArray2(), PhpOffice\PhpSpreadsheet\Style\Alignment\getHorizontal(), PhpOffice\PhpSpreadsheet\Style\Alignment\getIndent(), PhpOffice\PhpSpreadsheet\Style\Alignment\getReadOrder(), PhpOffice\PhpSpreadsheet\Style\Alignment\getShrinkToFit(), PhpOffice\PhpSpreadsheet\Style\Alignment\getTextRotation(), PhpOffice\PhpSpreadsheet\Style\Alignment\getVertical(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getWrapText().

470  : array
471  {
472  $exportedArray = [];
473  $this->exportArray2($exportedArray, 'horizontal', $this->getHorizontal());
474  $this->exportArray2($exportedArray, 'indent', $this->getIndent());
475  $this->exportArray2($exportedArray, 'readOrder', $this->getReadOrder());
476  $this->exportArray2($exportedArray, 'shrinkToFit', $this->getShrinkToFit());
477  $this->exportArray2($exportedArray, 'textRotation', $this->getTextRotation());
478  $this->exportArray2($exportedArray, 'vertical', $this->getVertical());
479  $this->exportArray2($exportedArray, 'wrapText', $this->getWrapText());
480 
481  return $exportedArray;
482  }
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
Definition: Supervisor.php:150
+ Here is the call graph for this function:

◆ getHashCode()

PhpOffice\PhpSpreadsheet\Style\Alignment::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

Definition at line 452 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

453  {
454  if ($this->isSupervisor) {
455  return $this->getSharedComponent()->getHashCode();
456  }
457 
458  return md5(
459  $this->horizontal .
460  $this->vertical .
461  $this->textRotation .
462  ($this->wrapText ? 't' : 'f') .
463  ($this->shrinkToFit ? 't' : 'f') .
464  $this->indent .
465  $this->readOrder .
466  __CLASS__
467  );
468  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:

◆ getHorizontal()

PhpOffice\PhpSpreadsheet\Style\Alignment::getHorizontal ( )

Get Horizontal.

Returns
null|string

Definition at line 184 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$horizontal, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleAlignment(), PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1(), PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\horizontal(), and PhpOffice\PhpSpreadsheet\Style\Alignment\setIndent().

185  {
186  if ($this->isSupervisor) {
187  return $this->getSharedComponent()->getHorizontal();
188  }
189 
190  return $this->horizontal;
191  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIndent()

PhpOffice\PhpSpreadsheet\Style\Alignment::getIndent ( )

Get indent.

Returns
int

Definition at line 373 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$indent, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleAlignment(), and PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1().

374  {
375  if ($this->isSupervisor) {
376  return $this->getSharedComponent()->getIndent();
377  }
378 
379  return $this->indent;
380  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReadOrder()

PhpOffice\PhpSpreadsheet\Style\Alignment::getReadOrder ( )

Get read order.

Returns
int

Definition at line 416 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$readOrder, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1().

417  {
418  if ($this->isSupervisor) {
419  return $this->getSharedComponent()->getReadOrder();
420  }
421 
422  return $this->readOrder;
423  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSharedComponent()

PhpOffice\PhpSpreadsheet\Style\Alignment::getSharedComponent ( )

◆ getShrinkToFit()

PhpOffice\PhpSpreadsheet\Style\Alignment::getShrinkToFit ( )

Get Shrink to fit.

Returns
bool

Definition at line 337 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$shrinkToFit, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1().

338  {
339  if ($this->isSupervisor) {
340  return $this->getSharedComponent()->getShrinkToFit();
341  }
342 
343  return $this->shrinkToFit;
344  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleArray()

PhpOffice\PhpSpreadsheet\Style\Alignment::getStyleArray (   $array)

◆ getTextRotation()

PhpOffice\PhpSpreadsheet\Style\Alignment::getTextRotation ( )

Get TextRotation.

Returns
null|int

Definition at line 258 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$textRotation, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1().

259  {
260  if ($this->isSupervisor) {
261  return $this->getSharedComponent()->getTextRotation();
262  }
263 
264  return $this->textRotation;
265  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVertical()

PhpOffice\PhpSpreadsheet\Style\Alignment::getVertical ( )

Get Vertical.

Returns
null|string

Definition at line 221 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$vertical, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleAlignment(), PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\vertical().

222  {
223  if ($this->isSupervisor) {
224  return $this->getSharedComponent()->getVertical();
225  }
226 
227  return $this->vertical;
228  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWrapText()

PhpOffice\PhpSpreadsheet\Style\Alignment::getWrapText ( )

Get Wrap Text.

Returns
bool

Definition at line 301 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Alignment\$wrapText, and PhpOffice\PhpSpreadsheet\Style\Alignment\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellAlignment\wrap().

302  {
303  if ($this->isSupervisor) {
304  return $this->getSharedComponent()->getWrapText();
305  }
306 
307  return $this->wrapText;
308  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Alignment.php:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHorizontal()

PhpOffice\PhpSpreadsheet\Style\Alignment::setHorizontal (   $pValue)

Set Horizontal.

Parameters
string$pValuesee self::HORIZONTAL_*
Returns
$this

Definition at line 200 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellAlignment\horizontal(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle().

201  {
202  if ($pValue == '') {
203  $pValue = self::HORIZONTAL_GENERAL;
204  }
205 
206  if ($this->isSupervisor) {
207  $styleArray = $this->getStyleArray(['horizontal' => $pValue]);
208  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
209  } else {
210  $this->horizontal = $pValue;
211  }
212 
213  return $this;
214  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIndent()

PhpOffice\PhpSpreadsheet\Style\Alignment::setIndent (   $pValue)

Set indent.

Parameters
int$pValue
Returns
$this

Definition at line 389 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Alignment\getHorizontal(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle().

390  {
391  if ($pValue > 0) {
392  if (
393  $this->getHorizontal() != self::HORIZONTAL_GENERAL &&
394  $this->getHorizontal() != self::HORIZONTAL_LEFT &&
395  $this->getHorizontal() != self::HORIZONTAL_RIGHT &&
396  $this->getHorizontal() != self::HORIZONTAL_DISTRIBUTED
397  ) {
398  $pValue = 0; // indent not supported
399  }
400  }
401  if ($this->isSupervisor) {
402  $styleArray = $this->getStyleArray(['indent' => $pValue]);
403  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
404  } else {
405  $this->indent = $pValue;
406  }
407 
408  return $this;
409  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setReadOrder()

PhpOffice\PhpSpreadsheet\Style\Alignment::setReadOrder (   $pValue)

Set read order.

Parameters
int$pValue
Returns
$this

Definition at line 432 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle().

433  {
434  if ($pValue < 0 || $pValue > 2) {
435  $pValue = 0;
436  }
437  if ($this->isSupervisor) {
438  $styleArray = $this->getStyleArray(['readOrder' => $pValue]);
439  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
440  } else {
441  $this->readOrder = $pValue;
442  }
443 
444  return $this;
445  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShrinkToFit()

PhpOffice\PhpSpreadsheet\Style\Alignment::setShrinkToFit (   $pValue)

Set Shrink to fit.

Parameters
bool$pValue
Returns
$this

Definition at line 353 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle().

354  {
355  if ($pValue == '') {
356  $pValue = false;
357  }
358  if ($this->isSupervisor) {
359  $styleArray = $this->getStyleArray(['shrinkToFit' => $pValue]);
360  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
361  } else {
362  $this->shrinkToFit = $pValue;
363  }
364 
365  return $this;
366  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTextRotation()

PhpOffice\PhpSpreadsheet\Style\Alignment::setTextRotation (   $pValue)

Set TextRotation.

Parameters
int$pValue
Returns
$this

Definition at line 274 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle().

275  {
276  // Excel2007 value 255 => PhpSpreadsheet value -165
277  if ($pValue == self::TEXTROTATION_STACK_EXCEL) {
278  $pValue = self::TEXTROTATION_STACK_PHPSPREADSHEET;
279  }
280 
281  // Set rotation
282  if (($pValue >= -90 && $pValue <= 90) || $pValue == self::TEXTROTATION_STACK_PHPSPREADSHEET) {
283  if ($this->isSupervisor) {
284  $styleArray = $this->getStyleArray(['textRotation' => $pValue]);
285  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
286  } else {
287  $this->textRotation = $pValue;
288  }
289  } else {
290  throw new PhpSpreadsheetException('Text rotation should be a value between -90 and 90.');
291  }
292 
293  return $this;
294  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setVertical()

PhpOffice\PhpSpreadsheet\Style\Alignment::setVertical (   $pValue)

Set Vertical.

Parameters
string$pValuesee self::VERTICAL_*
Returns
$this

Definition at line 237 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle(), and PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellAlignment\vertical().

238  {
239  if ($pValue == '') {
240  $pValue = self::VERTICAL_BOTTOM;
241  }
242 
243  if ($this->isSupervisor) {
244  $styleArray = $this->getStyleArray(['vertical' => $pValue]);
245  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
246  } else {
247  $this->vertical = $pValue;
248  }
249 
250  return $this;
251  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWrapText()

PhpOffice\PhpSpreadsheet\Style\Alignment::setWrapText (   $pValue)

Set Wrap Text.

Parameters
bool$pValue
Returns
$this

Definition at line 317 of file Alignment.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Alignment\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readAlignmentStyle(), and PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellAlignment\wrap().

318  {
319  if ($pValue == '') {
320  $pValue = false;
321  }
322  if ($this->isSupervisor) {
323  $styleArray = $this->getStyleArray(['wrapText' => $pValue]);
324  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
325  } else {
326  $this->wrapText = $pValue;
327  }
328 
329  return $this;
330  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Alignment.php:124
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $horizontal

PhpOffice\PhpSpreadsheet\Style\Alignment::$horizontal = self::HORIZONTAL_GENERAL
protected

◆ $indent

PhpOffice\PhpSpreadsheet\Style\Alignment::$indent = 0
protected

Definition at line 75 of file Alignment.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\getIndent().

◆ $readOrder

PhpOffice\PhpSpreadsheet\Style\Alignment::$readOrder = 0
protected

Definition at line 82 of file Alignment.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\getReadOrder().

◆ $shrinkToFit

PhpOffice\PhpSpreadsheet\Style\Alignment::$shrinkToFit = false
protected

◆ $textRotation

PhpOffice\PhpSpreadsheet\Style\Alignment::$textRotation = 0
protected

◆ $vertical

PhpOffice\PhpSpreadsheet\Style\Alignment::$vertical = self::VERTICAL_BOTTOM
protected

Definition at line 47 of file Alignment.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\getVertical().

◆ $wrapText

PhpOffice\PhpSpreadsheet\Style\Alignment::$wrapText = false
protected

Definition at line 61 of file Alignment.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Alignment\getWrapText().

◆ HORIZONTAL_CENTER

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER = 'center'

◆ HORIZONTAL_CENTER_CONTINUOUS

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'

◆ HORIZONTAL_DISTRIBUTED

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_DISTRIBUTED = 'distributed'

◆ HORIZONTAL_FILL

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_FILL = 'fill'

◆ HORIZONTAL_GENERAL

◆ HORIZONTAL_JUSTIFY

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_JUSTIFY = 'justify'

◆ HORIZONTAL_LEFT

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT = 'left'

Definition at line 11 of file Alignment.php.

◆ HORIZONTAL_RIGHT

const PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT = 'right'

◆ READORDER_CONTEXT

const PhpOffice\PhpSpreadsheet\Style\Alignment::READORDER_CONTEXT = 0

Definition at line 27 of file Alignment.php.

◆ READORDER_LTR

const PhpOffice\PhpSpreadsheet\Style\Alignment::READORDER_LTR = 1

Definition at line 28 of file Alignment.php.

◆ READORDER_RTL

const PhpOffice\PhpSpreadsheet\Style\Alignment::READORDER_RTL = 2

Definition at line 29 of file Alignment.php.

◆ TEXTROTATION_STACK_EXCEL

const PhpOffice\PhpSpreadsheet\Style\Alignment::TEXTROTATION_STACK_EXCEL = 255

◆ TEXTROTATION_STACK_PHPSPREADSHEET

const PhpOffice\PhpSpreadsheet\Style\Alignment::TEXTROTATION_STACK_PHPSPREADSHEET = -165

◆ VERTICAL_BOTTOM

const PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_BOTTOM = 'bottom'

◆ VERTICAL_CENTER

const PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER = 'center'

◆ VERTICAL_DISTRIBUTED

const PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_DISTRIBUTED = 'distributed'

◆ VERTICAL_JUSTIFY

const PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_JUSTIFY = 'justify'

◆ VERTICAL_TOP

const PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_TOP = 'top'

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